Less indentation

merge-requests/30/head
Bob Mottram 2021-07-05 11:22:23 +01:00
parent 2099788bcd
commit cd14cc2775
1 changed files with 48 additions and 45 deletions

View File

@ -1800,6 +1800,7 @@ def searchBoxPosts(baseDir: str, nickname: str, domain: str,
containing matching strings containing matching strings
""" """
path = baseDir + '/accounts/' + nickname + '@' + domain + '/' + boxName path = baseDir + '/accounts/' + nickname + '@' + domain + '/' + boxName
# is this a virtual box, such as direct messages?
if not os.path.isdir(path): if not os.path.isdir(path):
if os.path.isfile(path + '.index'): if os.path.isfile(path + '.index'):
return _searchVirtualBoxPosts(baseDir, nickname, domain, return _searchVirtualBoxPosts(baseDir, nickname, domain,
@ -1854,7 +1855,8 @@ def undoLikesCollectionEntry(recentPostsCache: {},
"""Undoes a like for a particular actor """Undoes a like for a particular actor
""" """
postJsonObject = loadJson(postFilename) postJsonObject = loadJson(postFilename)
if postJsonObject: if not postJsonObject:
return
# remove any cached version of this post so that the # remove any cached version of this post so that the
# like icon is changed # like icon is changed
nickname = getNicknameFromActor(actor) nickname = getNicknameFromActor(actor)
@ -1892,7 +1894,8 @@ def undoLikesCollectionEntry(recentPostsCache: {},
postJsonObject['object']['likes']['items'].remove(likeItem) postJsonObject['object']['likes']['items'].remove(likeItem)
itemFound = True itemFound = True
break break
if itemFound: if not itemFound:
return
if totalItems == 1: if totalItems == 1:
if debug: if debug:
print('DEBUG: likes was removed from post') print('DEBUG: likes was removed from post')