Skip to content

FIX: image aspect ratio rendering and edits#158

Merged
merefield merged 6 commits into
mainfrom
paint_aspect_fixes
Mar 21, 2026
Merged

FIX: image aspect ratio rendering and edits#158
merefield merged 6 commits into
mainfrom
paint_aspect_fixes

Conversation

@merefield

@merefield merefield commented Mar 21, 2026

Copy link
Copy Markdown
Owner
  • ensures markdown image thumbnail has consistent aspect ratio
  • ensures edits do not change aspect ratio
  • however, edits can specify an aspect ratio as optional

Copilot AI 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.

Pull request overview

Updates the chatbot “paint” and “paint_edit” image workflows so generated/edited image markdown preserves the actual image aspect ratio (and allows an optional aspect ratio override for edits), aligning rendering behavior with the underlying upload dimensions.

Changes:

  • Render image markdown using upload width/height (with a size fallback) instead of a fixed 690x460.
  • Preserve original aspect ratio for edits by default, with optional aspect_ratio override support.
  • Add/extend specs covering markdown parsing, aspect ratio detection, and markdown rendering.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
spec/lib/message_reply_creator_spec.rb Adds coverage to ensure uploads are found from markdown with arbitrary dimensions.
spec/lib/functions/paint_function_spec.rb Updates/extends specs for class helpers and markdown rendering using upload dimensions.
spec/lib/functions/paint_edit_function_spec.rb Adds coverage for aspect ratio override vs. “keep original” behavior.
plugin.rb Bumps plugin version to 1.7.1.
lib/discourse_chatbot/message/message_reply_creator.rb Generalizes markdown parsing to match any WxH dimensions and simplifies upload lookup iteration.
lib/discourse_chatbot/functions/paint_function.rb Centralizes aspect ratio + markdown helpers; renders markdown using upload dimensions.
lib/discourse_chatbot/functions/paint_edit_function.rb Adds aspect_ratio parameter and resolves edit size based on original upload unless overridden.
config/locales/server.en.yml Adds locale string for the new aspect_ratio override parameter on paint_edit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/locales/server.en.yml
Comment thread lib/discourse_chatbot/functions/paint_edit_function.rb Outdated
Comment thread lib/discourse_chatbot/functions/paint_edit_function.rb Outdated
Comment thread lib/discourse_chatbot/functions/paint_function.rb Outdated
Comment thread lib/discourse_chatbot/functions/paint_function.rb Outdated
@merefield merefield merged commit 41b6b55 into main Mar 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants