forked from indymedia/epicyon
Avoid duplication
parent
8aecc5827b
commit
fce789c2e9
|
@ -90,16 +90,12 @@ def hashtagRuleResolve(tree: [], hashtags: [], moderated: bool,
|
||||||
content, url)
|
content, url)
|
||||||
elif tree[0] == 'contains':
|
elif tree[0] == 'contains':
|
||||||
if len(tree) == 2:
|
if len(tree) == 2:
|
||||||
|
matchStr = None
|
||||||
if isinstance(tree[1], str):
|
if isinstance(tree[1], str):
|
||||||
matchStr = tree[1]
|
matchStr = tree[1]
|
||||||
if matchStr.startswith('"') and matchStr.endswith('"'):
|
|
||||||
matchStr = matchStr[1:]
|
|
||||||
matchStr = matchStr[:len(matchStr) - 1]
|
|
||||||
matchStrLower = matchStr.lower()
|
|
||||||
contentWithoutTags = content.replace('#' + matchStrLower, '')
|
|
||||||
return matchStrLower in contentWithoutTags
|
|
||||||
elif isinstance(tree[1], list):
|
elif isinstance(tree[1], list):
|
||||||
matchStr = tree[1][0]
|
matchStr = tree[1][0]
|
||||||
|
if matchStr:
|
||||||
if matchStr.startswith('"') and matchStr.endswith('"'):
|
if matchStr.startswith('"') and matchStr.endswith('"'):
|
||||||
matchStr = matchStr[1:]
|
matchStr = matchStr[1:]
|
||||||
matchStr = matchStr[:len(matchStr) - 1]
|
matchStr = matchStr[:len(matchStr) - 1]
|
||||||
|
|
Loading…
Reference in New Issue