From 0dc5d7bf6a8109fdb0a01af0ba255de01b96e0a3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 31 Aug 2019 15:21:59 +0100 Subject: [PATCH] Follow accept --- manualapprove.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/manualapprove.py b/manualapprove.py index a6e665b14..dbeddab45 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -58,6 +58,7 @@ def manualApproveFollowRequest(session,baseDir: str, \ return approvefilenew = open(approveFollowsFilename+'.new', 'w+') + updateApprovedFollowers=False with open(approveFollowsFilename, 'r') as approvefile: for handle in approvefile: if handle.startswith(approveHandle): @@ -85,18 +86,21 @@ def manualApproveFollowRequest(session,baseDir: str, \ cachedWebfingers,personCache, \ debug,projectVersion) os.remove(followActivityfilename) + updateApprovedFollowers=True else: approvefilenew.write(handle) approvefilenew.close() 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+") + + if updateApprovedFollowers: + # 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() - else: - followersFile=open(followersFilename, "w+") - followersFile.write(approveHandle+'\n') - followersFile.close()