0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2025-02-02 11:27:01 +01:00
discourse-custom-wizard/extensions/guardian.rb

18 Zeilen
373 B
Ruby

2021-10-19 09:05:55 +05:30
# frozen_string_literal: true
2022-01-31 12:50:20 +05:30
module CustomWizardGuardian
2021-10-19 09:05:55 +05:30
def can_edit_topic?(topic)
2022-01-31 12:50:20 +05:30
wizard_can_edit_topic?(topic) || super
2021-10-19 09:05:55 +05:30
end
2022-01-31 12:50:20 +05:30
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 09:05:55 +05:30
end
end