Skip to content

Commit

Permalink
Show number of replies/reblogs/favourites in status footer of curses ui
Browse files Browse the repository at this point in the history
When parsing "replies_count" from status data, we allow the field to be
absent as it got added in version 2.5.0 (in constrast with other ones,
added in 0.1.0) as there might be servers with that version around.
  • Loading branch information
dlax authored and ihabunek committed Feb 15, 2019
1 parent 4bc963a commit 5a867f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions toot/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ def footer_lines(self, status):
if status['reblogged']:
yield "↷ Boosted", Color.CYAN

yield (
"{replies_count} replies, "
"{reblogs_count} reblogs, "
"{favourites_count} favourites"
).format(**status), Color.CYAN

def draw(self, status):
self.window.erase()
self.window.box()
Expand Down
3 changes: 3 additions & 0 deletions toot/ui/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ def parse_status(status):
'created_at': created_at,
'content': content,
'favourited': status.get('favourited'),
'favourites_count': _status['favourites_count'],
'id': status['id'],
'in_reply_to_id': _status.get('in_reply_to_id'),
'media_attachments': _status['media_attachments'],
'url': _status['url'],
'reblogged': status.get('reblogged'),
'reblogs_count': _status['reblogs_count'],
'replies_count': _status.get('replies_count', 0),
'spoiler_text': spoiler_text,
'sensitive': _status['sensitive'],
'show_sensitive': False,
Expand Down

0 comments on commit 5a867f2

Please sign in to comment.