1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-23 07:27:12 +01:00

tui: show edit date in toot view

When viewing a toot which has been edited, show the edit date.

While here, fix a bug where the '*' edit marker in the timeline wouldn't
show for retoots because it was checking the retoot status instead of
the original status.
This commit is contained in:
Lexi Winter 2023-12-31 16:51:02 +00:00
parent 09b29d2b93
commit d0f05c7ad9
2 changed files with 7 additions and 1 deletions

View File

@ -53,6 +53,10 @@ class Status:
self.id = self.data["id"]
self.account = self._get_account()
self.created_at = parse_datetime(data["created_at"])
if data["edited_at"]:
self.edited_at = parse_datetime(data["edited_at"])
else:
self.edited_at = None
self.author = self._get_author()
self.favourited = data.get("favourited", False)
self.reblogged = data.get("reblogged", False)

View File

@ -388,6 +388,8 @@ class StatusDetails(urwid.Pile):
yield ("pack", urwid.Text([
("status_detail_timestamp", f"{status.created_at.strftime('%Y-%m-%d %H:%M')} "),
("status_detail_timestamp",
f"(edited {status.edited_at.strftime('%Y-%m-%d %H:%M')}) " if status.edited_at else ""),
("status_detail_bookmarked" if status.bookmarked else "dim", "b "),
("dim", f"{status.data['replies_count']} "),
("highlight" if status.reblogged else "dim", f"{status.data['reblogs_count']} "),
@ -442,7 +444,7 @@ class StatusDetails(urwid.Pile):
class StatusListItem(SelectableColumns):
def __init__(self, status, relative_datetimes):
edited_at = status.data.get("edited_at")
edited_at = status.original.edited_at
# TODO: hacky implementation to avoid creating conflicts for existing
# pull reuqests, refactor when merged.