Ensure that followers are updated when accepting follow request

master
Bob Mottram 2019-08-26 23:22:01 +01:00
parent dbd83b6eb9
commit 7e38cac3b7
1 changed files with 12 additions and 0 deletions

View File

@ -56,6 +56,7 @@ def manualApproveFollowRequest(session,baseDir: str, \
if debug: if debug:
print(handle+' not in '+approveFollowsFilename) print(handle+' not in '+approveFollowsFilename)
return return
approvefilenew = open(approveFollowsFilename+'.new', 'w+') approvefilenew = open(approveFollowsFilename+'.new', 'w+')
with open(approveFollowsFilename, 'r') as approvefile: with open(approveFollowsFilename, 'r') as approvefile:
for handle in approvefile: for handle in approvefile:
@ -88,3 +89,14 @@ def manualApproveFollowRequest(session,baseDir: str, \
approvefilenew.write(handle) approvefilenew.write(handle)
approvefilenew.close() approvefilenew.close()
os.rename(approveFollowsFilename+'.new',approveFollowsFilename) os.rename(approveFollowsFilename+'.new',approveFollowsFilename)
# update the followers
followersFilename=accountsDir+'/followers.txt'
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()