mirror of https://gitlab.com/bashrc2/epicyon
Detecting announces
parent
539766b74d
commit
db3243724d
|
@ -73,14 +73,14 @@ def outboxAnnounce(recentPostsCache: {},
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def announcedByPerson(isAnnounced: bool, postJsonObject: {},
|
def announcedByPerson(isAnnounced: bool, postActor: str,
|
||||||
nickname: str, domainFull: str) -> bool:
|
nickname: str, domainFull: str) -> bool:
|
||||||
"""Returns True if the given post is announced by the given person
|
"""Returns True if the given post is announced by the given person
|
||||||
"""
|
"""
|
||||||
if not postJsonObject.get('actor'):
|
if not postActor:
|
||||||
return False
|
return False
|
||||||
if isAnnounced and \
|
if isAnnounced and \
|
||||||
postJsonObject['actor'].endswith(domainFull + '/users/' + nickname):
|
postActor.endswith(domainFull + '/users/' + nickname):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -386,6 +386,7 @@ def _getEditIconHtml(baseDir: str, nickname: str, domainFull: str,
|
||||||
|
|
||||||
|
|
||||||
def _getAnnounceIconHtml(isAnnounced: bool,
|
def _getAnnounceIconHtml(isAnnounced: bool,
|
||||||
|
postActor: str,
|
||||||
nickname: str, domainFull: str,
|
nickname: str, domainFull: str,
|
||||||
postJsonObject: {},
|
postJsonObject: {},
|
||||||
isPublicRepeat: bool,
|
isPublicRepeat: bool,
|
||||||
|
@ -414,7 +415,7 @@ def _getAnnounceIconHtml(isAnnounced: bool,
|
||||||
announceTitle = translate['Repeat this post']
|
announceTitle = translate['Repeat this post']
|
||||||
|
|
||||||
if announcedByPerson(isAnnounced,
|
if announcedByPerson(isAnnounced,
|
||||||
postJsonObject, nickname, domainFull):
|
postActor, nickname, domainFull):
|
||||||
announceIcon = 'repeat.png'
|
announceIcon = 'repeat.png'
|
||||||
announceEmoji = '🔁 '
|
announceEmoji = '🔁 '
|
||||||
announceLink = 'unrepeat'
|
announceLink = 'unrepeat'
|
||||||
|
@ -1411,6 +1412,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
|
|
||||||
announceStr = \
|
announceStr = \
|
||||||
_getAnnounceIconHtml(isAnnounced,
|
_getAnnounceIconHtml(isAnnounced,
|
||||||
|
postActor,
|
||||||
nickname, domainFull,
|
nickname, domainFull,
|
||||||
postJsonObject,
|
postJsonObject,
|
||||||
isPublicRepeat,
|
isPublicRepeat,
|
||||||
|
|
Loading…
Reference in New Issue