Check that the same notification is not repeatedly sent

merge-requests/30/head
Bob Mottram 2021-07-07 10:30:15 +01:00
parent 5bc7f28685
commit c417566675
1 changed files with 8 additions and 3 deletions

View File

@ -1858,9 +1858,14 @@ def _notifyPostArrival(baseDir: str, handle: str, url: str) -> None:
if not os.path.isdir(accountDir): if not os.path.isdir(accountDir):
return return
notifyFile = accountDir + '/.newNotifiedPost' notifyFile = accountDir + '/.newNotifiedPost'
if not os.path.isfile(notifyFile): if os.path.isfile(notifyFile):
with open(notifyFile, 'w+') as fp: # check that the same notification is not repeatedly sent
fp.write(url) with open(notifyFile, 'r') as fp:
existingNotificationMessage = fp.read()
if url in existingNotificationMessage:
return
with open(notifyFile, 'w+') as fp:
fp.write(url)
def _replyNotify(baseDir: str, handle: str, url: str) -> None: def _replyNotify(baseDir: str, handle: str, url: str) -> None: