diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-29 01:57:42 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-29 01:57:42 +0300 |
commit | ce1843b7dea3b63cfced7800612098a766c68e13 (patch) | |
tree | 3340c4b5aca30047c2e22986c15f355bf3f845fe /app/helpers/notes_helper.rb | |
parent | 8b1a2e4d0b635c6040cd7e4a7a5870ffae516cb0 (diff) | |
parent | b9b0c0283a001010370741c2683e2fe400bf7599 (diff) |
Merge branch 'master' into diff-line-comment-vuejs
# Conflicts:
# db/schema.rb
Diffstat (limited to 'app/helpers/notes_helper.rb')
-rw-r--r-- | app/helpers/notes_helper.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index 87bf84adad1..9d9b0dba57f 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -7,7 +7,7 @@ module NotesHelper end def note_editable?(note) - note.editable? && can?(current_user, :admin_note, note) + Ability.can_edit_note?(current_user, note) end def noteable_json(noteable) @@ -85,14 +85,13 @@ module NotesHelper data: data, title: 'Add a reply' end - def note_max_access_for_user(note) - @max_access_by_user_id ||= Hash.new do |hash, key| - project = key[:project] - hash[key] = project.team.human_max_access(key[:user_id]) - end + def preload_max_access_for_authors(notes, project) + user_ids = notes.map(&:author_id) + project.team.max_member_access_for_user_ids(user_ids) + end - full_key = { project: note.project, user_id: note.author_id } - @max_access_by_user_id[full_key] + def note_max_access_for_user(note) + note.project.team.human_max_access(note.author_id) end def discussion_diff_path(discussion) |