Merge pull request #5180 from okriuchykhin/ok_SCI_8174

Fix create step comments permissions [SCI-8174]
This commit is contained in:
Alex Kriuchykhin 2023-03-22 13:42:54 +01:00 committed by GitHub
commit b29d4724a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -102,9 +102,9 @@ class CommentsController < ApplicationController
when MyModule
render_403 and return unless can_create_my_module_comments?(@commentable)
when Step
render_403 and return unless can_create_my_module_comments?(@commentable.protocol.my_module)
render_403 and return unless can_create_comments_in_my_module_steps?(@commentable.protocol.my_module)
when Result
render_403 and return unless can_create_my_module_comments?(@commentable.my_module)
render_403 and return unless can_create_my_module_result_comments?(@commentable.my_module)
else
render_403 and return
end

View file

@ -62,9 +62,9 @@ module CommentHelper
when 'MyModule'
can_create_my_module_comments?(object)
when 'Step'
can_create_my_module_comments?(object.my_module)
can_create_comments_in_my_module_steps?(object.my_module)
when 'Result'
can_create_my_module_comments?(object.my_module)
can_create_my_module_result_comments?(object.my_module)
when 'Project'
can_create_project_comments?(object)
else

View file

@ -10,7 +10,7 @@
<%= render partial: 'shared/comments/comments.html.erb', locals: {
object: step,
comments: comments,
can_create_comments: can_create_my_module_comments?(@protocol.my_module),
can_create_comments: can_create_comments_in_my_module_steps?(@protocol.my_module),
create_url: step_step_comments_path(step, format: :json),
more_url: step_step_comments_path(step, format: :json, from: comments.first&.id)
} %>