Opening comments now uses the comment permalink.
This commit is contained in:
@@ -83,6 +83,8 @@ class BaseContent(object):
|
|||||||
sub_author = getattr(sub, 'author', '[deleted]')
|
sub_author = getattr(sub, 'author', '[deleted]')
|
||||||
sub_name = getattr(sub_author, 'name', '[deleted]')
|
sub_name = getattr(sub_author, 'name', '[deleted]')
|
||||||
flair = getattr(comment, 'author_flair_text', '')
|
flair = getattr(comment, 'author_flair_text', '')
|
||||||
|
permalink = getattr(comment, 'permalink', None)
|
||||||
|
|
||||||
data['type'] = 'Comment'
|
data['type'] = 'Comment'
|
||||||
data['body'] = comment.body
|
data['body'] = comment.body
|
||||||
data['created'] = humanize_timestamp(comment.created_utc)
|
data['created'] = humanize_timestamp(comment.created_utc)
|
||||||
@@ -92,6 +94,7 @@ class BaseContent(object):
|
|||||||
data['flair'] = flair
|
data['flair'] = flair
|
||||||
data['likes'] = comment.likes
|
data['likes'] = comment.likes
|
||||||
data['gold'] = comment.gilded > 0
|
data['gold'] = comment.gilded > 0
|
||||||
|
data['permalink'] = permalink
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
@@ -77,9 +77,12 @@ class SubmissionPage(BasePage):
|
|||||||
def open_link(self):
|
def open_link(self):
|
||||||
"Open the current submission page with the webbrowser"
|
"Open the current submission page with the webbrowser"
|
||||||
|
|
||||||
# May want to expand at some point to open comment permalinks
|
data = self.content.get(self.nav.absolute_index)
|
||||||
url = self.content.get(-1)['permalink']
|
url = data.get('permalink')
|
||||||
|
if url:
|
||||||
open_browser(url)
|
open_browser(url)
|
||||||
|
else:
|
||||||
|
curses.flash()
|
||||||
|
|
||||||
@SubmissionController.register('c')
|
@SubmissionController.register('c')
|
||||||
def add_comment(self):
|
def add_comment(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user