fix(post_parser): correct content order when caption display flag is toggled

The changes ensure that when `show_caption_above` is true, text content is rendered before media, and when false, media is rendered before text. This aligns the actual rendering order with the semantic meaning of the flag, fixing a bug where content ordering did not match user expectations.
This commit is contained in:
vvzvlad
2026-01-02 05:38:30 +03:00
parent 76e163098b
commit 5257c50243
+7 -6
View File
@@ -615,19 +615,20 @@ class PostParser:
show_caption_above = getattr(message, 'show_caption_above_media', False)
if show_caption_above:
if media_html:
content_body.append(media_html)
content_body.append("<br>")
if text_html:
content_body.append(text_html)
content_body.append("<br>")
if media_html:
content_body.append(media_html)
content_body.append("<br>")
else:
if text_html:
content_body.append(text_html)
content_body.append("<br>")
if media_html:
content_body.append(media_html)
content_body.append("<br>")
if text_html:
content_body.append(text_html)
content_body.append("<br>")
if poll_html: content_body.append(poll_html) # Poll
if message.forward_origin: content_body.append(f"--- Forwarded post end ---") # Forward info end