forked from indymedia/epicyon
Checks on public status for viewed replies
parent
08a16714c0
commit
ce9f403f92
17
daemon.py
17
daemon.py
|
@ -347,6 +347,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'https://www.w3.org/ns/activitystreams#Public' in open(searchFilename).read():
|
'https://www.w3.org/ns/activitystreams#Public' in open(searchFilename).read():
|
||||||
with open(searchFilename, 'r') as fp:
|
with open(searchFilename, 'r') as fp:
|
||||||
postJson=commentjson.load(fp)
|
postJson=commentjson.load(fp)
|
||||||
|
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)
|
repliesJson['orderedItems'].append(postJson)
|
||||||
replyFound=True
|
replyFound=True
|
||||||
break
|
break
|
||||||
|
@ -363,6 +372,14 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# get the json of the reply and append it to the collection
|
# get the json of the reply and append it to the collection
|
||||||
with open(searchFilename, 'r') as fp:
|
with open(searchFilename, 'r') as fp:
|
||||||
postJson=commentjson.load(fp)
|
postJson=commentjson.load(fp)
|
||||||
|
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)
|
repliesJson['orderedItems'].append(postJson)
|
||||||
# send the replies json
|
# send the replies json
|
||||||
self._set_headers('application/json')
|
self._set_headers('application/json')
|
||||||
|
|
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
|
"""Updates the list of replies for a post on this domain if
|
||||||
a reply to it arrives
|
a reply to it arrives
|
||||||
"""
|
"""
|
||||||
replyTo=None
|
|
||||||
if not messageJson.get('id'):
|
if not messageJson.get('id'):
|
||||||
return False
|
return False
|
||||||
if messageJson.get('inReplyTo'):
|
if not messageJson.get('object'):
|
||||||
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:
|
|
||||||
return False
|
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:
|
if debug:
|
||||||
print('DEBUG: post contains a reply')
|
print('DEBUG: post contains a reply')
|
||||||
# is this a reply to a post on this domain?
|
# is this a reply to a post on this domain?
|
||||||
|
|
Loading…
Reference in New Issue