diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-05-12 16:47:45 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-05-16 14:52:04 -0500 |
commit | 020e616822f0e634932bf948013f94eb7ef413bb (patch) | |
tree | d70fc9d8e31bfabe636d99e492e015de2143d78f /app/models/event.rb | |
parent | 0ec2ee71b31ea604a677e28ffb84f3ded1701395 (diff) | |
download | gitlab-ce-020e616822f0e634932bf948013f94eb7ef413bb.tar.gz |
Reduce duplication and branching logic in EventsHelper
Remove unused methods from Event model
Diffstat (limited to 'app/models/event.rb')
-rw-r--r-- | app/models/event.rb | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index 2e9da42deaa..716039fb54b 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -266,18 +266,10 @@ class Event < ActiveRecord::Base branch? && project.default_branch != branch_name end - def note_commit_id - target.commit_id - end - def target_iid target.respond_to?(:iid) ? target.iid : target_id end - def note_short_commit_id - Commit.truncate_sha(note_commit_id) - end - def commit_note? target.for_commit? end @@ -302,12 +294,15 @@ class Event < ActiveRecord::Base end end - def note_target_iid - if note_target.respond_to?(:iid) - note_target.iid + def note_target_reference + return unless note_target + + # Commit#to_reference returns the full SHA, but we want the short one here + if commit_note? + note_target.short_id else - note_target_id - end.to_s + note_target.to_reference + end end def note_target_type |