2021-10-19 05:35:55 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-01-31 08:20:20 +01:00
|
|
|
module CustomWizardGuardian
|
2021-10-19 05:35:55 +02:00
|
|
|
def can_edit_topic?(topic)
|
2022-01-31 08:20:20 +01:00
|
|
|
wizard_can_edit_topic?(topic) || super
|
2021-10-19 05:35:55 +02:00
|
|
|
end
|
|
|
|
|
2022-01-31 08:20:20 +01:00
|
|
|
def wizard_can_edit_topic?(topic)
|
|
|
|
created_by_wizard = !!topic.wizard_submission_id
|
|
|
|
(
|
|
|
|
is_my_own?(topic) &&
|
|
|
|
created_by_wizard &&
|
|
|
|
can_see_topic?(topic) &&
|
|
|
|
can_create_post_on_topic?(topic)
|
|
|
|
)
|
2021-10-19 05:35:55 +02:00
|
|
|
end
|
|
|
|
end
|