From 7e8d59e85c4572e8580953b564a857341a814c0d Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Wed, 19 Feb 2020 12:51:14 +0000 Subject: [PATCH] Messages --- follow.py | 20 +++++++++++--------- tests.py | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/follow.py b/follow.py index 8b90a61f..ed5c448c 100644 --- a/follow.py +++ b/follow.py @@ -52,7 +52,7 @@ def removeFromFollowBase(baseDir: str, \ approveFollowsFilename=accountsDir+'/'+followFile+'.txt' if not os.path.isfile(approveFollowsFilename): if debug: - print('WARN: Follow requests file '+approveFollowsFilename+' not found') + print('WARN: Approve follow requests file '+approveFollowsFilename+' not found') return if acceptOrDenyHandle not in open(approveFollowsFilename).read(): return @@ -380,7 +380,7 @@ def followApprovalRequired(baseDir: str,nicknameToFollow: str, \ manuallyApproveFollows=actor['manuallyApprovesFollowers'] else: if debug: - print('manuallyApprovesFollowers is missing from '+actorFilename) + print(nicknameToFollow+'@'+domainToFollow+' automatically approves followers') else: if debug: print('DEBUG: Actor file not found: '+actorFilename) @@ -545,6 +545,7 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \ approveHandle=nickname+'@'+domainFull if followApprovalRequired(baseDir,nicknameToFollow, \ domainToFollow,debug,approveHandle): + print('Follow approval is required') if not domain.endswith('.onion'): if noOfFollowRequests(baseDir, \ nicknameToFollow,domainToFollow, \ @@ -751,13 +752,14 @@ def sendFollowRequest(session,baseDir: str, \ 'object': followedId } - # Remove any follow requests rejected for the account being followed. - # It's assumed that if you are following someone then you are - # ok with them following back. If this isn't the case then a rejected - # follow request will block them again. - removeFromFollowRejects(baseDir, \ - nickname,domain, \ - followHandle,debug) + if followApprovalRequired(baseDir,nickname,domain,debug,followHandle): + # Remove any follow requests rejected for the account being followed. + # It's assumed that if you are following someone then you are + # ok with them following back. If this isn't the case then a rejected + # follow request will block them again. + removeFromFollowRejects(baseDir, \ + nickname,domain, \ + followHandle,debug) sendSignedJson(newFollowJson,session,baseDir,nickname,domain,port, \ followNickname,followDomain,followPort, \ diff --git a/tests.py b/tests.py index a94bab3a..fabd78ff 100644 --- a/tests.py +++ b/tests.py @@ -610,6 +610,7 @@ def testFollowBetweenServersWithCapabilities(): eveDomain='127.0.0.55' evePort=61937 eveSendThreads=[] + global thrEve if thrEve: while thrEve.isAlive():