diff options
| author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-12-23 01:03:57 +0100 |
|---|---|---|
| committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-12-23 01:03:57 +0100 |
| commit | db2c15369c365340aeaf4e431e8838714b40396b (patch) | |
| tree | 26ca045a337132370b67cc8f2ed4010e3087dfa5 /app/roles/note_event.rb | |
| parent | b47173da6a0fea0982d009f91e2c4d042f9b5c37 (diff) | |
| parent | 68c43d59f09a66cca0da1b9a50c11421d52eac9a (diff) | |
| download | gitlab-ce-db2c15369c365340aeaf4e431e8838714b40396b.tar.gz | |
Merge branch 'master' into discussions
Conflicts:
app/assets/stylesheets/main.scss
app/models/project.rb
app/views/notes/_common_form.html.haml
app/views/notes/_per_line_form.html.haml
lib/gitlab/markdown.rb
spec/models/note_spec.rb
Diffstat (limited to 'app/roles/note_event.rb')
| -rw-r--r-- | app/roles/note_event.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/app/roles/note_event.rb b/app/roles/note_event.rb new file mode 100644 index 00000000000..db4ced0c095 --- /dev/null +++ b/app/roles/note_event.rb @@ -0,0 +1,37 @@ +module NoteEvent + def note_commit_id + target.commit_id + 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 + if note_commit? + target.commit_id + else + target.noteable_id.to_s + end + end + + 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 +end |
