Check that the same notification is not repeatedly sent

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