mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 13:03:16 +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: () => {
|
didConfirm: () => {
|
||||||
model
|
model
|
||||||
.destroy()
|
.destroy()
|
||||||
.then(() => this.router.transitionTo("groups.index"))
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.dialog.alert(I18n.t("admin.groups.delete_failed"));
|
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),
|
didCancel: () => this.set("destroying", false),
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
@icon="trash-alt"
|
@icon="trash-alt"
|
||||||
@label="admin.groups.delete"
|
@label="admin.groups.delete"
|
||||||
class="btn-danger"
|
class="btn-danger"
|
||||||
|
data-test-selector="delete-group-button"
|
||||||
/>
|
/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/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
|
self
|
||||||
end
|
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)
|
def select_user_and_add(user)
|
||||||
page.find(
|
page.find(
|
||||||
".modal-container .user-chooser .multi-select-header .select-kit-header-wrapper",
|
".modal-container .user-chooser .multi-select-header .select-kit-header-wrapper",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user