Fix adding followers without approval

master
Bob Mottram 2019-09-01 21:28:43 +01:00
parent dd450ce413
commit d217762b5e
1 changed files with 16 additions and 0 deletions

View File

@ -440,6 +440,22 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
messageJson,debug) messageJson,debug)
else: else:
print('Follow request does not require approval') print('Follow request does not require approval')
# update the followers
if os.path.isdir(baseDir+'/accounts/'+nicknameToFollow+'@'+domainToFollow):
followersFilename=baseDir+'/accounts/'+nicknameToFollow+'@'+domainToFollow+'/followers.txt'
approveHandle=nickname+'@'+domain
if fromPort:
approveHandle=approveHandle+':'+str(fromPort)
print('Updating followers file: '+followersFilename+' adding '+approveHandle)
if os.path.isfile(followersFilename):
if approveHandle not in open(followersFilename).read():
followersFile=open(followersFilename, "a+")
followersFile.write(approveHandle+'\n')
followersFile.close()
else:
followersFile=open(followersFilename, "w+")
followersFile.write(approveHandle+'\n')
followersFile.close()
print('Beginning follow accept') print('Beginning follow accept')
return followedAccountAccepts(session,baseDir,httpPrefix, \ return followedAccountAccepts(session,baseDir,httpPrefix, \