Directly like/unlike posts

This is faster and so should work better with the web interface
main
Bob Mottram 2020-06-06 19:06:06 +01:00
parent 750158efe4
commit c8d90863ea
2 changed files with 26 additions and 3 deletions

View File

@ -176,6 +176,8 @@ from outbox import postMessageToOutbox
from happening import removeCalendarEvent
from bookmarks import bookmark
from bookmarks import undoBookmark
from like import updateLikesCollectionEntry
from like import undoLikesCollectionEntry
import os
@ -2517,6 +2519,18 @@ class PubServer(BaseHTTPRequestHandler):
'to': [actorLiked],
'object': likeUrl
}
# directly like the post file
likedPostFilename = locatePost(self.server.baseDir,
self.postToNickname,
self.server.domain,
actorLiked)
if likedPostFilename:
updateLikesCollectionEntry(self.server.recentPostsCache,
self.server.baseDir,
likedPostFilename, likeUrl,
likeActor, self.server.domain,
self.server.debug)
# send out the like to followers
self._postToOutbox(likeJson, self.server.projectVersion)
self.server.GETbusy = False
actorAbsolute = \
@ -2599,6 +2613,18 @@ class PubServer(BaseHTTPRequestHandler):
'object': likeUrl
}
}
# directly undo the like within the post file
likedPostFilename = locatePost(self.server.baseDir,
self.postToNickname,
self.server.domain,
actorLiked)
if likedPostFilename:
undoLikesCollectionEntry(self.server.recentPostsCache,
self.server.baseDir,
likedPostFilename, likeUrl,
likeActor, self.server.domain,
self.server.debug)
# send out the undo like to followers
self._postToOutbox(undoLikeJson, self.server.projectVersion)
self.server.GETbusy = False
actorAbsolute = self.server.httpPrefix + '://' + \

View File

@ -191,12 +191,9 @@ def setThemeNight(baseDir: str):
"link-bg-color": "#0f0d10",
"main-fg-color": "#7961ab",
"main-bg-color-dm": "#0b0a0a",
"main-bg-color-reply": "#030202",
"main-bg-color-report": "#050202",
"border-color": "#7961ab",
"main-bg-color-reply": "#0f0d10",
"main-bg-color-report": "#0f0d10",
"day-number2": "#0f0d10",
"hashtag-vertical-spacing3": "100px",
"hashtag-vertical-spacing4": "150px",
"button-background": "#7961ab",