Skip to content

Commit 4908afc

Browse files
committed
Fix failing specs
1 parent ad78369 commit 4908afc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

app/policies/better_together/conversation_policy.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ def permitted_participants
4141
else
4242
role = BetterTogether::Role.find_by(identifier: 'platform_manager')
4343
manager_ids = BetterTogether::PersonPlatformMembership.where(role_id: role.id).pluck(:member_id)
44-
BetterTogether::Person.where(id: manager_ids)
45-
.or(BetterTogether::Person.privacy_public.where('preferences @> ?',
46-
{ receive_messages_from_members: true }.to_json)) # rubocop:disable Layout/LineLength
47-
.distinct
44+
# Include platform managers and any person who has explicitly opted in to receive messages
45+
opted_in = BetterTogether::Person.where(
46+
'preferences @> ?', { receive_messages_from_members: true }.to_json
47+
)
48+
49+
BetterTogether::Person.where(id: manager_ids).or(opted_in).distinct
4850
end
4951
end
5052

spec/factories/better_together/people.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module BetterTogether
66
FactoryBot.define do
77
factory :better_together_person, class: Person, aliases: %i[person inviter invitee creator author] do
88
id { Faker::Internet.uuid }
9-
name { Faker::Name.name }
9+
name { Faker::Name.unique.name }
1010
description { Faker::Lorem.paragraph(sentence_count: 3) }
1111
identifier { Faker::Internet.unique.username(specifier: 10..20) }
1212

0 commit comments

Comments
 (0)