summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-25 09:06:04 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-25 09:06:04 +0000
commit1cfd8874ee6702184d5608f533b30bab722b4f9d (patch)
tree4921070efdc0ad2d1c3c7d8a3a60c73928b57d25 /app/models/namespace.rb
parentfbcb36880cda3a29cfa4ebed4d080701c302256b (diff)
downloadgitlab-ce-1cfd8874ee6702184d5608f533b30bab722b4f9d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 9a7c3dc03c3..fb90ddc1048 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -120,6 +120,13 @@ class Namespace < ApplicationRecord
uniquify = Uniquify.new
uniquify.string(path) { |s| Namespace.find_by_path_or_name(s) }
end
+
+ def find_by_pages_host(host)
+ gitlab_host = "." + Settings.pages.host.downcase
+ name = host.downcase.delete_suffix(gitlab_host)
+
+ Namespace.find_by_full_path(name)
+ end
end
def visibility_level_field
@@ -305,8 +312,16 @@ class Namespace < ApplicationRecord
aggregation_schedule.present?
end
+ def pages_virtual_domain
+ Pages::VirtualDomain.new(all_projects_with_pages, trim_prefix: full_path)
+ end
+
private
+ def all_projects_with_pages
+ all_projects.with_pages_deployed
+ end
+
def parent_changed?
parent_id_changed?
end