Add missing `encodeURIComponent()` on some API uses

Fixes #2930.
This commit is contained in:
Rafid Aslam 2016-12-27 11:04:54 +07:00 committed by showell
parent f375caed46
commit ead32b179c
2 changed files with 8 additions and 8 deletions

View File

@ -396,7 +396,7 @@ function _setup_page() {
$("#deactivation_user_modal").modal("hide");
meta.current_deactivate_user_modal_row.find("button").eq(0).prop("disabled", true).text("Working…");
channel.del({
url: '/json/users/' + email,
url: '/json/users/' + encodeURIComponent(email),
error: function (xhr) {
if (xhr.status.toString().charAt(0) === "4") {
meta.current_deactivate_user_modal_row.find("button").closest("td").html(
@ -426,7 +426,7 @@ function _setup_page() {
var email = get_email_for_user_row(row);
channel.del({
url: '/json/bots/' + email,
url: '/json/bots/' + encodeURIComponent(email),
error: function (xhr) {
if (xhr.status.toString().charAt(0) === "4") {
row.find("button").closest("td").html(
@ -457,7 +457,7 @@ function _setup_page() {
var email = get_email_for_user_row(row);
channel.post({
url: '/json/users/' + email + "/reactivate",
url: '/json/users/' + encodeURIComponent(email) + "/reactivate",
error: function (xhr) {
var button = row.find("button");
if (xhr.status.toString().charAt(0) === "4") {
@ -677,7 +677,7 @@ function _setup_page() {
var row = $(e.target).closest(".user_row");
var email = get_email_for_user_row(row);
var url = "/json/users/" + email;
var url = "/json/users/" + encodeURIComponent(email);
var data = {
is_admin: JSON.stringify(true),
};
@ -708,7 +708,7 @@ function _setup_page() {
var row = $(e.target).closest(".user_row");
var email = get_email_for_user_row(row);
var url = "/json/users/" + email;
var url = "/json/users/" + encodeURIComponent(email);
var data = {
is_admin: JSON.stringify(false),
};
@ -754,7 +754,7 @@ function _setup_page() {
e.preventDefault();
e.stopPropagation();
var url = "/json/users/" + email;
var url = "/json/users/" + encodeURIComponent(email);
var data = {
full_name: JSON.stringify(full_name.val()),
};

View File

@ -317,7 +317,7 @@ function show_subscription_settings(sub_row) {
loading.make_indicator(indicator_elem);
channel.get({
url: "/json/streams/" + sub.name + "/members",
url: "/json/streams/" + encodeURIComponent(sub.name) + "/members",
idempotent: true,
success: function (data) {
loading.destroy_indicator(indicator_elem);
@ -1290,7 +1290,7 @@ $(function () {
var data = {stream_name: sub.name, is_private: is_private};
channel.patch({
url: "/json/streams/" + sub.name,
url: "/json/streams/" + encodeURIComponent(sub.name),
data: data,
success: function () {
sub = stream_data.get_sub_by_id(stream_id);