mirror of https://gitlab.com/bashrc2/epicyon
Clearing cache when new like is received
parent
ede2162d7c
commit
bbde34144f
|
@ -6721,7 +6721,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
updateLikesCollection(self.server.recentPostsCache,
|
updateLikesCollection(self.server.recentPostsCache,
|
||||||
baseDir,
|
baseDir,
|
||||||
likedPostFilename, likeUrl,
|
likedPostFilename, likeUrl,
|
||||||
likeActor, domain,
|
likeActor,
|
||||||
|
self.postToNickname, domain,
|
||||||
debug)
|
debug)
|
||||||
# clear the icon from the cache so that it gets updated
|
# clear the icon from the cache so that it gets updated
|
||||||
if self.server.iconsCache.get('like.png'):
|
if self.server.iconsCache.get('like.png'):
|
||||||
|
|
3
inbox.py
3
inbox.py
|
@ -1010,7 +1010,8 @@ def _receiveLike(recentPostsCache: {},
|
||||||
_likeNotify(baseDir, domain, onionDomain, handle,
|
_likeNotify(baseDir, domain, onionDomain, handle,
|
||||||
messageJson['actor'], postLikedId)
|
messageJson['actor'], postLikedId)
|
||||||
updateLikesCollection(recentPostsCache, baseDir, postFilename,
|
updateLikesCollection(recentPostsCache, baseDir, postFilename,
|
||||||
postLikedId, messageJson['actor'], domain, debug)
|
postLikedId, messageJson['actor'],
|
||||||
|
handleName, domain, debug)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
6
like.py
6
like.py
|
@ -103,7 +103,8 @@ def _like(recentPostsCache: {},
|
||||||
|
|
||||||
updateLikesCollection(recentPostsCache,
|
updateLikesCollection(recentPostsCache,
|
||||||
baseDir, postFilename, objectUrl,
|
baseDir, postFilename, objectUrl,
|
||||||
newLikeJson['actor'], domain, debug)
|
newLikeJson['actor'],
|
||||||
|
nickname, domain, debug)
|
||||||
|
|
||||||
sendSignedJson(newLikeJson, session, baseDir,
|
sendSignedJson(newLikeJson, session, baseDir,
|
||||||
nickname, domain, port,
|
nickname, domain, port,
|
||||||
|
@ -334,7 +335,8 @@ def outboxLike(recentPostsCache: {},
|
||||||
return True
|
return True
|
||||||
updateLikesCollection(recentPostsCache,
|
updateLikesCollection(recentPostsCache,
|
||||||
baseDir, postFilename, messageId,
|
baseDir, postFilename, messageId,
|
||||||
messageJson['actor'], domain, debug)
|
messageJson['actor'],
|
||||||
|
nickname, domain, debug)
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: post liked via c2s - ' + postFilename)
|
print('DEBUG: post liked via c2s - ' + postFilename)
|
||||||
|
|
||||||
|
|
5
utils.py
5
utils.py
|
@ -1886,8 +1886,8 @@ def undoLikesCollectionEntry(recentPostsCache: {},
|
||||||
|
|
||||||
def updateLikesCollection(recentPostsCache: {},
|
def updateLikesCollection(recentPostsCache: {},
|
||||||
baseDir: str, postFilename: str,
|
baseDir: str, postFilename: str,
|
||||||
objectUrl: str,
|
objectUrl: str, actor: str,
|
||||||
actor: str, domain: str, debug: bool) -> None:
|
nickname: str, domain: str, debug: bool) -> None:
|
||||||
"""Updates the likes collection within a post
|
"""Updates the likes collection within a post
|
||||||
"""
|
"""
|
||||||
postJsonObject = loadJson(postFilename)
|
postJsonObject = loadJson(postFilename)
|
||||||
|
@ -1896,7 +1896,6 @@ def updateLikesCollection(recentPostsCache: {},
|
||||||
# remove any cached version of this post so that the
|
# remove any cached version of this post so that the
|
||||||
# like icon is changed
|
# like icon is changed
|
||||||
removePostFromCache(postJsonObject, recentPostsCache)
|
removePostFromCache(postJsonObject, recentPostsCache)
|
||||||
nickname = getNicknameFromActor(actor)
|
|
||||||
cachedPostFilename = getCachedPostFilename(baseDir, nickname,
|
cachedPostFilename = getCachedPostFilename(baseDir, nickname,
|
||||||
domain, postJsonObject)
|
domain, postJsonObject)
|
||||||
if cachedPostFilename:
|
if cachedPostFilename:
|
||||||
|
|
Loading…
Reference in New Issue