summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG2
-rw-r--r--app/finders/pipelines_finder.rb4
-rw-r--r--app/models/member.rb1
-rw-r--r--app/models/project_team.rb14
4 files changed, 7 insertions, 14 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b28a2437501..c8ada3bf7b8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@ v 8.10.0 (unreleased)
- Exclude email check from the standard health check
- Fix changing issue state columns in milestone view
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
+ - PipelinesFinder uses git cache data
- Check for conflicts with existing Project's wiki path when creating a new project.
- Remove unused front-end variable -> default_issues_tracker
- Add API endpoint for a group issues !4520 (mahcsig)
@@ -26,6 +27,7 @@ v 8.9.3 (unreleased)
- Update mobile button icons to be more inline with typical UI paradigms
- Fixes missing avatar on system notes. !4954
- Fixes issues importing events in Import/Export. Import/Export version bumped to 0.1.1
+ - Improve performance of obtaining the maximum access of a user in a project
v 8.9.2
- Fix visibility of snippets when searching.
diff --git a/app/finders/pipelines_finder.rb b/app/finders/pipelines_finder.rb
index c19a795d467..641fbf838f1 100644
--- a/app/finders/pipelines_finder.rb
+++ b/app/finders/pipelines_finder.rb
@@ -29,10 +29,10 @@ class PipelinesFinder
end
def branches
- project.repository.branches.map(&:name)
+ project.repository.branch_names
end
def tags
- project.repository.tags.map(&:name)
+ project.repository.tag_names
end
end
diff --git a/app/models/member.rb b/app/models/member.rb
index c74a16367db..57161397e2b 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -32,6 +32,7 @@ class Member < ActiveRecord::Base
scope :request, -> { where.not(requested_at: nil) }
scope :non_request, -> { where(requested_at: nil) }
scope :non_pending, -> { non_request.non_invite }
+ scope :has_access, -> { where('access_level > 0') }
scope :guests, -> { where(access_level: GUEST) }
scope :reporters, -> { where(access_level: REPORTER) }
diff --git a/app/models/project_team.rb b/app/models/project_team.rb
index 73e736820af..0865b979ce0 100644
--- a/app/models/project_team.rb
+++ b/app/models/project_team.rb
@@ -137,20 +137,10 @@ class ProjectTeam
def max_member_access(user_id)
access = []
- project.members.non_request.each do |member|
- if member.user_id == user_id
- access << member.access_field if member.access_field
- break
- end
- end
+ access += project.members.non_request.where(user_id: user_id).has_access.pluck(:access_level)
if group
- group.members.non_request.each do |member|
- if member.user_id == user_id
- access << member.access_field if member.access_field
- break
- end
- end
+ access += group.members.non_request.where(user_id: user_id).has_access.pluck(:access_level)
end
if project.invited_groups.any? && project.allowed_to_share_with_group?