Check for blocked hashtag with hash prefix

main
Bob Mottram 2020-12-03 19:51:47 +00:00
parent c0eedb0716
commit 60abb1a0a6
2 changed files with 3 additions and 1 deletions

View File

@ -131,6 +131,8 @@ def isBlockedHashtag(baseDir: str, hashtag: str) -> bool:
globalBlockingFilename = baseDir + '/accounts/blocking.txt'
if os.path.isfile(globalBlockingFilename):
hashtag = hashtag.strip('\n').strip('\r')
if not hashtag.startswith('#'):
hashtag = '#' + hashtag
if hashtag + '\n' in open(globalBlockingFilename).read():
return True
return False

View File

@ -123,7 +123,7 @@ def addNewswireDictEntry(baseDir: str, domain: str,
# check that no tags are blocked
for tag in postTags:
if isBlockedHashtag(baseDir, tag.replace('#', '')):
if isBlockedHashtag(baseDir, tag):
return
newswire[dateStr] = [