Misleading method name

master
Bob Mottram 2019-08-31 16:17:07 +01:00
parent 6667e94021
commit 4e0120929c
2 changed files with 16 additions and 4 deletions

View File

@ -85,6 +85,17 @@ def followerOfPerson(baseDir: str,nickname: str, domain: str, \
followerNickname,followerDomain, \ followerNickname,followerDomain, \
federationList,debug,'followers.txt') federationList,debug,'followers.txt')
def isfollowerOfPerson(baseDir: str,nickname: str, domain: str, \
followerNickname: str, followerDomain: str) -> bool:
"""is the given nickname a follower of followerNickname?
"""
if ':' in domain:
domain=domain.split(':')[0]
followersFile=baseDir+'/accounts/'+nickname+'@'+domain+'/followers.txt'
if not os.path.isfile(followersFile):
return False
return followerNickname+'@'+followerDomain in open(followersFile).read()
def unfollowPerson(baseDir: str,nickname: str, domain: str, \ def unfollowPerson(baseDir: str,nickname: str, domain: str, \
followNickname: str, followDomain: str, \ followNickname: str, followDomain: str, \
followFile='following.txt', \ followFile='following.txt', \
@ -410,8 +421,9 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
baseDir+'/accounts/'+handleToFollow) baseDir+'/accounts/'+handleToFollow)
return True return True
if not followerOfPerson(baseDir,nicknameToFollow,domainToFollowFull, \ if not isFollowerOfPerson(baseDir, \
nickname,domainFull,federationList,debug): nicknameToFollow,domainToFollowFull, \
nickname,domainFull):
if debug: if debug:
print('DEBUG: '+nickname+'@'+domain+ \ print('DEBUG: '+nickname+'@'+domain+ \
' is already a follower of '+ \ ' is already a follower of '+ \

View File

@ -1315,10 +1315,10 @@ def runInboxQueue(projectVersion: str, \
federationList, \ federationList, \
debug,projectVersion, \ debug,projectVersion, \
acceptedCaps=["inbox:write","objects:read"]): acceptedCaps=["inbox:write","objects:read"]):
if debug:
print('DEBUG: Follow accepted from '+keyId)
os.remove(queueFilename) os.remove(queueFilename)
queue.pop(0) queue.pop(0)
if debug:
print('DEBUG: Follow activity for '+keyId+' removed from accepted from queue')
continue continue
else: else:
if debug: if debug: