mirror of https://gitlab.com/bashrc2/epicyon
Detecting announces
parent
539766b74d
commit
db3243724d
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue