forked from indymedia/epicyon
Checks on public status for viewed replies
parent
08a16714c0
commit
ce9f403f92
23
daemon.py
23
daemon.py
|
@ -347,8 +347,17 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'https://www.w3.org/ns/activitystreams#Public' in open(searchFilename).read():
|
||||
with open(searchFilename, 'r') as fp:
|
||||
postJson=commentjson.load(fp)
|
||||
repliesJson['orderedItems'].append(postJson)
|
||||
replyFound=True
|
||||
if postJson['object'].get('cc'):
|
||||
if authorized or \
|
||||
('https://www.w3.org/ns/activitystreams#Public' in postJson['object']['to'] or \
|
||||
'https://www.w3.org/ns/activitystreams#Public' in postJson['object']['cc']):
|
||||
repliesJson['orderedItems'].append(postJson)
|
||||
replyFound=True
|
||||
else:
|
||||
if authorized or \
|
||||
'https://www.w3.org/ns/activitystreams#Public' in postJson['object']['to']:
|
||||
repliesJson['orderedItems'].append(postJson)
|
||||
replyFound=True
|
||||
break
|
||||
# if not in either inbox or outbox then examine the shared inbox
|
||||
if not replyFound:
|
||||
|
@ -363,7 +372,15 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# get the json of the reply and append it to the collection
|
||||
with open(searchFilename, 'r') as fp:
|
||||
postJson=commentjson.load(fp)
|
||||
repliesJson['orderedItems'].append(postJson)
|
||||
if postJson['object'].get('cc'):
|
||||
if authorized or \
|
||||
('https://www.w3.org/ns/activitystreams#Public' in postJson['object']['to'] or \
|
||||
'https://www.w3.org/ns/activitystreams#Public' in postJson['object']['cc']):
|
||||
repliesJson['orderedItems'].append(postJson)
|
||||
else:
|
||||
if authorized or \
|
||||
'https://www.w3.org/ns/activitystreams#Public' in postJson['object']['to']:
|
||||
repliesJson['orderedItems'].append(postJson)
|
||||
# send the replies json
|
||||
self._set_headers('application/json')
|
||||
self.wfile.write(json.dumps(repliesJson).encode('utf-8'))
|
||||
|
|
17
inbox.py
17
inbox.py
|
@ -640,18 +640,17 @@ def populateReplies(baseDir :str,httpPrefix :str,domain :str, \
|
|||
"""Updates the list of replies for a post on this domain if
|
||||
a reply to it arrives
|
||||
"""
|
||||
replyTo=None
|
||||
if not messageJson.get('id'):
|
||||
return False
|
||||
if messageJson.get('inReplyTo'):
|
||||
replyTo=messageJson['inReplyTo']
|
||||
else:
|
||||
if messageJson.get('object'):
|
||||
if isinstance(messageJson['object'], dict):
|
||||
if messageJson['object'].get('inReplyTo'):
|
||||
replyTo=messageJson['object']['inReplyTo']
|
||||
if not replyTo:
|
||||
if not messageJson.get('object'):
|
||||
return False
|
||||
if not isinstance(messageJson['object'], dict):
|
||||
return False
|
||||
if not messageJson['object'].get('inReplyTo'):
|
||||
return False
|
||||
if not messageJson['object'].get('to'):
|
||||
return False
|
||||
replyTo=messageJson['object']['inReplyTo']
|
||||
if debug:
|
||||
print('DEBUG: post contains a reply')
|
||||
# is this a reply to a post on this domain?
|
||||
|
|
Loading…
Reference in New Issue