0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-24 10:20:28 +01:00
discourse-custom-wizard/lib/custom_wizard/extensions/guardian.rb

18 Zeilen
373 B
Ruby

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