FIX: Correct error on add user modal (#23679)
This commit is contained in:
parent
1677754762
commit
20a882389a
|
@ -63,7 +63,7 @@ export default class GroupAddMembers extends Component {
|
|||
});
|
||||
this.args.closeModal();
|
||||
})
|
||||
.catch((e) => (this.flash = e))
|
||||
.catch((e) => (this.flash = e.jqXHR.responseJSON.errors.join(". ")))
|
||||
.finally(() => (this.loading = false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
@icon="plus"
|
||||
@action={{route-action "showInviteModal"}}
|
||||
@label="groups.manage.invite_members"
|
||||
class="btn-default group-members-add"
|
||||
class="btn-default group-members-invite"
|
||||
/>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "Group members", type: :system do
|
||||
let(:group_page) { PageObjects::Pages::Group.new }
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:group) { Fabricate(:group) }
|
||||
|
||||
before { sign_in(admin) }
|
||||
|
||||
describe "adds a user to the group" do
|
||||
it "should show that the user is already in the group" do
|
||||
group_page.visit(group).add_users.select_user_and_add(admin)
|
||||
|
||||
expect(
|
||||
group_page.find(".group-members .directory-table__cell--username.group-member .username"),
|
||||
).to have_text(admin.username)
|
||||
|
||||
group_page.add_users.select_user_and_add(admin)
|
||||
|
||||
expect(page.find(".modal-container #modal-alert")).to have_text(
|
||||
"'#{admin.username}' is already a member of this group",
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PageObjects
|
||||
module Pages
|
||||
class Group < PageObjects::Pages::Base
|
||||
def visit(group)
|
||||
page.visit("/g/#{group.name}")
|
||||
self
|
||||
end
|
||||
|
||||
def find(selector)
|
||||
page.find(".group #{selector}")
|
||||
end
|
||||
|
||||
def add_users
|
||||
find(".group-members-manage button.group-members-add").click
|
||||
self
|
||||
end
|
||||
|
||||
def select_user_and_add(user)
|
||||
page.find(
|
||||
".modal-container .user-chooser .multi-select-header .select-kit-header-wrapper",
|
||||
).click
|
||||
page.find(".modal-container .user-chooser .filter-input").set(user.username)
|
||||
page.find(
|
||||
".modal-container li.email-group-user-chooser-row[data-value='#{user.username}']",
|
||||
).click
|
||||
page.find(".modal-container button.add.btn-primary").click
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue