Create index entry for new report

main
Bob Mottram 2019-11-16 18:11:30 +00:00
parent 28d1869826
commit 8ea168c5ab
1 changed files with 12 additions and 1 deletions

View File

@ -1012,10 +1012,21 @@ def createReportPost(baseDir: str,
None,None,None) None,None,None)
if not postJsonObject: if not postJsonObject:
continue continue
handle=toNickname+'@'+domain
# update the inbox index with the report filename
indexFilename=baseDir+'/accounts/'+handle+'/inbox.index'
indexEntry=postJsonObject['id'].replace('/activity','').replace('/','#')+'.json'
if indexEntry not in open(indexFilename).read():
try:
with open(indexFilename, 'a+') as fp:
fp.write(indexEntry)
except:
pass
# save a notification file so that the moderator # save a notification file so that the moderator
# knows something new has appeared # knows something new has appeared
toNickname=toUrl.split('/users/')[1] toNickname=toUrl.split('/users/')[1]
handle=toNickname+'@'+domain
newReportFile=baseDir+'/accounts/'+handle+'/.newReport' newReportFile=baseDir+'/accounts/'+handle+'/.newReport'
if os.path.isfile(newReportFile): if os.path.isfile(newReportFile):
continue continue