summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-06-16 13:04:00 +0200
committerJames Lopez <james@jameslopez.es>2016-06-16 13:04:00 +0200
commit778d72664f386dfee45dab171f137395739958f6 (patch)
tree7f2c902f4b97ac29aa97e96e877da201130a33b3 /app/models/note.rb
parent452c076a34cc11cc97f4b1c3113e86ce4367e055 (diff)
parentc369cc8bf42a680b2b0fc9721a9a7926dc5426f6 (diff)
downloadgitlab-ce-778d72664f386dfee45dab171f137395739958f6.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into feature/project-exportfeature/project-export
# Conflicts: # app/models/ci/pipeline.rb
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb23
1 files changed, 7 insertions, 16 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 585d8c4ad84..4b6748053ff 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -88,22 +88,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
@@ -200,6 +187,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