diff options
author | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-11-21 20:54:19 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-12-08 08:43:08 +0100 |
commit | 9f2752e5dcc31dc4e9d91ee18caf1d36f1b7684e (patch) | |
tree | e40c621edbf2a0ee6dc9bd0e8ec7ea97d823e903 /lib | |
parent | 4beba7494b096f2540b19017bb7c1c8e91679135 (diff) | |
download | gitlab-ce-9f2752e5dcc31dc4e9d91ee18caf1d36f1b7684e.tar.gz |
Remove obsolete variables in `repository_push_email`
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/email/message/repository_push.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/gitlab/email/message/repository_push.rb b/lib/gitlab/email/message/repository_push.rb index 61962abf822..b0af3feee9e 100644 --- a/lib/gitlab/email/message/repository_push.rb +++ b/lib/gitlab/email/message/repository_push.rb @@ -5,6 +5,9 @@ module Gitlab attr_accessor :recipient attr_reader :author_id, :ref, :action + delegate :namespace, :name_with_namespace, to: :project, prefix: :project + delegate :name, to: :author, prefix: :author + def initialize(notify, project_id, recipient, opts = {}) raise ArgumentError, 'Missing options: author_id, ref, action' unless opts[:author_id] && opts[:ref] && opts[:action] @@ -35,10 +38,18 @@ module Gitlab @diffs ||= (compare.diffs if compare) end + def diffs_count + diffs.count if diffs + end + def compare @opts[:compare] end + def compare_timeout + compare.timeout if compare + end + def reverse_compare? @opts[:reverse_compare] || false end @@ -74,17 +85,17 @@ module Gitlab def target_url if @action == :push if commits.length > 1 && compare - @notify.namespace_project_compare_url(project.namespace, + @notify.namespace_project_compare_url(project_namespace, project, from: Commit.new(compare.base, project), to: Commit.new(compare.head, project)) else - @notify.namespace_project_commit_url(project.namespace, + @notify.namespace_project_commit_url(project_namespace, project, commits.first) end else unless @action == :delete - @notify.namespace_project_tree_url(project.namespace, + @notify.namespace_project_tree_url(project_namespace, project, ref_name) end end |