mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 13:12:45 +08:00
FIX: deleting a groups was throwing an error (#26623)
This commit is contained in:
parent
8f52fd1051
commit
326da84373
|
@ -144,13 +144,17 @@ export default Controller.extend({
|
|||
didConfirm: () => {
|
||||
model
|
||||
.destroy()
|
||||
.then(() => this.router.transitionTo("groups.index"))
|
||||
.catch((error) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
this.dialog.alert(I18n.t("admin.groups.delete_failed"));
|
||||
})
|
||||
.finally(() => this.set("destroying", false));
|
||||
.then(() => {
|
||||
this.router.transitionTo("groups.index");
|
||||
})
|
||||
.finally(() => {
|
||||
this.set("destroying", false);
|
||||
});
|
||||
},
|
||||
didCancel: () => this.set("destroying", false),
|
||||
});
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
@icon="trash-alt"
|
||||
@label="admin.groups.delete"
|
||||
class="btn-danger"
|
||||
data-test-selector="delete-group-button"
|
||||
/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
19
spec/system/groups/group_spec.rb
Normal file
19
spec/system/groups/group_spec.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "Group", type: :system do
|
||||
let(:group_page) { PageObjects::Pages::Group.new }
|
||||
fab!(:admin)
|
||||
fab!(:group)
|
||||
|
||||
before { sign_in(admin) }
|
||||
|
||||
describe "delete a group" do
|
||||
it "redirects to groups index page" do
|
||||
group_page.visit(group)
|
||||
|
||||
group_page.delete_group
|
||||
|
||||
expect(page).to have_current_path("/g")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -17,6 +17,11 @@ module PageObjects
|
|||
self
|
||||
end
|
||||
|
||||
def delete_group
|
||||
page.find("[data-test-selector='delete-group-button']").click
|
||||
page.find(".dialog-footer .btn-danger").click
|
||||
end
|
||||
|
||||
def select_user_and_add(user)
|
||||
page.find(
|
||||
".modal-container .user-chooser .multi-select-header .select-kit-header-wrapper",
|
||||
|
|
Loading…
Reference in New Issue
Block a user