main
Bob Mottram 2020-09-05 12:00:21 +01:00
parent 08f62aa32c
commit e61bf9bed1
1 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ def likedByPerson(postJsonObject: {}, nickname: str, domain: str) -> bool:
""" """
if noOfLikes(postJsonObject) == 0: if noOfLikes(postJsonObject) == 0:
return False return False
actorMatch = domain+'/users/'+nickname actorMatch = domain + '/users/' + nickname
for item in postJsonObject['object']['likes']['items']: for item in postJsonObject['object']['likes']['items']:
if item['actor'].endswith(actorMatch): if item['actor'].endswith(actorMatch):
return True return True
@ -70,7 +70,7 @@ def like(recentPostsCache: {},
if port: if port:
if port != 80 and port != 443: if port != 80 and port != 443:
if ':' not in domain: if ':' not in domain:
fullDomain = domain+':'+str(port) fullDomain = domain + ':' + str(port)
newLikeJson = { newLikeJson = {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
@ -174,7 +174,7 @@ def undolike(recentPostsCache: {},
newUndoLikeJson = { newUndoLikeJson = {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
'type': 'Undo', 'type': 'Undo',
'actor': httpPrefix+'://'+fullDomain+'/users/'+nickname, 'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname,
'object': { 'object': {
'type': 'Like', 'type': 'Like',
'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname, 'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname,
@ -476,4 +476,4 @@ def outboxUndoLike(recentPostsCache: {},
messageId, messageJson['actor'], messageId, messageJson['actor'],
domain, debug) domain, debug)
if debug: if debug:
print('DEBUG: post undo liked via c2s - '+postFilename) print('DEBUG: post undo liked via c2s - ' + postFilename)