FIX: Member Highlights on Group Cards (#22828)

By default, only 10 members are highlighted on group cards. However,
joining/leaving a big group via the buttons on the group card results in
up to 50 members being highlighted. For large groups, this causes the card
to move off-screen.

This happens because, while the initial render explicitly fetches only 10
members, we don't seem to apply the same limit as part of the member
reload performed when a user leaves/joins via the buttons on the card.

This PR fixes that by only making the first 10 users available for
highlight regardless of the number of members loaded in the store.
This commit is contained in:
Selase Krakani
2023-07-28 14:33:42 +00:00
committed by GitHub
parent cd45f33430
commit e67fe1d07c
5 changed files with 99 additions and 4 deletions

View File

@ -0,0 +1,31 @@
# frozen_string_literal: true
module PageObjects
module Components
class GroupCard < PageObjects::Components::Base
MAX_MEMBER_HIGHLIGHT_COUNT = 10
JOIN_BUTTON_SELECTOR = ".group-details-button .group-index-join"
LEAVE_BUTTON_SELECTOR = ".group-details-button .group-index-leave"
def click_join_button
find(JOIN_BUTTON_SELECTOR).click
end
def click_leave_button
find(LEAVE_BUTTON_SELECTOR).click
end
def has_highlighted_member_count_of?(expected_count)
all(".card-content .members.metadata a.card-tiny-avatar", count: expected_count)
end
def has_join_button?
has_css?(JOIN_BUTTON_SELECTOR)
end
def has_leave_button?
has_css?(LEAVE_BUTTON_SELECTOR)
end
end
end
end

View File

@ -146,6 +146,12 @@ module PageObjects
@fast_edit_component.fast_edit_input
end
def click_mention(post, mention)
within post_by_number(post) do
find("a.mention-group", text: mention).click
end
end
private
def topic_footer_button_id(button)