main
Bob Mottram 2021-07-05 10:55:01 +01:00
parent 8ae7262e9a
commit 3a509400a7
1 changed files with 2 additions and 0 deletions

View File

@ -1334,12 +1334,14 @@ def _deleteHashtagsOnPost(baseDir: str, postJsonObject: {}) -> None:
newlines = '' newlines = ''
for fileLine in lines: for fileLine in lines:
if postId in fileLine: if postId in fileLine:
# skip over the deleted post
continue continue
newlines += fileLine newlines += fileLine
if not newlines.strip(): if not newlines.strip():
# if there are no lines then remove the hashtag file # if there are no lines then remove the hashtag file
os.remove(tagIndexFilename) os.remove(tagIndexFilename)
else: else:
# write the new hashtag index without the given post in it
with open(tagIndexFilename, "w+") as f: with open(tagIndexFilename, "w+") as f:
f.write(newlines) f.write(newlines)