Delete button also removed blogs from the news actor

This commit is contained in:
bashrc committed 2020-11-27 10:38:51 +00:00
1 parent e3e88de0d8
commit 020c7a1314
2 files changed
+20 -7

No files matched your search

+3 -3
View File
@@ -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')
+17 -4
View File
@@ -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