diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-19 22:53:11 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-19 22:53:11 +0300 |
commit | 434c034159f584348b56a322dbcda8dc65b812f2 (patch) | |
tree | f02615aa7f4e26f8468b4a990639f6da76e2a066 /app/models | |
parent | 20397091f10f4c00db7cfab7b8598b9a6b7fdec1 (diff) | |
download | gitlab-ce-434c034159f584348b56a322dbcda8dc65b812f2.tar.gz |
Iid improvemets
* call set_iid before validation
* make rake task pass event if objects are invalid
* show iid in comment event at dashboard
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/issuable.rb | 2 | ||||
-rw-r--r-- | app/models/event.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 158c226480f..fb08a5aa750 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -16,6 +16,7 @@ module Issuable validates :author, presence: true validates :title, presence: true, length: { within: 0..255 } + validate :set_iid, on: :create validates :iid, presence: true, numericality: true scope :authored, ->(user) { where(author_id: user) } @@ -25,7 +26,6 @@ module Issuable scope :unassigned, -> { where("assignee_id IS NULL") } scope :of_projects, ->(ids) { where(project_id: ids) } - validate :set_iid, on: :create delegate :name, :email, diff --git a/app/models/event.rb b/app/models/event.rb index 5839a834e78..702891f13dc 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -284,6 +284,14 @@ class Event < ActiveRecord::Base end end + def note_target_iid + if note_target.respond_to?(:iid) + note_target.iid + else + note_target_id + end.to_s + end + def wall_note? target.noteable_type.blank? end |