Index for DM timeline

main2
Bob Mottram 2019-10-22 21:07:12 +01:00
parent cd53ee8dff
commit b0d6fd80f5
1 changed files with 10 additions and 7 deletions

View File

@ -1553,13 +1553,16 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
postJsonObject=messageJson postJsonObject=messageJson
if validPostContent(postJsonObject,maxMentions): if validPostContent(postJsonObject,maxMentions):
postIsReply=False # list of indexes to be updated
updateIndexList=['inbox']
populateReplies(baseDir,httpPrefix,domain,messageJson,maxReplies,debug) populateReplies(baseDir,httpPrefix,domain,messageJson,maxReplies,debug)
if not isGroup: if not isGroup:
# create a DM notification file if needed # create a DM notification file if needed
if isDM(postJsonObject): if isDM(postJsonObject):
nickname=handle.split('@')[0] nickname=handle.split('@')[0]
if nickname!='inbox': if nickname!='inbox':
# dm index will be updated
updateIndexList.append('dm')
dmNotify(baseDir,handle,httpPrefix+'://'+domain+'/users/'+nickname+'/dm') dmNotify(baseDir,handle,httpPrefix+'://'+domain+'/users/'+nickname+'/dm')
# get the actor being replied to # get the actor being replied to
@ -1574,7 +1577,8 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
if isReply(postJsonObject,actor): if isReply(postJsonObject,actor):
nickname=handle.split('@')[0] nickname=handle.split('@')[0]
if nickname!='inbox': if nickname!='inbox':
postIsReply=True # replies index will be updated
updateIndexList.append('tlreplies')
replyNotify(baseDir,handle,httpPrefix+'://'+domain+'/users/'+nickname+'/tlreplies') replyNotify(baseDir,handle,httpPrefix+'://'+domain+'/users/'+nickname+'/tlreplies')
# get the avatar for a reply/announce # get the avatar for a reply/announce
@ -1582,11 +1586,10 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
# save the post to file # save the post to file
if saveJson(postJsonObject,destinationFilename): if saveJson(postJsonObject,destinationFilename):
if not inboxUpdateIndex('inbox',baseDir,handle,destinationFilename,debug): # update the indexes for different timelines
print('ERROR: unable to update inbox index') for boxname in updateIndexList:
if postIsReply: if not inboxUpdateIndex(boxname,baseDir,handle,destinationFilename,debug):
if not inboxUpdateIndex('tlreplies',baseDir,handle,destinationFilename,debug): print('ERROR: unable to update '+boxname+' index')
print('ERROR: unable to update replies index')
inboxUpdateCalendar(baseDir,handle,postJsonObject) inboxUpdateCalendar(baseDir,handle,postJsonObject)