mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
request: Refactor ZulipRequestNotes to RequestNotes.
This utilizes the generic `BaseNotes` we added for multipurpose patching. With this migration as an example, we can further support more types of notes to replace the monkey-patching approach we have used throughout the codebase for type safety.
This commit is contained in:
@@ -5,7 +5,7 @@ from django.utils.translation import gettext as _
|
||||
from zerver.decorator import webhook_view
|
||||
from zerver.lib.actions import check_send_stream_message
|
||||
from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.request import REQ, get_request_notes, has_request_variables
|
||||
from zerver.lib.request import REQ, RequestNotes, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.models import UserProfile
|
||||
|
||||
@@ -35,7 +35,7 @@ def api_slack_webhook(
|
||||
subject = _("Message from Slack")
|
||||
|
||||
content = ZULIP_MESSAGE_TEMPLATE.format(message_sender=user_name, text=text)
|
||||
client = get_request_notes(request).client
|
||||
client = RequestNotes.get_notes(request).client
|
||||
assert client is not None
|
||||
check_send_stream_message(user_profile, client, stream, subject, content)
|
||||
return json_success()
|
||||
|
||||
Reference in New Issue
Block a user