mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
webhooks: Rename *topic local variables to *topic_name.
This is preparatory work towards adding a Topic model. We plan to use the local variable name as 'topic' for the Topic model objects. Currently, we use *topic as the local variable name for topic names. We rename local variables of the form *topic to *topic_name so that we don't need to think about type collisions in individual code paths where we might want to talk about both Topic objects and strings for the topic name.
This commit is contained in:
committed by
Tim Abbott
parent
030f899195
commit
3afc8ed7ae
@@ -7,13 +7,13 @@ class CrashlyticsHookTests(WebhookTestCase):
|
||||
WEBHOOK_DIR_NAME = "crashlytics"
|
||||
|
||||
def test_crashlytics_verification_message(self) -> None:
|
||||
expected_topic = "Setup"
|
||||
expected_topic_name = "Setup"
|
||||
expected_message = "Webhook has been successfully configured."
|
||||
self.check_webhook("verification", expected_topic, expected_message)
|
||||
self.check_webhook("verification", expected_topic_name, expected_message)
|
||||
|
||||
def test_crashlytics_build_in_success_status(self) -> None:
|
||||
expected_topic = "123: Issue Title"
|
||||
expected_topic_name = "123: Issue Title"
|
||||
expected_message = (
|
||||
"[Issue](http://crashlytics.com/full/url/to/issue) impacts at least 16 device(s)."
|
||||
)
|
||||
self.check_webhook("issue_message", expected_topic, expected_message)
|
||||
self.check_webhook("issue_message", expected_topic_name, expected_message)
|
||||
|
||||
@@ -27,11 +27,11 @@ def api_crashlytics_webhook(
|
||||
) -> HttpResponse:
|
||||
event = payload["event"]
|
||||
if event == VERIFICATION_EVENT:
|
||||
topic = CRASHLYTICS_SETUP_TOPIC_TEMPLATE
|
||||
topic_name = CRASHLYTICS_SETUP_TOPIC_TEMPLATE
|
||||
body = CRASHLYTICS_SETUP_MESSAGE_TEMPLATE
|
||||
else:
|
||||
issue_body = payload["payload"]
|
||||
topic = CRASHLYTICS_TOPIC_TEMPLATE.format(
|
||||
topic_name = CRASHLYTICS_TOPIC_TEMPLATE.format(
|
||||
display_id=issue_body["display_id"].tame(check_int),
|
||||
title=issue_body["title"].tame(check_string),
|
||||
)
|
||||
@@ -40,5 +40,5 @@ def api_crashlytics_webhook(
|
||||
url=issue_body["url"].tame(check_string),
|
||||
)
|
||||
|
||||
check_send_webhook_message(request, user_profile, topic, body)
|
||||
check_send_webhook_message(request, user_profile, topic_name, body)
|
||||
return json_success(request)
|
||||
|
||||
Reference in New Issue
Block a user