From 44d7c791b4d5c37acde3970817aaeab4a4f730f0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 11 Oct 2019 17:20:16 +0100 Subject: [PATCH] Check that calendar event does not already exist --- inbox.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/inbox.py b/inbox.py index 82481e356..662127c50 100644 --- a/inbox.py +++ b/inbox.py @@ -1387,11 +1387,15 @@ def inboxUpdateCalendar(baseDir: str,handle: str,postJsonObject: {}) -> None: if not os.path.isdir(calendarPath+'/'+str(eventYear)): os.mkdir(calendarPath+'/'+str(eventYear)) calendarFilename=calendarPath+'/'+str(eventYear)+'/'+str(eventMonthNumber)+'.txt' + postId=postJsonObject['id'].replace('/','#') + if os.path.isfile(calendarFilename): + if postId in open(calendarFilename).read(): + return calendarFile=open(calendarFilename,'a+') if calendarFile: - calendarFile.write(postJsonObject['id'].replace('/','#')+'\n') + calendarFile.write(postId+'\n') calendarFile.close() - + def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \ baseDir: str,httpPrefix: str,sendThreads: [], \ postLog: [],cachedWebfingers: {},personCache: {}, \