Further tweaks to notifications layout

This commit is contained in:
Francesco Siddi 2019-07-02 14:23:50 +02:00
parent d424febfeb
commit db9cb09c68
2 changed files with 4 additions and 3 deletions

View File

@ -58,19 +58,19 @@ def notification_parse(notification):
owner = f"{user_name} {node_type}" owner = f"{user_name} {node_type}"
context_object_name = f"{node['parent']['name'][:15]}..." context_object_name = f"{node['parent']['name'][:50]}..."
if context_object_type == 'comment': if context_object_type == 'comment':
# Parse the comment content, which might be HTML and extract # Parse the comment content, which might be HTML and extract
# some text from it. # some text from it.
parser = CommentHTMLParser() parser = CommentHTMLParser()
# Trim the comment content to 50 chars, the parser will handle it # Trim the comment content to 50 chars, the parser will handle it
parser.feed(node['parent']['properties']['content'][:50]) parser.feed(node['properties']['content'][:50])
try: try:
comment_content = parser.data[0] comment_content = parser.data[0]
except KeyError: except KeyError:
comment_content = '...' comment_content = '...'
# Trim the parsed text down to 15 charss # Trim the parsed text down to 15 charss
context_object_name = f"{comment_content[:15]}..." context_object_name = f"{comment_content[:50]}..."
context_object_id = activity['context_object'] context_object_id = activity['context_object']
if activity['verb'] == 'replied': if activity['verb'] == 'replied':
action = 'replied to' action = 'replied to'

View File

@ -137,6 +137,7 @@
& .nc-text & .nc-text
width: 90% width: 90%
white-space: normal
& .nc-date & .nc-date
display: block display: block