Skip to content
Snippets Groups Projects
Commit 6286b28b authored by Robert Speicher's avatar Robert Speicher
Browse files

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
No related branches found
No related tags found
1 merge request!4090Add an Event's target's title to its reference link
Loading
@@ -162,7 +162,7 @@ module EventsHelper
Loading
@@ -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
Loading
Loading
Loading
@@ -80,7 +80,7 @@ class Event < ActiveRecord::Base
Loading
@@ -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?
Loading
Loading
Loading
@@ -19,6 +19,7 @@ class Note < ActiveRecord::Base
Loading
@@ -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!
   
Loading
Loading
Loading
@@ -4,7 +4,7 @@
Loading
@@ -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)
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment