Merge pull request #613 from woorst/mark_edited

Indicate edited submissions/comments.
This commit is contained in:
Michael Lazar
2018-10-23 10:36:58 -04:00
committed by GitHub
3 changed files with 24 additions and 3 deletions

View File

@@ -162,6 +162,11 @@ class Content(object):
data['stickied'] = stickied
data['hidden'] = False
data['saved'] = comment.saved
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
@@ -191,6 +196,11 @@ class Content(object):
data['author'] = author
data['flair'] = flair
data['hidden'] = False
if comment.edited:
data['edited'] = '(edit {})'.format(
cls.humanize_timestamp(comment.edited))
else:
data['edited'] = ''
return data
@@ -237,6 +247,14 @@ class Content(object):
data['xpost_subreddit'] = None
data['index'] = None # This is filled in later by the method caller
data['saved'] = sub.saved
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'])

View File

@@ -363,7 +363,8 @@ class SubmissionPage(Page):
attr = self.term.attr('Created')
self.term.add_space(win)
self.term.add_line(win, '{created}'.format(**data), attr=attr)
self.term.add_line(win, '{created}{edited}'.format(**data),
attr=attr)
if data['gold']:
attr = self.term.attr('Gold')
@@ -434,7 +435,8 @@ class SubmissionPage(Page):
attr = self.term.attr('Created')
self.term.add_space(win)
self.term.add_line(win, '{created_long}'.format(**data), attr=attr)
self.term.add_line(win, '{created_long}{edited_long}'.format(**data),
attr=attr)
row = len(data['split_title']) + 2
if data['url_full'] in self.config.history:

View File

@@ -353,7 +353,8 @@ class SubredditPage(Page):
self.term.add_space(win)
attr = self.term.attr('Created')
self.term.add_line(win, '{created}'.format(**data), attr=attr)
self.term.add_line(win, '{created}{edited}'.format(**data),
attr=attr)
if data['comments'] is not None:
attr = self.term.attr('Separator')