Skip to content

Commit b5af0fd

Browse files
committed
Added env var to set app to not try to slack ping for MP submission
1 parent 7de7a60 commit b5af0fd

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

conditional/blueprints/major_project_submission.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,16 @@ def submit_major_project(user_dict=None):
165165

166166

167167
# Send the slack ping only after we know that the data was properly saved to the DB
168-
send_slack_ping(
169-
{
170-
"text": f"<!subteam^S5XENJJAH> *{get_member_name(user_id)}* ({user_id})"
171-
f" submitted their major project, *{name}*!"
172-
}
173-
)
168+
if app.config['DEV_DISABLE_SLACK_PING']:
169+
log.info("Slack ping skipped due to environment override")
170+
else:
171+
send_slack_ping(
172+
{
173+
"text": f"<!subteam^S5XENJJAH> *{get_member_name(user_id)}* ({user_id})"
174+
f" submitted their major project, *{name}*!"
175+
}
176+
)
177+
174178

175179
return jsonify({"success": True}), 200
176180

config.env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
IP = env.get("CONDITIONAL_IP", "0.0.0.0")
1616
PORT = env.get("CONDITIONAL_PORT", 6969)
1717
WEBHOOK_URL = env.get("CONDITIONAL_WEBHOOK_URL", "INSERT URL HERE")
18+
DEV_DISABLE_SLACK_PING = env.get("DEV_DISABLE_SLACK_PING", "false") == "true"
1819
PROFILING = env.get("CONDITIONAL_PROFILING", "false").lower() == "true"
1920

2021
# DB Info

0 commit comments

Comments
 (0)