diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 15:09:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 15:09:47 +0300 |
commit | 8f9beefac3774b30e911fb00a68f4c7a5244cf27 (patch) | |
tree | 919c3a043f8c10bc3f78f3f6e029acfb6b972556 /app/models/project.rb | |
parent | e4bf776a8829e5186a0f63603c0be627b891d80e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index ffdd13b72d5..34c9c7320be 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -255,6 +255,8 @@ class Project < ApplicationRecord has_many :prometheus_metrics has_many :prometheus_alerts, inverse_of: :project + has_many :prometheus_alert_events, inverse_of: :project + has_many :self_managed_prometheus_alert_events, inverse_of: :project # Container repositories need to remove data from the container registry, # which is not managed by the DB. Hence we're still using dependent: :destroy @@ -349,7 +351,6 @@ class Project < ApplicationRecord delegate :members, to: :team, prefix: true delegate :add_user, :add_users, to: :team delegate :add_guest, :add_reporter, :add_developer, :add_maintainer, :add_role, to: :team - delegate :add_master, to: :team # @deprecated delegate :group_runners_enabled, :group_runners_enabled=, :group_runners_enabled?, to: :ci_cd_settings delegate :root_ancestor, to: :namespace, allow_nil: true delegate :last_pipeline, to: :commit, allow_nil: true @@ -591,9 +592,9 @@ class Project < ApplicationRecord # case-insensitive. # # query - The search query as a String. - def search(query) - if Feature.enabled?(:project_search_by_full_path, default_enabled: true) - joins(:route).fuzzy_search(query, [Route.arel_table[:path], :name, :description]) + def search(query, include_namespace: false) + if include_namespace && Feature.enabled?(:project_search_by_full_path, default_enabled: true) + joins(:route).fuzzy_search(query, [Route.arel_table[:path], Route.arel_table[:name], :description]) else fuzzy_search(query, [:path, :name, :description]) end |