Commit 6286b28b authored by Robert Speicher's avatar Robert Speicher

Add an Event's target's title to its reference link

Given an activity feed entry like:

> Douwe Maan commented on [issue #123] at [gitlab-org/gitlab-ce]

...the `issue #123` link will now have a `title` attribute.
parent a511a122
...@@ -162,7 +162,7 @@ module EventsHelper ...@@ -162,7 +162,7 @@ module EventsHelper
"#{event.note_target_type} #{truncate event.note_target.to_reference}" "#{event.note_target_type} #{truncate event.note_target.to_reference}"
end end
else else
link_to event_note_target_path(event) do link_to event_note_target_path(event), title: event.target_title do
"#{event.note_target_type} #{truncate event.note_target.to_reference}" "#{event.note_target_type} #{truncate event.note_target.to_reference}"
end end
end end
......
...@@ -80,7 +80,7 @@ class Event < ActiveRecord::Base ...@@ -80,7 +80,7 @@ class Event < ActiveRecord::Base
end end
def target_title def target_title
target.title if target && target.respond_to?(:title) target.try(:title)
end end
def created? def created?
......
...@@ -19,6 +19,7 @@ class Note < ActiveRecord::Base ...@@ -19,6 +19,7 @@ class Note < ActiveRecord::Base
delegate :gfm_reference, :local_reference, to: :noteable delegate :gfm_reference, :local_reference, to: :noteable
delegate :name, to: :project, prefix: true delegate :name, to: :project, prefix: true
delegate :name, :email, to: :author, prefix: true delegate :name, :email, to: :author, prefix: true
delegate :title, to: :noteable, allow_nil: true
before_validation :set_award! before_validation :set_award!
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= event_action_name(event) = event_action_name(event)
- if event.target - if event.target
%strong= link_to event.target.reference_link_text, [event.project.namespace.becomes(Namespace), event.project, event.target] %strong= link_to event.target.reference_link_text, [event.project.namespace.becomes(Namespace), event.project, event.target], title: event.target_title
= event_preposition(event) = event_preposition(event)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment