Commit 20397091f10f4c00db7cfab7b8598b9a6b7fdec1
1 parent
608f3286
Exists in
master
and in
4 other branches
Show iid in event feed and uatocomplete as default id for issues, mr
Showing
4 changed files
with
7 additions
and
3 deletions
Show diff stats
app/assets/javascripts/gfm_auto_complete.js.coffee
| @@ -44,7 +44,7 @@ GitLab.GfmAutoComplete = | @@ -44,7 +44,7 @@ GitLab.GfmAutoComplete = | ||
| 44 | tpl: @Issues.template | 44 | tpl: @Issues.template |
| 45 | callbacks: | 45 | callbacks: |
| 46 | before_save: (issues) -> | 46 | before_save: (issues) -> |
| 47 | - $.map issues, (i) -> id: i.id, title: sanitize(i.title), search: "#{i.id} #{i.title}" | 47 | + $.map issues, (i) -> id: i.iid, title: sanitize(i.title), search: "#{i.iid} #{i.title}" |
| 48 | 48 | ||
| 49 | input.one "focus", => | 49 | input.one "focus", => |
| 50 | $.getJSON(@dataSource).done (data) -> | 50 | $.getJSON(@dataSource).done (data) -> |
app/models/event.rb
| @@ -256,6 +256,10 @@ class Event < ActiveRecord::Base | @@ -256,6 +256,10 @@ class Event < ActiveRecord::Base | ||
| 256 | target.commit_id | 256 | target.commit_id |
| 257 | end | 257 | end |
| 258 | 258 | ||
| 259 | + def target_iid | ||
| 260 | + target.respond_to?(:iid) ? target.iid : target_id | ||
| 261 | + end | ||
| 262 | + | ||
| 259 | def note_short_commit_id | 263 | def note_short_commit_id |
| 260 | note_commit_id[0..8] | 264 | note_commit_id[0..8] |
| 261 | end | 265 | end |
app/views/events/event/_common.html.haml
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | %span.author_name= link_to_author event | 2 | %span.author_name= link_to_author event |
| 3 | %span.event_label{class: event.action_name}= event_action_name(event) | 3 | %span.event_label{class: event.action_name}= event_action_name(event) |
| 4 | - if event.target | 4 | - if event.target |
| 5 | - %strong= link_to "##{event.target_id}", [event.project, event.target] | 5 | + %strong= link_to "##{event.target_iid}", [event.project, event.target] |
| 6 | - else | 6 | - else |
| 7 | %strong= gfm event.target_title | 7 | %strong= gfm event.target_title |
| 8 | at | 8 | at |
config/routes.rb
| @@ -281,7 +281,7 @@ Gitlab::Application.routes.draw do | @@ -281,7 +281,7 @@ Gitlab::Application.routes.draw do | ||
| 281 | end | 281 | end |
| 282 | end | 282 | end |
| 283 | 283 | ||
| 284 | - resources :issues, except: [:destroy] do | 284 | + resources :issues, constraints: {id: /\d+/}, except: [:destroy] do |
| 285 | collection do | 285 | collection do |
| 286 | post :bulk_update | 286 | post :bulk_update |
| 287 | end | 287 | end |