Skip to content

Commit

Permalink
Loosen "repeating characters" restriction autopull
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Sep 11, 2018
1 parent d38c739 commit 57178a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion findspam.py
Expand Up @@ -228,7 +228,7 @@ def has_few_characters(s, site):
# noinspection PyUnusedLocal,PyMissingTypeHints
def has_repeating_characters(s, site):
s = s.strip().replace("\u200B", "").replace("\u200C", "") # Strip leading and trailing spaces
if "\n" in s or "<code>" in s or "<pre>" in s:
if "\n\n" in s or "<code>" in s or "<pre>" in s:
return False, ""
s = regex.sub(URL_REGEX, "", s) # Strip URLs for this check
if not s:
Expand Down
18 changes: 17 additions & 1 deletion metasmoke.py
Expand Up @@ -147,9 +147,9 @@ def handle_websocket_data(data):
reasons=["Manually reported " + post_data.post_type],
why=why)
elif "deploy_updated" in message:
return # Disabled
sha = message["deploy_updated"]["head_commit"]["id"]
if sha != os.popen('git log -1 --pretty="%H"').read():
return # Disabled
if "autopull" in message["deploy_updated"]["head_commit"]["message"]:
if only_blacklists_changed(GitManager.get_remote_diff()):
commit_md = "[`{0}`](https://github.com/{1}/commit/{0})" \
Expand Down Expand Up @@ -216,6 +216,9 @@ def send_stats_on_post(title, link, reasons, body, username, user_link, why, own
if GlobalVars.metasmoke_host is None:
log('info', 'Attempted to send stats but metasmoke_host is undefined. Ignoring.')
return
elif GlobalVars.metasmoke_down:
log('warning', "Metasmoke down, not sending stats.")
return

metasmoke_key = GlobalVars.metasmoke_key

Expand All @@ -242,6 +245,9 @@ def send_feedback_for_post(post_link, feedback_type, user_name, user_id, chat_ho
if GlobalVars.metasmoke_host is None:
log('info', 'Received chat feedback but metasmoke_host is undefined. Ignoring.')
return
elif GlobalVars.metasmoke_down:
log('warning', "Metasmoke is down, not sending feedback")
return

metasmoke_key = GlobalVars.metasmoke_key

Expand All @@ -268,6 +274,9 @@ def send_deletion_stats_for_post(post_link, is_deleted):
if GlobalVars.metasmoke_host is None:
log('info', 'Attempted to send deletion data but metasmoke_host is undefined. Ignoring.')
return
elif GlobalVars.metasmoke_down:
log('warning', "Metasmoke is down, not sending deletion stats")
return

metasmoke_key = GlobalVars.metasmoke_key

Expand All @@ -290,6 +299,9 @@ def send_status_ping():
if GlobalVars.metasmoke_host is None:
log('info', 'Attempted to send status ping but metasmoke_host is undefined. Not sent.')
return
elif GlobalVars.metasmoke_down:
log('info', "Metasmoke is down, wat?")
return

metasmoke_key = GlobalVars.metasmoke_key

Expand Down Expand Up @@ -333,6 +345,10 @@ def send_status_ping():

@staticmethod
def update_code_privileged_users_list():
if GlobalVars.metasmoke_down:
log('warning', "Metasmoke is down, can't update code provilege list")
return

payload = {'key': GlobalVars.metasmoke_key}
headers = {'Content-type': 'application/json'}
try:
Expand Down

0 comments on commit 57178a0

Please sign in to comment.