mirror of
https://gitlab.com/bashrc2/epicyon
synced 2026-10-31 18:05:22 +00:00
Question votes use name field
This commit is contained in:
1 parent
3870d15ed6
commit
ecef571e6f
2 files changed
+6
-4
No files matched your search
@@ -231,6 +231,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||
messageId,messageId,None, \
|
||||
False,None,None,None)
|
||||
if messageJson:
|
||||
# name field contains the answer
|
||||
messageJson['object']['name']=answer
|
||||
if self._postToOutbox(messageJson,__version__,nickname):
|
||||
postFilename= \
|
||||
locatePost(self.server.baseDir,nickname, \
|
||||
|
||||
+4
-4
@@ -23,7 +23,7 @@ def questionUpdateVotes(baseDir: str,nickname: str,domain: str,replyJson: {}) ->
|
||||
return None
|
||||
if not replyJson['object']['inReplyTo']:
|
||||
return None
|
||||
if not replyJson['object'].get('content'):
|
||||
if not replyJson['object'].get('name'):
|
||||
return None
|
||||
inReplyTo=replyJson['object']['inReplyTo']
|
||||
questionPostFilename=locatePost(baseDir,nickname,domain,inReplyTo)
|
||||
@@ -46,13 +46,13 @@ def questionUpdateVotes(baseDir: str,nickname: str,domain: str,replyJson: {}) ->
|
||||
return None
|
||||
if not questionJson['object'].get('content'):
|
||||
return None
|
||||
content=replyJson['object']['content']
|
||||
# does the reply content match any possible question option?
|
||||
replyVote=replyJson['object']['name']
|
||||
# does the reply name field match any possible question option?
|
||||
foundAnswer=None
|
||||
for possibleAnswer in questionJson['object']['oneOf']:
|
||||
if not possibleAnswer.get('name'):
|
||||
continue
|
||||
if possibleAnswer['name'] in content:
|
||||
if possibleAnswer['name'] == replyVote:
|
||||
foundAnswer=possibleAnswer
|
||||
break
|
||||
if not foundAnswer:
|
||||
|
||||
Reference in new issue
Block a user