Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

users: Add `acting_user` to `do_update_outgoing_webhook_service`.

PieterCK38d2a95aa1d6
diff --git a/zerver/actions/users.py b/zerver/actions/users.py
index 6e2d24e08fe..6f14991e0fa 100644
--- a/zerver/actions/users.py
+++ b/zerver/actions/users.py
@@ -786,6 +786,7 @@ def do_update_outgoing_webhook_service(
*,
interface: int | None = None,
base_url: str | None = None,
+ acting_user: UserProfile | None,
) -> None:
update_fields: dict[str, str | int] = {}
if interface is not None:
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 4e82cab5290..8b3665b1de5 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -3519,7 +3519,10 @@ class NormalActionsTest(BaseAction):
)
with self.verify_action() as events:
do_update_outgoing_webhook_service(
- bot, interface=2, base_url="http://hostname.domain2.com"
+ bot,
+ interface=2,
+ base_url="http://hostname.domain2.com",
+ acting_user=self.user_profile,
)
check_realm_bot_update("events[0]", events[0], "services")
@@ -3537,12 +3540,15 @@ class NormalActionsTest(BaseAction):
)
with self.verify_action(num_events=0, state_change_expected=False) as events:
- do_update_outgoing_webhook_service(bot)
+ do_update_outgoing_webhook_service(bot, acting_user=self.user_profile)
# Trying to update with the same value as existing value results in no op.
with self.verify_action(num_events=0, state_change_expected=False) as events:
do_update_outgoing_webhook_service(
- bot, interface=2, base_url="http://hostname.domain2.com"
+ bot,
+ interface=2,
+ base_url="http://hostname.domain2.com",
+ acting_user=self.user_profile,
)
def test_do_deactivate_bot(self) -> None:
diff --git a/zerver/views/users.py b/zerver/views/users.py
index c2c915fe758..1542173c174 100644
--- a/zerver/views/users.py
+++ b/zerver/views/users.py
@@ -503,6 +503,7 @@ def patch_bot_backend(
bot,
interface=service_interface,
base_url=service_payload_url,
+ acting_user=user_profile,
)
if config_data is not None: