FIX: image aspect ratio rendering and edits#158
Merged
Conversation
There was a problem hiding this comment.
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_ratiooverride 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.