mirror of
https://github.com/ihabunek/toot
synced 2025-01-03 12:39:30 +01:00
Include mentions and replied-to account in compose text
We add a "mentions" attribute to Status. Then when composing a reply, we fill the edit text of the compose box with the account name of status being replied to and possibly include mentions at the bottom of the edit text. Initial cursor position is set after replied account name.
This commit is contained in:
parent
a76f4ae815
commit
9623219959
@ -14,7 +14,15 @@ class StatusComposer(urwid.Frame):
|
||||
|
||||
def __init__(self, in_reply_to=None):
|
||||
self.in_reply_to = in_reply_to
|
||||
self.content_edit = EditBox(multiline=True, allow_tab=True)
|
||||
text, edit_pos = '', None
|
||||
if in_reply_to is not None:
|
||||
text = f'@{in_reply_to.account} '
|
||||
edit_pos = len(text)
|
||||
mentions = [f'@{m["acct"]}' for m in in_reply_to.mentions]
|
||||
if mentions:
|
||||
text += '\n\n{}'.format(' '.join(mentions))
|
||||
self.content_edit = EditBox(edit_text=text, edit_pos=edit_pos,
|
||||
multiline=True, allow_tab=True)
|
||||
|
||||
self.cw_edit = None
|
||||
self.cw_add_button = Button("Add content warning",
|
||||
|
@ -34,6 +34,8 @@ class Status:
|
||||
self.reblog = reblog = data.get("reblog")
|
||||
self.url = reblog.get("url") if reblog else data.get("url")
|
||||
|
||||
self.mentions = data["mentions"]
|
||||
|
||||
def get_author(self):
|
||||
# Show the author, not the persopn who reblogged
|
||||
data = self.data["reblog"] or self.data
|
||||
|
Loading…
Reference in New Issue
Block a user