2012-12-14 20:39:55 +01:00
|
|
|
module NoteEvent
|
|
|
|
def note_commit_id
|
2012-12-18 19:02:00 +01:00
|
|
|
target.commit_id
|
2012-12-14 20:39:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def note_short_commit_id
|
|
|
|
note_commit_id[0..8]
|
|
|
|
end
|
|
|
|
|
|
|
|
def note_commit?
|
|
|
|
target.noteable_type == "Commit"
|
|
|
|
end
|
|
|
|
|
|
|
|
def note_target
|
|
|
|
target.noteable
|
|
|
|
end
|
|
|
|
|
|
|
|
def note_target_id
|
2012-12-18 19:02:00 +01:00
|
|
|
if note_commit?
|
|
|
|
target.commit_id
|
|
|
|
else
|
|
|
|
target.noteable_id.to_s
|
|
|
|
end
|
2012-12-14 20:39:55 +01:00
|
|
|
end
|
2012-12-16 18:52:39 +01:00
|
|
|
|
|
|
|
def wall_note?
|
|
|
|
target.noteable_type.blank?
|
|
|
|
end
|
|
|
|
|
|
|
|
def note_target_type
|
|
|
|
if target.noteable_type.present?
|
|
|
|
target.noteable_type.titleize
|
|
|
|
else
|
|
|
|
"Wall"
|
|
|
|
end.downcase
|
|
|
|
end
|
2012-12-14 20:39:55 +01:00
|
|
|
end
|