main
Bob Mottram 2020-12-01 09:58:21 +00:00
parent ac531e1b74
commit 8161af2795
1 changed files with 10 additions and 8 deletions

View File

@ -307,19 +307,22 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str,
"""Returns html for the edit icon/button """Returns html for the edit icon/button
""" """
editStr = '' editStr = ''
if (postJsonObject['actor'].endswith(domainFull + '/users/' + nickname) or actor = postJsonObject['actor']
if (actor.endswith(domainFull + '/users/' + nickname) or
(isEditor(baseDir, nickname) and (isEditor(baseDir, nickname) and
postJsonObject['actor'].endswith(domainFull + '/users/news'))): actor.endswith(domainFull + '/users/news'))):
if '/statuses/' in postJsonObject['object']['id']:
postId = postJsonObject['object']['id']
if '/statuses/' in postId:
if isBlogPost(postJsonObject): if isBlogPost(postJsonObject):
blogPostId = postJsonObject['object']['id']
if not isNewsPost(postJsonObject): if not isNewsPost(postJsonObject):
editStr += \ editStr += \
' ' + \ ' ' + \
'<a class="imageAnchor" href="/users/' + \ '<a class="imageAnchor" href="/users/' + \
nickname + \ nickname + \
'/tlblogs?editblogpost=' + \ '/tlblogs?editblogpost=' + \
blogPostId.split('/statuses/')[1] + \ postId.split('/statuses/')[1] + \
'?actor=' + actorNickname + \ '?actor=' + actorNickname + \
'" title="' + translate['Edit blog post'] + '">' + \ '" title="' + translate['Edit blog post'] + '">' + \
'<img loading="lazy" title="' + \ '<img loading="lazy" title="' + \
@ -331,7 +334,7 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str,
' ' + \ ' ' + \
'<a class="imageAnchor" href="/users/' + \ '<a class="imageAnchor" href="/users/' + \
nickname + '/editnewspost=' + \ nickname + '/editnewspost=' + \
blogPostId.split('/statuses/')[1] + \ postId.split('/statuses/')[1] + \
'?actor=' + actorNickname + \ '?actor=' + actorNickname + \
'" title="' + translate['Edit blog post'] + '">' + \ '" title="' + translate['Edit blog post'] + '">' + \
'<img loading="lazy" title="' + \ '<img loading="lazy" title="' + \
@ -339,12 +342,11 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str,
translate['Edit blog post'] + \ translate['Edit blog post'] + \
' |" src="/' + iconsPath + '/edit.png"/></a>\n' ' |" src="/' + iconsPath + '/edit.png"/></a>\n'
elif isEvent: elif isEvent:
eventPostId = postJsonObject['object']['id']
editStr += \ editStr += \
' ' + \ ' ' + \
'<a class="imageAnchor" href="/users/' + nickname + \ '<a class="imageAnchor" href="/users/' + nickname + \
'/tlblogs?editeventpost=' + \ '/tlblogs?editeventpost=' + \
eventPostId.split('/statuses/')[1] + \ postId.split('/statuses/')[1] + \
'?actor=' + actorNickname + \ '?actor=' + actorNickname + \
'" title="' + translate['Edit event'] + '">' + \ '" title="' + translate['Edit event'] + '">' + \
'<img loading="lazy" title="' + \ '<img loading="lazy" title="' + \