2018-07-24 06:00:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-16 14:32:08 -04:00
|
|
|
class MergeRequestPolicy < IssuablePolicy
|
2019-03-08 03:34:20 -05:00
|
|
|
rule { locked }.policy do
|
|
|
|
prevent :reopen_merge_request
|
|
|
|
end
|
2019-06-04 23:30:54 -04:00
|
|
|
|
|
|
|
# Only users who can read the merge request can comment.
|
|
|
|
# Although :read_merge_request is computed in the policy context,
|
|
|
|
# it would not be safe to prevent :create_note there, since
|
|
|
|
# note permissions are shared, and this would apply too broadly.
|
|
|
|
rule { ~can?(:read_merge_request) }.prevent :create_note
|
2016-08-16 14:32:08 -04:00
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
MergeRequestPolicy.prepend_if_ee('EE::MergeRequestPolicy')
|