FIX: Include 5 participants in topic summary
This commit is contained in:
parent
4cf3c9cccb
commit
99b4f79a90
|
@ -3,6 +3,7 @@
|
|||
# This is used on a topic page
|
||||
class TopicParticipantsSummary
|
||||
attr_reader :topic, :options
|
||||
PARTICIPANT_COUNT = 5 # should match maxUserCount in topic list
|
||||
|
||||
def initialize(topic, options = {})
|
||||
@topic = topic
|
||||
|
@ -26,7 +27,7 @@ class TopicParticipantsSummary
|
|||
end
|
||||
|
||||
def top_participants
|
||||
user_ids.map { |id| avatar_lookup[id] }.compact.uniq.take(4)
|
||||
user_ids.map { |id| avatar_lookup[id] }.compact.uniq.take(PARTICIPANT_COUNT)
|
||||
end
|
||||
|
||||
def user_ids
|
||||
|
|
|
@ -21,9 +21,9 @@ describe TopicParticipantsSummary do
|
|||
fab!(:user4) { Fabricate(:user) }
|
||||
fab!(:user5) { Fabricate(:user) }
|
||||
|
||||
it "must never contains the user and at most 4 participants" do
|
||||
it "must never contains the user and at most 5 participants" do
|
||||
topic.allowed_user_ids = [user1.id, user2.id, user3.id, user4.id, user5.id]
|
||||
expect(summary.map(&:user)).to eq([user1, user2, user3, user4])
|
||||
expect(summary.map(&:user)).to eq([user1, user2, user3, user4, user5])
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue