zulip: Fix principals default for remove_subscriptions.
The documented API for DELETE /api/v1/users/me/subscriptions is that principals should be omitted to remove a subscription for the calling user. A call with principals=[] should have a different meaning, but a server bug currently conflates this with a call omitting principals. Avoid relying on this bug. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
70b86614bd
commit
68128640bf
|
@ -1383,12 +1383,16 @@ class Client:
|
|||
)
|
||||
|
||||
def remove_subscriptions(
|
||||
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
|
||||
self,
|
||||
streams: Iterable[str],
|
||||
principals: Optional[Union[Sequence[str], Sequence[int]]] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
See examples/unsubscribe for example usage.
|
||||
"""
|
||||
request = dict(subscriptions=streams, principals=principals)
|
||||
request: Dict[str, object] = dict(subscriptions=streams)
|
||||
if principals is not None:
|
||||
request["principals"] = principals
|
||||
return self.call_endpoint(
|
||||
url="users/me/subscriptions",
|
||||
method="DELETE",
|
||||
|
|
Loading…
Reference in a new issue