Skip to content

Commit

Permalink
Show unconfirmed organizers and moderators
Browse files Browse the repository at this point in the history
  • Loading branch information
lujanfernaud committed Jul 20, 2018
1 parent b9450f4 commit a9403b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ def normal_topics
end

def organizers
group_users_with_role :organizer
group_users_with_role(:organizer)
end

def moderators
group_users_with_role :moderator
group_users_with_role(:moderator)
end

def members_with_role
group_users_with_role :member
group_users_with_role(:member).confirmed
end

def recent_members(limit: RECENT_MEMBERS)
Expand Down
3 changes: 1 addition & 2 deletions app/queries/group_users_with_role_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

class GroupUsersWithRoleQuery
def self.call(group, role)
User.confirmed
.joins(:roles)
User.joins(:roles)
.where(roles: { resource_id: group, name: role.to_s })
end
end
4 changes: 2 additions & 2 deletions test/integration/groups/groups_members_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def setup
assert_not page.has_content? unconfirmed.name
end

test "unconfirmed organizers are not shown" do
test "unconfirmed organizers are shown" do
stub_sample_content_for_new_users

user = create :user, :confirmed
Expand All @@ -60,7 +60,7 @@ def setup

visit group_members_path(group)

assert_not page.has_content? unconfirmed.name
assert page.has_content? unconfirmed.name
end

test "logged out invited user visits group members" do
Expand Down

0 comments on commit a9403b7

Please sign in to comment.