Skip to content

fix: always default InlineQueryResultPhoto thumbnail to photo url - #953

Open
KnightNiwrem wants to merge 2 commits into
v2from
fix/inline-query-photo-thumbnail
Open

KnightNiwrem wants to merge 2 commits into
v2from
fix/inline-query-photo-thumbnail

Conversation

@KnightNiwrem

Copy link
Copy Markdown
Member

Note

This PR was primarily written by GPT-5.6 Sol xhigh in ChatGPT Work.

Summary

Ensure that InlineQueryResultBuilder.photo always defaults thumbnail_url to the photo URL, including when callers supply other options.

The builder now:

  • normalizes photo_url once
  • sets thumbnail_url before spreading options, so an explicit thumbnail still overrides the default
  • makes thumbnail_url optional in the builder's options type
  • covers both defaulted and explicitly supplied thumbnails with regression tests

Why

The existing implementation puts the default thumbnail inside the default value of the entire options parameter. JavaScript only evaluates that default when options is omitted completely. Passing an object such as { caption: "cap" } therefore drops the documented default thumbnail.

This was fixed on main in #879. This PR ports the same implementation and regression coverage to v2.

Verification

  • reproduced the missing thumbnail_url before the change
  • deno fmt --check src/convenience/inline_query.ts test/convenience/inline_query.test.ts
  • deno lint src/convenience/inline_query.ts test/convenience/inline_query.test.ts
  • deno check --no-config src/convenience/inline_query.ts
  • type-checked and executed a standalone probe covering both default and explicit thumbnails

@KnightNiwrem
KnightNiwrem marked this pull request as ready for review August 15, 2026 18:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bf45c0bbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/convenience/inline_query.ts Outdated
@KnorpelSenf KnorpelSenf added the v2 related to grammY 2.0 label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 related to grammY 2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants