mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
user_groups: Show deactivation error in modal itself.
Previously, the error was shown besides the group name after the modal was closed, but it did not look good for long error messages like the one we get when the group being deactivated is being used for a setting. Updated the code to use dialog_widget.submit_api_request since it takes care of showing the error inside the modal and also added code to show loading spinner as the modal is not closed immediately to show the error.
This commit is contained in:
@@ -26,7 +26,6 @@ import * as settings_org from "./settings_org";
|
|||||||
import {current_user, realm} from "./state_data";
|
import {current_user, realm} from "./state_data";
|
||||||
import * as stream_data from "./stream_data";
|
import * as stream_data from "./stream_data";
|
||||||
import * as timerender from "./timerender";
|
import * as timerender from "./timerender";
|
||||||
import * as ui_report from "./ui_report";
|
|
||||||
import * as user_group_components from "./user_group_components";
|
import * as user_group_components from "./user_group_components";
|
||||||
import * as user_group_create from "./user_group_create";
|
import * as user_group_create from "./user_group_create";
|
||||||
import * as user_group_edit_members from "./user_group_edit_members";
|
import * as user_group_edit_members from "./user_group_edit_members";
|
||||||
@@ -919,19 +918,13 @@ export function initialize() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
function deactivate_user_group() {
|
function deactivate_user_group() {
|
||||||
channel.post({
|
const url = "/json/user_groups/" + group_id + "/deactivate";
|
||||||
url: "/json/user_groups/" + group_id + "/deactivate",
|
const opts = {
|
||||||
success() {
|
success_continuation() {
|
||||||
active_group_data.$row.remove();
|
active_group_data.$row.remove();
|
||||||
},
|
},
|
||||||
error(xhr) {
|
};
|
||||||
ui_report.error(
|
dialog_widget.submit_api_request(channel.post, url, {}, opts);
|
||||||
$t_html({defaultMessage: "Failed"}),
|
|
||||||
xhr,
|
|
||||||
$(".group_change_property_info"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const html_body = render_confirm_delete_user({
|
const html_body = render_confirm_delete_user({
|
||||||
@@ -947,6 +940,8 @@ export function initialize() {
|
|||||||
),
|
),
|
||||||
html_body,
|
html_body,
|
||||||
on_click: deactivate_user_group,
|
on_click: deactivate_user_group,
|
||||||
|
close_on_submit: false,
|
||||||
|
loading_spinner: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user