From 199cc46e1a2c6734751ff6216496347f9a36854e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 3 Sep 2021 23:10:54 +0100 Subject: [PATCH] Generate html for incoming undo likes --- inbox.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/inbox.py b/inbox.py index 555f4313e..57431fe1c 100644 --- a/inbox.py +++ b/inbox.py @@ -1023,7 +1023,15 @@ def _receiveUndoLike(recentPostsCache: {}, httpPrefix: str, domain: str, port: int, sendThreads: [], postLog: [], cachedWebfingers: {}, personCache: {}, messageJson: {}, federationList: [], - debug: bool) -> bool: + debug: bool, + signingPrivateKeyPem: str, + maxRecentPosts: int, translate: {}, + allowDeletion: bool, + YTReplacementDomain: str, + peertubeInstances: [], + allowLocalNetworkAccess: bool, + themeName: str, systemLanguage: str, + maxLikeCount: int) -> bool: """Receives an undo like activity within the POST section of HTTPServer """ if messageJson['type'] != 'Undo': @@ -1073,7 +1081,40 @@ def _receiveUndoLike(recentPostsCache: {}, undoLikesCollectionEntry(recentPostsCache, baseDir, postFilename, messageJson['object'], messageJson['actor'], domain, debug) - # TODO regenerate the html + # regenerate the html + likedPostJson = loadJson(postFilename, 0, 1) + if likedPostJson: + if debug: + cachedPostFilename = \ + getCachedPostFilename(baseDir, handleName, domain, + likedPostJson) + print('Unliked post json: ' + str(likedPostJson)) + print('Unliked post nickname: ' + handleName + ' ' + domain) + print('Unliked post cache: ' + str(cachedPostFilename)) + pageNumber = 1 + showPublishedDateOnly = False + showIndividualPostIcons = True + manuallyApproveFollowers = \ + followerApprovalActive(baseDir, handleName, domain) + notDM = not isDM(likedPostJson) + individualPostAsHtml(signingPrivateKeyPem, False, + recentPostsCache, maxRecentPosts, + translate, pageNumber, baseDir, + session, cachedWebfingers, personCache, + handleName, domain, port, likedPostJson, + None, True, allowDeletion, + httpPrefix, __version__, + 'inbox', YTReplacementDomain, + showPublishedDateOnly, + peertubeInstances, + allowLocalNetworkAccess, + themeName, systemLanguage, + maxLikeCount, notDM, + showIndividualPostIcons, + manuallyApproveFollowers, + False, True, False) + else: + print('WARN: Unliked post not found: ' + postFilename) return True @@ -2364,7 +2405,14 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int, personCache, messageJson, federationList, - debug): + debug, signingPrivateKeyPem, + maxRecentPosts, translate, + allowDeletion, + YTReplacementDomain, + peertubeInstances, + allowLocalNetworkAccess, + themeName, systemLanguage, + maxLikeCount): if debug: print('DEBUG: Undo like accepted from ' + actor) return False