Commit 20397091f10f4c00db7cfab7b8598b9a6b7fdec1

Authored by Dmitriy Zaporozhets
1 parent 608f3286

Show iid in event feed and uatocomplete as default id for issues, mr

app/assets/javascripts/gfm_auto_complete.js.coffee
... ... @@ -44,7 +44,7 @@ GitLab.GfmAutoComplete =
44 44 tpl: @Issues.template
45 45 callbacks:
46 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 49 input.one "focus", =>
50 50 $.getJSON(@dataSource).done (data) ->
... ...
app/models/event.rb
... ... @@ -256,6 +256,10 @@ class Event < ActiveRecord::Base
256 256 target.commit_id
257 257 end
258 258  
  259 + def target_iid
  260 + target.respond_to?(:iid) ? target.iid : target_id
  261 + end
  262 +
259 263 def note_short_commit_id
260 264 note_commit_id[0..8]
261 265 end
... ...
app/views/events/event/_common.html.haml
... ... @@ -2,7 +2,7 @@
2 2 %span.author_name= link_to_author event
3 3 %span.event_label{class: event.action_name}= event_action_name(event)
4 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 6 - else
7 7 %strong= gfm event.target_title
8 8 at
... ...
config/routes.rb
... ... @@ -281,7 +281,7 @@ Gitlab::Application.routes.draw do
281 281 end
282 282 end
283 283  
284   - resources :issues, except: [:destroy] do
  284 + resources :issues, constraints: {id: /\d+/}, except: [:destroy] do
285 285 collection do
286 286 post :bulk_update
287 287 end
... ...