From c94b80a36d2123ef5ae69cac9ed6071d5158a68b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 29 Nov 2019 22:02:16 +0000 Subject: [PATCH] Sending out updates when votes on a question change --- inbox.py | 17 ++++++++++++++++- posts.py | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/inbox.py b/inbox.py index 8f838d5b7..2db7ed43b 100644 --- a/inbox.py +++ b/inbox.py @@ -54,6 +54,7 @@ from posts import isDM from posts import isReply from posts import isImageMedia from posts import sendSignedJson +from posts import sendToFollowersThread from webinterface import individualPostAsHtml from webinterface import getIconsDir from question import questionUpdateVotes @@ -1798,7 +1799,21 @@ def inboxAfterCapabilities(recentPostsCache: {},maxRecentPosts: int, \ populateReplies(baseDir,httpPrefix,domain,postJsonObject,maxReplies,debug) nickname=handle.split('@')[0] - questionUpdateVotes(baseDir,nickname,domain,postJsonObject) + + # if this is a reply to a question then update the votes + questionJson=questionUpdateVotes(baseDir,nickname,domain,postJsonObject) + if questionJson: + # Is this a question created by this instance? + if questionJson['object']['id'].startswith(httpPrefix+'://'+domain): + # if the votes on a question have changed then send out an update + questionJson['type']='Update' + sendToFollowersThread(session,baseDir, \ + nickname,domain,port, \ + httpPrefix,federationList, \ + sendThreads,postLog, \ + cachedWebfingers,personCache, \ + postJsonObject,debug, \ + __version__) if not isGroup: # create a DM notification file if needed diff --git a/posts.py b/posts.py index 585da6d4b..921f2819d 100644 --- a/posts.py +++ b/posts.py @@ -1805,7 +1805,7 @@ def sendToFollowers(session,baseDir: str, \ print('DEBUG: End of sendToFollowers') def sendToFollowersThread(session,baseDir: str, \ - nickname: str, domain: str, port: int, \ + nickname: str,domain: str,port: int, \ httpPrefix: str,federationList: [], \ sendThreads: [],postLog: [], \ cachedWebfingers: {},personCache: {}, \