0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 07:23:30 +08:00
discourse/spec/system/viewing_group_members_spec.rb
Kris 5416633d52
UX: show group ownership and status to all users (#39987)
Reported:
https://meta.discourse.org/t/users-cannot-see-who-is-a-group-owner/402886

It can be useful to see who a group owner is if you want to figure out
who to ask for membership or deal with other issues.

Prior to a refactor in fac78413c8, this information was publicly
available, and the data is still there but not rendered. Currently only
group owners and staff can see it.

This removes the `canManageGroup` gate so it's public again. 

<img width="2216" height="846" alt="image"
src="https://github.com/user-attachments/assets/2a79aa07-89c8-4e1f-8ca2-e45b67eb0111"
/>
2026-05-14 08:57:10 +10:00

28 lines
884 B
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe "Viewing group members" do
fab!(:group)
fab!(:user_in_group_1) { Fabricate(:user).tap { |u| group.add(u) } }
fab!(:user_in_group_2) { Fabricate(:user).tap { |u| group.add(u) } }
fab!(:user_in_group_3) { Fabricate(:user).tap { |u| group.add(u) } }
it "loads more group members when a user scrolls to the bottom of the list" do
stub_const(GroupsController, "MEMBERS_DEFAULT_PAGE_SIZE", 2) do
visit("/g/#{group.name}/members")
expect(page).to have_selector(".group-member", count: 3)
end
end
it "shows the owner badge to viewers who can't manage the group" do
group.add_owner(user_in_group_1)
sign_in(Fabricate(:user))
visit("/g/#{group.name}/members")
expect(page).to have_css(
".directory-table__cell.group-owner",
text: I18n.t("js.groups.members.owner"),
)
end
end