From a0ebb9b559b724ca9b0d3003ec8f82c2a1f47e21 Mon Sep 17 00:00:00 2001 From: woorst Date: Tue, 2 Oct 2018 06:28:55 -0400 Subject: [PATCH] Display time stamp of edited posts/comments. --- rtv/content.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/rtv/content.py b/rtv/content.py index 6932fb7..c7ece55 100644 --- a/rtv/content.py +++ b/rtv/content.py @@ -160,7 +160,11 @@ class Content(object): data['stickied'] = stickied data['hidden'] = False data['saved'] = comment.saved - data['edited'] = '*' if comment.edited else '' + if comment.edited: + data['edited'] = '(edit {})'.format( + cls.humanize_timestamp(comment.edited)) + else: + data['edited'] = '' else: # Saved comments don't have a nested level and are missing a couple # of fields like ``submission``. As a result, we can only load a @@ -190,7 +194,11 @@ class Content(object): data['author'] = author data['flair'] = flair data['hidden'] = False - data['edited'] = '*' if comment.edited else '' + if comment.edited: + data['edited'] = '(edit {})'.format( + cls.humanize_timestamp(comment.edited)) + else: + data['edited'] = '' return data @@ -236,7 +244,14 @@ class Content(object): data['xpost_subreddit'] = None data['index'] = None # This is filled in later by the method caller data['saved'] = sub.saved - data['edited'] = '*' if sub.edited else '' + if sub.edited: + data['edited'] = '(edit {})'.format( + cls.humanize_timestamp(sub.edited)) + data['edited_long'] = '(edit {})'.format( + cls.humanize_timestamp(sub.edited, True)) + else: + data['edited'] = '' + data['edited_long'] = '' if sub.url.split('/r/')[-1] == sub.permalink.split('/r/')[-1]: data['url'] = 'self.{0}'.format(data['subreddit'])