From f91bfa0c62e7724a5e4d9cec4c7fbc68915771c9 Mon Sep 17 00:00:00 2001 From: Lim Ding Wen Date: Wed, 28 Dec 2022 08:53:44 +0100 Subject: [PATCH] TUI no longer mentions self when replying This brings it more in-line with Mastodon v4's web UI. --- toot/tui/app.py | 2 +- toot/tui/compose.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/toot/tui/app.py b/toot/tui/app.py index 2dd53dc..5f5a2c3 100644 --- a/toot/tui/app.py +++ b/toot/tui/app.py @@ -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") diff --git a/toot/tui/compose.py b/toot/tui/compose.py index 913ca3e..44b7e47 100644 --- a/toot/tui/compose.py +++ b/toot/tui/compose.py @@ -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))