summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-09 18:09:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-09 18:09:34 +0000
commit141902c04943d5fb43c014b8cf42af60a3bc0cdf (patch)
tree7e5a31fe9b0434fa0071cb5d09273669c3a8acab /app/models
parent209bd8cf1f542f6ba2a069b368a9187faa871e96 (diff)
downloadgitlab-ce-141902c04943d5fb43c014b8cf42af60a3bc0cdf.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/clusters/cluster.rb1
-rw-r--r--app/models/group_group_link.rb2
-rw-r--r--app/models/project.rb6
-rw-r--r--app/models/project_group_link.rb9
4 files changed, 11 insertions, 7 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 42771eaa82a..9ef3d64f21a 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -123,6 +123,7 @@ module Clusters
scope :managed, -> { where(managed: true) }
scope :with_persisted_applications, -> { eager_load(*APPLICATIONS_ASSOCIATIONS) }
scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) }
+ scope :with_management_project, -> { where.not(management_project: nil) }
scope :for_project_namespace, -> (namespace_id) { joins(:projects).where(projects: { namespace_id: namespace_id }) }
diff --git a/app/models/group_group_link.rb b/app/models/group_group_link.rb
index 58c188369da..c233f59b1a6 100644
--- a/app/models/group_group_link.rb
+++ b/app/models/group_group_link.rb
@@ -13,6 +13,8 @@ class GroupGroupLink < ApplicationRecord
validates :group_access, inclusion: { in: Gitlab::Access.all_values },
presence: true
+ scope :non_guests, -> { where('group_access > ?', Gitlab::Access::GUEST) }
+
def self.access_options
Gitlab::Access.options_with_owner
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 1f968cdfad1..4cd92b119b4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -786,6 +786,10 @@ class Project < ApplicationRecord
Feature.enabled?(:context_commits, default_enabled: true)
end
+ def jira_issues_import_feature_flag_enabled?
+ Feature.enabled?(:jira_issue_import, self)
+ end
+
def team
@team ||= ProjectTeam.new(self)
end
@@ -968,7 +972,7 @@ class Project < ApplicationRecord
end
def jira_import?
- import_type == 'jira' && latest_jira_import.present? && Feature.enabled?(:jira_issue_import, self)
+ import_type == 'jira' && latest_jira_import.present? && jira_issues_import_feature_flag_enabled?
end
def gitlab_project_import?
diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb
index b4071c6d4a6..f1c491d1a05 100644
--- a/app/models/project_group_link.rb
+++ b/app/models/project_group_link.rb
@@ -3,11 +3,6 @@
class ProjectGroupLink < ApplicationRecord
include Expirable
- GUEST = 10
- REPORTER = 20
- DEVELOPER = 30
- MAINTAINER = 40
-
belongs_to :project
belongs_to :group
@@ -18,6 +13,8 @@ class ProjectGroupLink < ApplicationRecord
validates :group_access, inclusion: { in: Gitlab::Access.values }, presence: true
validate :different_group
+ scope :non_guests, -> { where('group_access > ?', Gitlab::Access::GUEST) }
+
after_commit :refresh_group_members_authorized_projects
alias_method :shared_with_group, :group
@@ -27,7 +24,7 @@ class ProjectGroupLink < ApplicationRecord
end
def self.default_access
- DEVELOPER
+ Gitlab::Access::DEVELOPER
end
def self.search(query)