mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2026-11-02 09:39:35 +01:00
Stop prefilling @handle in Bluesky replies and DMs, fix duplicate Mastodon mention
Bluesky replies carry parent/root references, so the author is notified without a mention in the text. The prefilled "@handle" only created a redundant mention facet, and used the reposter's handle for reposts. Direct messages are plain text sent to a conversation, so the prefill was useless there too. In Mastodon's send_message, the author check compared the bare acct with a list of "@acct " strings, so it never matched and duplicated the mention. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
9822f25809
commit
a762f94546
@@ -224,19 +224,8 @@ class BaseBuffer(base.Buffer):
|
|||||||
reply_cid = self.get_selected_item_cid()
|
reply_cid = self.get_selected_item_cid()
|
||||||
# Attempt to get CID if present for consistency, though send_message handles it
|
# Attempt to get CID if present for consistency, though send_message handles it
|
||||||
|
|
||||||
def g(obj, key, default=None):
|
# No "@handle" prefill: the reply reference (parent/root) already notifies the author.
|
||||||
if isinstance(obj, dict):
|
dlg = blueski_messages.post(session=self.session, title=_("Reply"), caption=_("Reply"))
|
||||||
return obj.get(key, default)
|
|
||||||
return getattr(obj, key, default)
|
|
||||||
|
|
||||||
author = g(item, "author")
|
|
||||||
if not author:
|
|
||||||
post = g(item, "post") or g(item, "record")
|
|
||||||
author = g(post, "author") if post else None
|
|
||||||
handle = g(author, "handle", "")
|
|
||||||
initial_text = f"@{handle} " if handle and not handle.startswith("@") else (f"{handle} " if handle else "")
|
|
||||||
|
|
||||||
dlg = blueski_messages.post(session=self.session, title=_("Reply"), caption=_("Reply"), text=initial_text)
|
|
||||||
if dlg.message.ShowModal() == wx.ID_OK:
|
if dlg.message.ShowModal() == wx.ID_OK:
|
||||||
text, files, cw, langs = dlg.get_data()
|
text, files, cw, langs = dlg.get_data()
|
||||||
refresh_args = (True, False) if getattr(self, "type", "") == "conversation" else None
|
refresh_args = (True, False) if getattr(self, "type", "") == "conversation" else None
|
||||||
@@ -495,9 +484,8 @@ class BaseBuffer(base.Buffer):
|
|||||||
# Use full post dialog like Mastodon
|
# Use full post dialog like Mastodon
|
||||||
title = _("Conversation with {0}").format(handle)
|
title = _("Conversation with {0}").format(handle)
|
||||||
caption = _("Write your message here")
|
caption = _("Write your message here")
|
||||||
initial_text = "@{} ".format(handle)
|
|
||||||
|
|
||||||
post = blueski_messages.post(session=self.session, title=title, caption=caption, text=initial_text)
|
post = blueski_messages.post(session=self.session, title=title, caption=caption)
|
||||||
if post.message.ShowModal() == wx.ID_OK:
|
if post.message.ShowModal() == wx.ID_OK:
|
||||||
text, files, cw_text, langs = post.get_data()
|
text, files, cw_text, langs = post.get_data()
|
||||||
if text:
|
if text:
|
||||||
|
|||||||
@@ -331,9 +331,8 @@ class ConversationListBuffer(BaseBuffer):
|
|||||||
|
|
||||||
title = _("Conversation with {0}").format(username)
|
title = _("Conversation with {0}").format(username)
|
||||||
caption = _("Write your message here")
|
caption = _("Write your message here")
|
||||||
initial_text = "@{} ".format(username)
|
|
||||||
|
|
||||||
post = blueski_messages.post(session=self.session, title=title, caption=caption, text=initial_text)
|
post = blueski_messages.post(session=self.session, title=title, caption=caption)
|
||||||
if post.message.ShowModal() == wx.ID_OK:
|
if post.message.ShowModal() == wx.ID_OK:
|
||||||
text, files, cw_text, langs = post.get_data()
|
text, files, cw_text, langs = post.get_data()
|
||||||
if text:
|
if text:
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ class BaseBuffer(base.Buffer):
|
|||||||
users.append("@{} ".format(item.reblog.account.acct))
|
users.append("@{} ".format(item.reblog.account.acct))
|
||||||
else:
|
else:
|
||||||
users = ["@{} ".format(user.acct) for user in item.mentions if user.id != self.session.db["user_id"]]
|
users = ["@{} ".format(user.acct) for user in item.mentions if user.id != self.session.db["user_id"]]
|
||||||
if item.account.acct not in users and item.account.id != self.session.db["user_id"]:
|
if "@{} ".format(item.account.acct) not in users and item.account.id != self.session.db["user_id"]:
|
||||||
users.insert(0, "@{} ".format(item.account.acct))
|
users.insert(0, "@{} ".format(item.account.acct))
|
||||||
users_str = "".join(users)
|
users_str = "".join(users)
|
||||||
post = messages.post(session=self.session, title=title, caption=caption, text=users_str)
|
post = messages.post(session=self.session, title=title, caption=caption, text=users_str)
|
||||||
|
|||||||
Reference in New Issue
Block a user