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, \
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, \
followNickname: str, followDomain: str, \
followFile='following.txt', \
@ -410,8 +421,9 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
baseDir+'/accounts/'+handleToFollow)
return True
if not followerOfPerson(baseDir,nicknameToFollow,domainToFollowFull, \
nickname,domainFull,federationList,debug):
if not isFollowerOfPerson(baseDir, \
nicknameToFollow,domainToFollowFull, \
nickname,domainFull):
if debug:
print('DEBUG: '+nickname+'@'+domain+ \
' is already a follower of '+ \

View File

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