diff --git a/posts.py b/posts.py index fbf6588b..8461d9c1 100644 --- a/posts.py +++ b/posts.py @@ -2052,7 +2052,7 @@ def addPostStringToTimeline(postStr: str,boxname: str,postsInBox: [],boxActor: s """ # must be a "Note" or "Announce" type 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 '#Public' in postStr or '/followers' in postStr: @@ -2171,16 +2171,16 @@ def createBoxIndexed(recentPostsCache: {}, \ postUrl=postFilename.replace('\n','').replace('.json','').strip() postAdded=False + # is the post cached in memory? if recentPostsCache.get('index'): if postUrl in recentPostsCache['index']: if recentPostsCache['json'].get(postUrl): addPostStringToTimeline(recentPostsCache['json'][postUrl], \ boxname,postsInBox,boxActor) - #print('Json post added to timeline from cache: '+postUrl) postAdded=True if not postAdded: - # get the full path of the post + # read the post from file fullPostFilename= \ locatePost(baseDir,nickname,domain,postUrl,False) if fullPostFilename: diff --git a/webinterface.py b/webinterface.py index 37b4bac0..654fa2f6 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2373,14 +2373,20 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \ def isQuestion(postObjectJson: {}) -> bool: """ is the given post a question? """ - if postObjectJson['type']=='Create': - if isinstance(postObjectJson['object'], dict): - if postObjectJson['object'].get('type'): - if postObjectJson['object']['type']=='Question': - if postObjectJson['object'].get('oneOf'): - if isinstance(postObjectJson['object']['oneOf'], list): - return True - return False + if postObjectJson['type']!='Create' and \ + postObjectJson['type']!='Update': + return False + if not isinstance(postObjectJson['object'], dict): + return False + if not postObjectJson['object'].get('type'): + 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, translate: {},pageNumber: int, \ @@ -2592,7 +2598,7 @@ def htmlTimeline(recentPostsCache: {},maxRecentPosts: int, tlStr+='
' tlStr+='
\n' 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? if isPersonSnoozed(baseDir,nickname,domain,item['actor']): continue