diff --git a/follow.py b/follow.py index 4936e6bc..ff1e27a3 100644 --- a/follow.py +++ b/follow.py @@ -525,7 +525,7 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \ messageJson,acceptedCaps, \ sendThreads,postLog, \ cachedWebfingers,personCache, \ - debug,projectVersion) + debug,projectVersion,True) def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \ nicknameToFollow: str,domainToFollow: str,port: int, \ @@ -534,7 +534,8 @@ def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \ followJson: {},acceptedCaps: [], \ sendThreads: [],postLog: [], \ cachedWebfingers: {},personCache: {}, \ - debug: bool,projectVersion: str): + debug: bool,projectVersion: str, \ + removeFollowActivity: bool): """The person receiving a follow request accepts the new follower and sends back an Accept activity """ @@ -555,16 +556,17 @@ def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \ acceptHandle+' port '+ str(fromPort)) clientToServer=False - # remove the follow request json - followActivityfilename= \ - baseDir+'/accounts/'+ \ - nicknameToFollow+'@'+domainToFollow+'/requests/'+ \ - nickname+'@'+domain+'.follow' - if os.path.isfile(followActivityfilename): - try: - os.remove(followActivityfilename) - except: - pass + if removeFollowActivity: + # remove the follow request json + followActivityfilename= \ + baseDir+'/accounts/'+ \ + nicknameToFollow+'@'+domainToFollow+'/requests/'+ \ + nickname+'@'+domain+'.follow' + if os.path.isfile(followActivityfilename): + try: + os.remove(followActivityfilename) + except: + pass return sendSignedJson(acceptJson,session,baseDir, \ nicknameToFollow,domainToFollow,port, \ diff --git a/manualapprove.py b/manualapprove.py index 7014d577..654cae4e 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -86,6 +86,7 @@ def manualApproveFollowRequest(session,baseDir: str, \ approvefilenew = open(approveFollowsFilename+'.new', 'w+') updateApprovedFollowers=False + followActivityfilename=None with open(approveFollowsFilename, 'r') as approvefile: for handleOfFollowRequester in approvefile: # is this the approved follow? @@ -113,8 +114,8 @@ def manualApproveFollowRequest(session,baseDir: str, \ followJson,acceptedCaps, \ sendThreads,postLog, \ cachedWebfingers,personCache, \ - debug,projectVersion) - updateApprovedFollowers=True + debug,projectVersion,False) + updateApprovedFollowers=True else: # this isn't the approved follow so it will remain # in the requests file @@ -147,5 +148,9 @@ def manualApproveFollowRequest(session,baseDir: str, \ if approveHandle in open(followersFilename).read(): # update the follow requests with the handles not yet approved os.rename(approveFollowsFilename+'.new',approveFollowsFilename) + # remove the .follow file + if followActivityfilename: + if os.path.isfile(followActivityfilename): + os.remove(followActivityfilename) else: os.remove(approveFollowsFilename+'.new')