Update when receiving likes

merge-requests/8/head
Bob Mottram 2020-12-30 21:21:57 +00:00
parent 6e21a3b84f
commit 9d937826bc
2 changed files with 4 additions and 3 deletions

View File

@ -964,13 +964,13 @@ def _receiveLike(recentPostsCache: {},
handleName = handle.split('@')[0] handleName = handle.split('@')[0]
handleDom = handle.split('@')[1] handleDom = handle.split('@')[1]
updateLikesCollection(recentPostsCache, baseDir, postFilename,
messageJson['object'],
messageJson['actor'], domain, debug)
if not _alreadyLiked(baseDir, if not _alreadyLiked(baseDir,
handleName, handleDom, handleName, handleDom,
messageJson['object'], messageJson['object'],
messageJson['actor']): messageJson['actor']):
updateLikesCollection(recentPostsCache, baseDir, postFilename,
messageJson['object'],
messageJson['actor'], domain, debug)
_likeNotify(baseDir, domain, onionDomain, handle, _likeNotify(baseDir, domain, onionDomain, handle,
messageJson['actor'], messageJson['object']) messageJson['actor'], messageJson['object'])
return True return True

View File

@ -1528,6 +1528,7 @@ def updateLikesCollection(recentPostsCache: {},
for likeItem in postJsonObject['object']['likes']['items']: for likeItem in postJsonObject['object']['likes']['items']:
if likeItem.get('actor'): if likeItem.get('actor'):
if likeItem['actor'] == actor: if likeItem['actor'] == actor:
# already liked
return return
newLike = { newLike = {
'type': 'Like', 'type': 'Like',