api: Fix encoding of strings in video calls endpoint.

This removes unnecessary json_validator for string parameters in the
BigBlueButton video calls endpoints.  Note that this breaks links to
video meetings sent before the upgrade; there's not much we can do
about that.

Since this is the last commit in this series, we update the
ZULIP_FEATURE_LEVEL for this batch of changes.

Fixes part of #18035.
This commit is contained in:
Gaurav Pandey 2021-05-07 00:44:16 +05:30 committed by Tim Abbott
parent 36ad9b7d0e
commit 00647b6fa7
4 changed files with 29 additions and 14 deletions

View File

@ -10,6 +10,21 @@ below features are supported.
## Changes in Zulip 4.0
**Feature level 63**
* `PATCH /settings/notifications`: Removed unnecessary JSON-encoding of string
parameter `notification_sound`.
* `PATCH /settings/display`: Removed unnecessary JSON-encoding of string
parameter `default_language`.
* `POST /users/me/tutorial_status`: Removed unnecessary JSON-encoding of string
parameter `status`.
* `POST /realm/domains`: Removed unnecessary JSON-encoding of string
parameter `domain`.
* `PATCH /default_stream_groups/{user_id}`: Removed unnecessary JSON-encoding of string
parameters `new_group_name` and `new_description`.
* `POST /users/me/hotspots`: Removed unnecessary JSON-encoding of string
parameter `hotspot`.
**Feature level 62**
* Added `moderators only` option for `wildcard_mention_policy`.

View File

@ -30,7 +30,7 @@ DESKTOP_WARNING_VERSION = "5.2.0"
#
# Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md.
API_FEATURE_LEVEL = 62
API_FEATURE_LEVEL = 63
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump

View File

@ -176,8 +176,8 @@ class TestVideoCall(ZulipTestCase):
self.assert_json_success(response)
self.assertEqual(
response.json()["url"],
"/calls/bigbluebutton/join?meeting_id=%22zulip-1%22&password=%22AAAAAAAAAA%22"
"&checksum=%22697939301a52d3a2f0b3c3338895c1a5ab528933%22",
"/calls/bigbluebutton/join?meeting_id=zulip-1&password=AAAAAAAAAA"
"&checksum=697939301a52d3a2f0b3c3338895c1a5ab528933",
)
@responses.activate
@ -189,7 +189,7 @@ class TestVideoCall(ZulipTestCase):
)
response = self.client_get(
"/calls/bigbluebutton/join",
{"meeting_id": '"zulip-1"', "password": '"a"', "checksum": '"check"'},
{"meeting_id": "zulip-1", "password": "a", "checksum": "check"},
)
self.assertEqual(response.status_code, 302)
self.assertEqual(isinstance(response, HttpResponseRedirect), True)
@ -209,7 +209,7 @@ class TestVideoCall(ZulipTestCase):
)
response = self.client_get(
"/calls/bigbluebutton/join",
{"meeting_id": '"zulip-1"', "password": '"a"', "checksum": '"check"'},
{"meeting_id": "zulip-1", "password": "a", "checksum": "check"},
)
self.assert_json_error(response, "Error authenticating to the Big Blue Button server.")
@ -224,7 +224,7 @@ class TestVideoCall(ZulipTestCase):
)
response = self.client_get(
"/calls/bigbluebutton/join",
{"meeting_id": '"zulip-1"', "password": '"a"', "checksum": '"check"'},
{"meeting_id": "zulip-1", "password": "a", "checksum": "check"},
)
self.assert_json_error(response, "Error connecting to the Big Blue Button server.")
@ -238,7 +238,7 @@ class TestVideoCall(ZulipTestCase):
)
response = self.client_get(
"/calls/bigbluebutton/join",
{"meeting_id": '"zulip-1"', "password": '"a"', "checksum": '"check"'},
{"meeting_id": "zulip-1", "password": "a", "checksum": "check"},
)
self.assert_json_error(response, "Big Blue Button server returned an unexpected error.")
@ -246,6 +246,6 @@ class TestVideoCall(ZulipTestCase):
with self.settings(BIG_BLUE_BUTTON_SECRET=None, BIG_BLUE_BUTTON_URL=None):
response = self.client_get(
"/calls/bigbluebutton/join",
{"meeting_id": '"zulip-1"', "password": '"a"', "checksum": '"check"'},
{"meeting_id": "zulip-1", "password": "a", "checksum": "check"},
)
self.assert_json_error(response, "Big Blue Button is not configured.")

View File

@ -188,9 +188,9 @@ def get_bigbluebutton_url(request: HttpRequest, user_profile: UserProfile) -> Ht
"/calls/bigbluebutton/join",
urlencode(
{
"meeting_id": '"' + id + '"',
"password": '"' + password + '"',
"checksum": '"' + checksum + '"',
"meeting_id": id,
"password": password,
"checksum": checksum,
}
),
)
@ -207,9 +207,9 @@ def get_bigbluebutton_url(request: HttpRequest, user_profile: UserProfile) -> Ht
@has_request_variables
def join_bigbluebutton(
request: HttpRequest,
meeting_id: str = REQ(json_validator=check_string),
password: str = REQ(json_validator=check_string),
checksum: str = REQ(json_validator=check_string),
meeting_id: str = REQ(),
password: str = REQ(),
checksum: str = REQ(),
) -> HttpResponse:
if settings.BIG_BLUE_BUTTON_URL is None or settings.BIG_BLUE_BUTTON_SECRET is None:
return json_error(_("Big Blue Button is not configured."))