Check for blocked hashtag with hash prefix

This commit is contained in:
bashrc committed 2020-12-03 19:51:47 +00:00
1 parent c0eedb0716
commit 60abb1a0a6
2 files changed
+3 -1

No files matched your search

+2
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
+1 -1
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] = [