From 7019bd86dada705c9f20fcbe971e1b49ca484544 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 25 Aug 2019 18:22:24 +0100 Subject: [PATCH] No repeat icon on DMs --- webinterface.py | 60 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/webinterface.py b/webinterface.py index 460f7bf80..dc9d4371f 100644 --- a/webinterface.py +++ b/webinterface.py @@ -23,6 +23,7 @@ from utils import isPublicPost from utils import getDisplayName from follow import isFollowingActor from webfinger import webfingerHandle +from posts import isDM from posts import getPersonBox from posts import getUserUrl from posts import parseUserFeed @@ -1158,37 +1159,38 @@ def individualPostAsHtml(baseDir: str, \ titleStr+=''+displayName+'' else: titleStr+='@'+actorNickname+'@'+actorDomain+'' - - if isAnnounced: - if postJsonObject['object'].get('attributedTo'): - announceNickname=getNicknameFromActor(postJsonObject['object']['attributedTo']) - announceDomain,announcePort=getDomainFromActor(postJsonObject['object']['attributedTo']) - announceDisplayName=getDisplayName(postJsonObject['object']['attributedTo'],personCache) - if announceDisplayName: - titleStr+=' '+announceDisplayName+'' + + if not isDM(postJsonObject): + if isAnnounced: + if postJsonObject['object'].get('attributedTo'): + announceNickname=getNicknameFromActor(postJsonObject['object']['attributedTo']) + announceDomain,announcePort=getDomainFromActor(postJsonObject['object']['attributedTo']) + announceDisplayName=getDisplayName(postJsonObject['object']['attributedTo'],personCache) + if announceDisplayName: + titleStr+=' '+announceDisplayName+'' + else: + titleStr+=' @'+announceNickname+'@'+announceDomain+'' else: - titleStr+=' @'+announceNickname+'@'+announceDomain+'' + titleStr+=' @unattributed' else: - titleStr+=' @unattributed' - else: - if postJsonObject['object'].get('inReplyTo'): - containerClassIcons='containericons darker' - containerClass='container darker' - #avatarPosition=' class="right"' - if '/statuses/' in postJsonObject['object']['inReplyTo']: - replyNickname=getNicknameFromActor(postJsonObject['object']['inReplyTo']) - replyDomain,replyPort=getDomainFromActor(postJsonObject['object']['inReplyTo']) - if replyNickname and replyDomain: - replyDisplayName=getDisplayName(postJsonObject['object']['inReplyTo'],personCache) - if replyDisplayName: - titleStr+=' '+replyDisplayName+'' - else: - titleStr+=' @'+replyNickname+'@'+replyDomain+'' - else: - postDomain=postJsonObject['object']['inReplyTo'].replace('https://','').replace('http://','').replace('dat://','') - if '/' in postDomain: - postDomain=postDomain.split('/',1)[0] - titleStr+=' '+postDomain+'' + if postJsonObject['object'].get('inReplyTo'): + containerClassIcons='containericons darker' + containerClass='container darker' + #avatarPosition=' class="right"' + if '/statuses/' in postJsonObject['object']['inReplyTo']: + replyNickname=getNicknameFromActor(postJsonObject['object']['inReplyTo']) + replyDomain,replyPort=getDomainFromActor(postJsonObject['object']['inReplyTo']) + if replyNickname and replyDomain: + replyDisplayName=getDisplayName(postJsonObject['object']['inReplyTo'],personCache) + if replyDisplayName: + titleStr+=' '+replyDisplayName+'' + else: + titleStr+=' @'+replyNickname+'@'+replyDomain+'' + else: + postDomain=postJsonObject['object']['inReplyTo'].replace('https://','').replace('http://','').replace('dat://','') + if '/' in postDomain: + postDomain=postDomain.split('/',1)[0] + titleStr+=' '+postDomain+'' attachmentStr='' if postJsonObject['object']['attachment']: if isinstance(postJsonObject['object']['attachment'], list):