diff --git a/webinterface.py b/webinterface.py index 460f7bf8..dc9d4371 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):