From 676e5d1a1f73e279c9dec4eb7b3f4132ed604029 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 28 Nov 2019 12:34:02 +0000 Subject: [PATCH] Reply button on media timeline --- webinterface.py | 70 ++++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/webinterface.py b/webinterface.py index 4b68f2566..11a7cad61 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2100,7 +2100,41 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \ pageNumberParam='' if pageNumber: pageNumberParam='?page='+str(pageNumber) - + + replyStr='' + if showIcons: + replyToLink=postJsonObject['object']['id'] + if postJsonObject['object'].get('attributedTo'): + replyToLink+='?mention='+postJsonObject['object']['attributedTo'] + if postJsonObject['object'].get('content'): + mentionedActors=getMentionsFromHtml(postJsonObject['object']['content']) + if mentionedActors: + for actorUrl in mentionedActors: + if '?mention='+actorUrl not in replyToLink: + replyToLink+='?mention='+actorUrl + if len(replyToLink)>500: + break + replyToLink+=pageNumberParam + + replyStr='' + if not isModerationPost and showRepeatIcon: + if not manuallyApprovesFollowers: + replyStr+= \ + '' + else: + replyStr+= \ + '' + else: + replyStr+= \ + '' + replyStr+=''+translate['Reply to this post']+' |' + announceStr='' if not isModerationPost and showRepeatIcon: # don't allow announce/repeat of your own posts @@ -2265,7 +2299,7 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \ galleryStr+=' \n' galleryStr+=' \n' galleryStr+='
\n' - galleryStr+=' '+announceStr+likeStr+bookmarkStr+deleteStr+'\n' + galleryStr+=' '+replyStr+announceStr+likeStr+bookmarkStr+deleteStr+'\n' galleryStr+='
\n' if postJsonObject['object'].get('url'): imagePostUrl=postJsonObject['object']['url'] @@ -2379,38 +2413,8 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \ containerClass='container dm' if showIcons: - replyToLink=postJsonObject['object']['id'] - if postJsonObject['object'].get('attributedTo'): - replyToLink+='?mention='+postJsonObject['object']['attributedTo'] - if postJsonObject['object'].get('content'): - mentionedActors=getMentionsFromHtml(postJsonObject['object']['content']) - if mentionedActors: - for actorUrl in mentionedActors: - if '?mention='+actorUrl not in replyToLink: - replyToLink+='?mention='+actorUrl - if len(replyToLink)>500: - break - replyToLink+=pageNumberParam - footerStr='
' - if not isModerationPost and showRepeatIcon: - if not manuallyApprovesFollowers: - footerStr+= \ - '' - else: - footerStr+= \ - '' - else: - footerStr+= \ - '' - footerStr+=''+translate['Reply to this post']+' |' - footerStr+=announceStr+likeStr+bookmarkStr+deleteStr + footerStr+=replyStr+announceStr+likeStr+bookmarkStr+deleteStr footerStr+=''+publishedStr+'' footerStr+='
'