Commit 3e19f197 authored by Phil Hughes's avatar Phil Hughes

Fixed issue with invited users not showing up

parent cdc55db3
...@@ -6,7 +6,19 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -6,7 +6,19 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def index def index
@groups = @project.project_group_links @groups = @project.project_group_links
@project_members = @project.team.members(!can?(current_user, :admin_project, @project))
members = []
project_members = @project.project_members
project_members = project_members.non_invite unless can?(current_user, :admin_project, @project)
members << project_members.pluck(:id)
if @project.group
group_members = @project.group.group_members
group_members = group_members.non_invite unless can?(current_user, :admin_project, @project)
members << group_members.pluck(:id)
end
@project_members = Member.where(id: members)
@project_members_size = @project_members.size @project_members_size = @project_members.size
if params[:search].present? if params[:search].present?
......
...@@ -52,8 +52,8 @@ class ProjectTeam ...@@ -52,8 +52,8 @@ class ProjectTeam
ProjectMember.truncate_team(project) ProjectMember.truncate_team(project)
end end
def members(non_invite = false) def members
@members ||= fetch_members(nil, non_invite) @members ||= fetch_members
end end
alias_method :users, :members alias_method :users, :members
...@@ -197,7 +197,7 @@ class ProjectTeam ...@@ -197,7 +197,7 @@ class ProjectTeam
access.each { |key, value| access[key] = [value, capped_access_level].min } access.each { |key, value| access[key] = [value, capped_access_level].min }
end end
def fetch_members(level = nil, non_invite = false) def fetch_members(level = nil)
project_members = project.members project_members = project.members
group_members = group ? group.members : [] group_members = group ? group.members : []
invited_members = [] invited_members = []
...@@ -236,7 +236,7 @@ class ProjectTeam ...@@ -236,7 +236,7 @@ class ProjectTeam
end end
user_ids = project_members.pluck(:user_id) user_ids = project_members.pluck(:user_id)
user_ids.push(*invited_members.map(&:user_id)) if invited_members.any? && non_invite user_ids.push(*invited_members.map(&:user_id)) if invited_members.any?
user_ids.push(*group_members.pluck(:user_id)) if group user_ids.push(*group_members.pluck(:user_id)) if group
User.where(id: user_ids) User.where(id: user_ids)
......
...@@ -4,6 +4,5 @@ ...@@ -4,6 +4,5 @@
%strong #{@project.name} %strong #{@project.name}
%span.badge= @project_members_size %span.badge= @project_members_size
%ul.content-list %ul.content-list
- members.each do |user| - members.each do |member|
- member = @project.team.find_member(user.id) = render 'shared/members/member', member: member
= render 'shared/members/member', member: member, user: user
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment