diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 12:09:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 12:09:52 +0000 |
commit | 8ae26d705abe341b03bc15d4373d6cd0c77c0baf (patch) | |
tree | 655ee03a968e340c975b8ab7d77cfd5ceaf3c969 /lib/gitlab/checks | |
parent | fc1df8c8307fc5022f9e8aae04164c089d8fdf2e (diff) | |
download | gitlab-ce-8ae26d705abe341b03bc15d4373d6cd0c77c0baf.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r-- | lib/gitlab/checks/post_push_message.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/checks/project_moved.rb | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/lib/gitlab/checks/post_push_message.rb b/lib/gitlab/checks/post_push_message.rb index 492dbb5a596..b3c981d252b 100644 --- a/lib/gitlab/checks/post_push_message.rb +++ b/lib/gitlab/checks/post_push_message.rb @@ -3,8 +3,8 @@ module Gitlab module Checks class PostPushMessage - def initialize(project, user, protocol) - @project = project + def initialize(repository, user, protocol) + @repository = repository @user = user @protocol = protocol end @@ -34,14 +34,21 @@ module Gitlab protected - attr_reader :project, :user, :protocol + attr_reader :repository, :user, :protocol + + delegate :project, to: :repository, allow_nil: true + delegate :container, to: :repository, allow_nil: false def self.message_key(user_id, project_id) raise NotImplementedError end def url_to_repo - protocol == 'ssh' ? project.ssh_url_to_repo : project.http_url_to_repo + protocol == 'ssh' ? message_subject.ssh_url_to_repo : message_subject.http_url_to_repo + end + + def message_subject + repository.repo_type.wiki? ? project.wiki : container end end end diff --git a/lib/gitlab/checks/project_moved.rb b/lib/gitlab/checks/project_moved.rb index 6f04fddc6c4..4cc35de9c2d 100644 --- a/lib/gitlab/checks/project_moved.rb +++ b/lib/gitlab/checks/project_moved.rb @@ -5,10 +5,10 @@ module Gitlab class ProjectMoved < PostPushMessage REDIRECT_NAMESPACE = "redirect_namespace" - def initialize(project, user, protocol, redirected_path) + def initialize(repository, user, protocol, redirected_path) @redirected_path = redirected_path - super(project, user, protocol) + super(repository, user, protocol) end def message |