forked from indymedia/epicyon
Allow question updates in timeline
parent
168bcf84f9
commit
c6d008b28a
6
posts.py
6
posts.py
|
@ -2052,7 +2052,7 @@ def addPostStringToTimeline(postStr: str,boxname: str,postsInBox: [],boxActor: s
|
||||||
"""
|
"""
|
||||||
# must be a "Note" or "Announce" type
|
# must be a "Note" or "Announce" type
|
||||||
if '"Note"' in postStr or '"Announce"' in postStr or \
|
if '"Note"' in postStr or '"Announce"' in postStr or \
|
||||||
('"Question"' in postStr and '"Create"' in postStr):
|
('"Question"' in postStr and ('"Create"' in postStr or '"Update"' in postStr)):
|
||||||
|
|
||||||
if boxname=='dm':
|
if boxname=='dm':
|
||||||
if '#Public' in postStr or '/followers' in postStr:
|
if '#Public' in postStr or '/followers' in postStr:
|
||||||
|
@ -2171,16 +2171,16 @@ def createBoxIndexed(recentPostsCache: {}, \
|
||||||
postUrl=postFilename.replace('\n','').replace('.json','').strip()
|
postUrl=postFilename.replace('\n','').replace('.json','').strip()
|
||||||
|
|
||||||
postAdded=False
|
postAdded=False
|
||||||
|
# is the post cached in memory?
|
||||||
if recentPostsCache.get('index'):
|
if recentPostsCache.get('index'):
|
||||||
if postUrl in recentPostsCache['index']:
|
if postUrl in recentPostsCache['index']:
|
||||||
if recentPostsCache['json'].get(postUrl):
|
if recentPostsCache['json'].get(postUrl):
|
||||||
addPostStringToTimeline(recentPostsCache['json'][postUrl], \
|
addPostStringToTimeline(recentPostsCache['json'][postUrl], \
|
||||||
boxname,postsInBox,boxActor)
|
boxname,postsInBox,boxActor)
|
||||||
#print('Json post added to timeline from cache: '+postUrl)
|
|
||||||
postAdded=True
|
postAdded=True
|
||||||
|
|
||||||
if not postAdded:
|
if not postAdded:
|
||||||
# get the full path of the post
|
# read the post from file
|
||||||
fullPostFilename= \
|
fullPostFilename= \
|
||||||
locatePost(baseDir,nickname,domain,postUrl,False)
|
locatePost(baseDir,nickname,domain,postUrl,False)
|
||||||
if fullPostFilename:
|
if fullPostFilename:
|
||||||
|
|
|
@ -2373,14 +2373,20 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
def isQuestion(postObjectJson: {}) -> bool:
|
def isQuestion(postObjectJson: {}) -> bool:
|
||||||
""" is the given post a question?
|
""" is the given post a question?
|
||||||
"""
|
"""
|
||||||
if postObjectJson['type']=='Create':
|
if postObjectJson['type']!='Create' and \
|
||||||
if isinstance(postObjectJson['object'], dict):
|
postObjectJson['type']!='Update':
|
||||||
if postObjectJson['object'].get('type'):
|
return False
|
||||||
if postObjectJson['object']['type']=='Question':
|
if not isinstance(postObjectJson['object'], dict):
|
||||||
if postObjectJson['object'].get('oneOf'):
|
return False
|
||||||
if isinstance(postObjectJson['object']['oneOf'], list):
|
if not postObjectJson['object'].get('type'):
|
||||||
return True
|
return False
|
||||||
return False
|
if postObjectJson['object']['type']!='Question':
|
||||||
|
return False
|
||||||
|
if not postObjectJson['object'].get('oneOf'):
|
||||||
|
return False
|
||||||
|
if not isinstance(postObjectJson['object']['oneOf'], list):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def htmlTimeline(recentPostsCache: {},maxRecentPosts: int,
|
def htmlTimeline(recentPostsCache: {},maxRecentPosts: int,
|
||||||
translate: {},pageNumber: int, \
|
translate: {},pageNumber: int, \
|
||||||
|
@ -2592,7 +2598,7 @@ def htmlTimeline(recentPostsCache: {},maxRecentPosts: int,
|
||||||
tlStr+='<br>'
|
tlStr+='<br>'
|
||||||
tlStr+='<div class="galleryContainer">\n'
|
tlStr+='<div class="galleryContainer">\n'
|
||||||
for item in timelineJson['orderedItems']:
|
for item in timelineJson['orderedItems']:
|
||||||
if item['type']=='Create' or item['type']=='Announce':
|
if item['type']=='Create' or item['type']=='Announce' or item['type']=='Update':
|
||||||
# is the actor who sent this post snoozed?
|
# is the actor who sent this post snoozed?
|
||||||
if isPersonSnoozed(baseDir,nickname,domain,item['actor']):
|
if isPersonSnoozed(baseDir,nickname,domain,item['actor']):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue