Make rubocop happy and use defined? when checking for reviewable_api_enabled
This commit is contained in:
parent
c882b097f8
commit
8ca446eeed
11
plugin.rb
11
plugin.rb
|
@ -35,19 +35,12 @@ after_initialize do
|
|||
- flagged-* connectors
|
||||
- flagged queue code inside the JS initializer
|
||||
=end
|
||||
reviewable_api_enabled = begin
|
||||
'Reviewable'.constantize
|
||||
true
|
||||
rescue NameError
|
||||
false
|
||||
end
|
||||
reviewable_api_enabled = defined?(Reviewable)
|
||||
|
||||
# Raise an invalid access error if a user tries to act on something
|
||||
# not assigned to them
|
||||
DiscourseEvent.on(:before_staff_flag_action) do |args|
|
||||
return if reviewable_api_enabled
|
||||
|
||||
if SiteSetting.assign_locks_flags?
|
||||
if !reviewable_api_enabled && SiteSetting.assign_locks_flags?
|
||||
|
||||
if custom_fields = args[:post].topic&.custom_fields
|
||||
if assigned_to_id = custom_fields[TopicAssigner::ASSIGNED_TO_ID]
|
||||
|
|
Loading…
Reference in New Issue