From 55ce8de22b2c33f4e4e92109342bf0b10fb25993 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 16 Aug 2019 20:48:32 +0100 Subject: [PATCH] Also replace undo --- daemon.py | 4 ++-- inbox.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/daemon.py b/daemon.py index 5db861f94..51923335e 100644 --- a/daemon.py +++ b/daemon.py @@ -283,7 +283,7 @@ class PubServer(BaseHTTPRequestHandler): ' is not a permitted activity type') return False if messageJson.get('id'): - postId=messageJson['id'].replace('/activity','') + postId=messageJson['id'].replace('/activity','').replace('/undo','') if self.server.debug: print('DEBUG: id attribute exists within POST to outbox') else: @@ -2690,7 +2690,7 @@ class PubServer(BaseHTTPRequestHandler): if self._postToOutbox(messageJson): if messageJson.get('id'): self.headers['Location']= \ - messageJson['id'].replace('/activity','') + messageJson['id'].replace('/activity','').replace('/undo','') self.send_response(201) self.end_headers() self.server.POSTbusy=False diff --git a/inbox.py b/inbox.py index f0bb1aa1f..e9c6f5306 100644 --- a/inbox.py +++ b/inbox.py @@ -197,14 +197,14 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str return None originalPostId=None if postJsonObject.get('id'): - originalPostId=postJsonObject['id'].replace('/activity','') + originalPostId=postJsonObject['id'].replace('/activity','').replace('/undo','') currTime=datetime.datetime.utcnow() postId=None if postJsonObject.get('id'): #if '/statuses/' not in postJsonObject['id']: - postId=postJsonObject['id'].replace('/activity','') + postId=postJsonObject['id'].replace('/activity','').replace('/undo','') published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ") if not postId: statusNumber,published = getStatusNumber() @@ -745,7 +745,7 @@ def receiveDelete(session,handle: str,baseDir: str, \ if not os.path.isdir(baseDir+'/accounts/'+handle): print('DEBUG: unknown recipient of like - '+handle) # if this post in the outbox of the person? - messageId=messageJson['object'].replace('/activity','') + messageId=messageJson['object'].replace('/activity','').replace('/undo','') removeModerationPostFromIndex(baseDir,messageId,debug) postFilename=locatePost(baseDir,handle.split('@')[0],handle.split('@')[1],messageId) if not postFilename: @@ -900,7 +900,7 @@ def populateReplies(baseDir :str,httpPrefix :str,domain :str, \ return False # populate a text file containing the ids of replies postRepliesFilename=postFilename.replace('.json','.replies') - messageId=messageJson['id'].replace('/activity','') + messageId=messageJson['id'].replace('/activity','').replace('/undo','') if os.path.isfile(postRepliesFilename): numLines = sum(1 for line in open(postRepliesFilename)) if numLines>maxReplies: