Redesign review cards with preview regeneration and improved target status

This commit is contained in:
Antigravity Bot
2026-08-30 01:12:53 +03:30
parent 73035f8c19
commit 3ea9db9253
+8 -4
View File
@@ -634,11 +634,11 @@ class AdminBotService:
def _format_raw_post_caption(self, post: Post) -> str:
published_lines = ""
if post.published_to:
published_lines = "📤 <b>ارسال شده / در صف ارسال کانال‌های:</b>\n"
published_lines = "📤 <b>وضعیت ارسال به کانال‌های مقصد:</b>\n"
for item in post.published_to:
if isinstance(item, dict):
t_title = item.get("target_title", "کانال مقصد")
published_lines += f" • <b>{t_title}</b>\n"
published_lines += f" 🟢 <b>{t_title}</b> (در صف انتشار)\n"
published_lines += "➖➖➖➖➖➖➖➖➖➖\n\n"
rejection_line = ""
@@ -649,10 +649,13 @@ class AdminBotService:
f"➖➖➖➖➖➖➖➖➖➖\n\n"
)
tag_line = f"🏷 <b>موضوع:</b> #{post.subject}\n\n" if getattr(post, "subject", None) else ""
caption = (
f"📥 <b>پست جدید از مبدا (<code>{post.source_channel_id}</code>):</b>\n\n"
f"{rejection_line}"
f"{published_lines}"
f"{tag_line}"
f"{post.raw_text or ''}\n\n"
f"<i>👇 کانال مقصد مورد نظر را برای بازنویسی هوشمند انتخاب کنید:</i>"
)
@@ -3139,7 +3142,8 @@ class AdminBotService:
Button.inline(f"✅ تایید و افزودن به صف {target.title}", data=f"pub:{post_id}:{target_id}"),
],
[
Button.inline("🔙 انصراف / بازگشت به پست اصلی", data=f"cancel:{post_id}")
Button.inline("🔄 بازنویسی مجدد", data=f"sel_trg:{post_id}:{target_id}"),
Button.inline("🔙 بازگشت به پست اصلی", data=f"cancel:{post_id}")
]
]
await event.edit(
@@ -3160,7 +3164,7 @@ class AdminBotService:
return
cache_key = f"{post_id}:{target_id}"
text_to_publish = self.preview_cache.get(cache_key) or post.raw_text or ""
text_to_publish = self.preview_cache.pop(cache_key, None) or post.raw_text or ""
payload = {
"post_id": post.id,