Detecting announces

merge-requests/30/head
Bob Mottram 2021-05-07 23:49:04 +01:00
parent 539766b74d
commit db3243724d
2 changed files with 6 additions and 4 deletions

View File

@ -73,14 +73,14 @@ def outboxAnnounce(recentPostsCache: {},
return False
def announcedByPerson(isAnnounced: bool, postJsonObject: {},
def announcedByPerson(isAnnounced: bool, postActor: str,
nickname: str, domainFull: str) -> bool:
"""Returns True if the given post is announced by the given person
"""
if not postJsonObject.get('actor'):
if not postActor:
return False
if isAnnounced and \
postJsonObject['actor'].endswith(domainFull + '/users/' + nickname):
postActor.endswith(domainFull + '/users/' + nickname):
return True
return False

View File

@ -386,6 +386,7 @@ def _getEditIconHtml(baseDir: str, nickname: str, domainFull: str,
def _getAnnounceIconHtml(isAnnounced: bool,
postActor: str,
nickname: str, domainFull: str,
postJsonObject: {},
isPublicRepeat: bool,
@ -414,7 +415,7 @@ def _getAnnounceIconHtml(isAnnounced: bool,
announceTitle = translate['Repeat this post']
if announcedByPerson(isAnnounced,
postJsonObject, nickname, domainFull):
postActor, nickname, domainFull):
announceIcon = 'repeat.png'
announceEmoji = '🔁 '
announceLink = 'unrepeat'
@ -1411,6 +1412,7 @@ def individualPostAsHtml(allowDownloads: bool,
announceStr = \
_getAnnounceIconHtml(isAnnounced,
postActor,
nickname, domainFull,
postJsonObject,
isPublicRepeat,