diff options
author | James Lopez <james@jameslopez.es> | 2016-06-16 14:07:49 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-16 14:07:49 +0200 |
commit | 2a747d386dbdc05453fce6b8be3f483e8cd9e796 (patch) | |
tree | 5530f2fb8856c4e29a33afb128843108e2bb5834 /app/models/note.rb | |
parent | 862b359b9a3f271b23f393932fb0e85d65c56c6b (diff) | |
parent | 778d72664f386dfee45dab171f137395739958f6 (diff) | |
download | gitlab-ce-2a747d386dbdc05453fce6b8be3f483e8cd9e796.tar.gz |
fixed merge conflicts
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index a51dce410c9..8d164647550 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -89,22 +89,9 @@ class Note < ActiveRecord::Base table = arel_table pattern = "%#{query}%" - found_notes = joins('LEFT JOIN issues ON issues.id = noteable_id'). - where(table[:note].matches(pattern)) - - if as_user - found_notes.where(' - issues.confidential IS NULL - OR issues.confidential IS FALSE - OR (issues.confidential IS TRUE - AND (issues.author_id = :user_id - OR issues.assignee_id = :user_id - OR issues.project_id IN(:project_ids)))', - user_id: as_user.id, - project_ids: as_user.authorized_projects.select(:id)) - else - found_notes.where('issues.confidential IS NULL OR issues.confidential IS FALSE') - end + Note.joins('LEFT JOIN issues ON issues.id = noteable_id'). + where(table[:note].matches(pattern)). + merge(Issue.visible_to_user(as_user)) end end @@ -201,6 +188,10 @@ class Note < ActiveRecord::Base award_emoji_supported? && contains_emoji_only? end + def emoji_awardable? + !system? + end + def clear_blank_line_code! self.line_code = nil if self.line_code.blank? end |