diff --git a/daemon.py b/daemon.py index 85f8f56c..fd463eab 100644 --- a/daemon.py +++ b/daemon.py @@ -2748,7 +2748,7 @@ class PubServer(BaseHTTPRequestHandler): domain: str, domainFull: str, onionDomain: str, i2pDomain: str, debug: bool) -> None: - """Endpoint for removing posts + """Endpoint for removing posts after confirmation """ pageNumber = 1 usersPath = path.split('/rmpost')[0] @@ -2812,7 +2812,7 @@ class PubServer(BaseHTTPRequestHandler): 'actor': removePostActor, 'object': removeMessageId, 'to': toList, - 'cc': [removePostActor+'/followers'], + 'cc': [removePostActor + '/followers'], 'type': 'Delete' } self.postToNickname = getNicknameFromActor(removePostActor) @@ -5809,7 +5809,7 @@ class PubServer(BaseHTTPRequestHandler): GETstartTime, GETtimings: {}, proxyType: str, cookie: str, debug: str): - """Delete button is pressed + """Delete button is pressed on a post """ if not cookie: print('ERROR: no cookie given when deleting') diff --git a/inbox.py b/inbox.py index 258e16e1..9013a158 100644 --- a/inbox.py +++ b/inbox.py @@ -1251,18 +1251,31 @@ def receiveDelete(session, handle: str, isGroup: bool, baseDir: str, # if this post in the outbox of the person? messageId = removeIdEnding(messageJson['object']) removeModerationPostFromIndex(baseDir, messageId, debug) - postFilename = locatePost(baseDir, handle.split('@')[0], - handle.split('@')[1], messageId) + handleNickname = handle.split('@')[0] + handleDomain = handle.split('@')[1] + postFilename = locatePost(baseDir, handleNickname, + handleDomain, messageId) if not postFilename: if debug: print('DEBUG: delete post not found in inbox or outbox') print(messageId) return True - deletePost(baseDir, httpPrefix, handle.split('@')[0], - handle.split('@')[1], postFilename, debug, + deletePost(baseDir, httpPrefix, handleNickname, + handleDomain, postFilename, debug, recentPostsCache) if debug: print('DEBUG: post deleted - ' + postFilename) + + # also delete any local blogs saved to the news actor + if handleNickname != 'news' and handleDomain == domainFull: + postFilename = locatePost(baseDir, 'news', + handleDomain, messageId) + if postFilename: + deletePost(baseDir, httpPrefix, 'news', + handleDomain, postFilename, debug, + recentPostsCache) + if debug: + print('DEBUG: blog post deleted - ' + postFilename) return True