TUI no longer mentions self when replying

This brings it more in-line with Mastodon v4's web UI.
This commit is contained in:
Lim Ding Wen 2022-12-28 08:53:44 +01:00 committed by Ivan Habunek
parent 69718f41f6
commit f91bfa0c62
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
2 changed files with 5 additions and 4 deletions

View File

@ -379,7 +379,7 @@ class TUI(urwid.Frame):
def _post(timeline, *args):
self.post_status(*args)
composer = StatusComposer(self.max_toot_chars, in_reply_to)
composer = StatusComposer(self.max_toot_chars, self.user.username, in_reply_to)
urwid.connect_signal(composer, "close", _close)
urwid.connect_signal(composer, "post", _post)
self.open_overlay(composer, title="Compose status")

View File

@ -13,9 +13,10 @@ class StatusComposer(urwid.Frame):
"""
signals = ["close", "post"]
def __init__(self, max_chars, in_reply_to=None):
def __init__(self, max_chars, username, in_reply_to=None):
self.in_reply_to = in_reply_to
self.max_chars = max_chars
self.username = username
text = self.get_initial_text(in_reply_to)
self.content_edit = EditBox(
@ -46,8 +47,8 @@ class StatusComposer(urwid.Frame):
if not in_reply_to:
return ""
text = '@{} '.format(in_reply_to.original.account)
mentions = ['@{}'.format(m["acct"]) for m in in_reply_to.mentions]
text = '' if in_reply_to.is_mine else '@{} '.format(in_reply_to.original.account)
mentions = ['@{}'.format(m["acct"]) for m in in_reply_to.mentions if m["acct"] != self.username]
if mentions:
text += '\n\n{}'.format(' '.join(mentions))