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

16 Zeilen
363 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
(
2024-10-16 13:52:03 +02:00
is_my_own?(topic) && created_by_wizard && can_see_topic?(topic) &&
can_create_post_on_topic?(topic)
2022-01-31 08:20:20 +01:00
)
2021-10-19 05:35:55 +02:00
end
end