mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
f7d7092a7a
The lastest version of rubocop-discourse enables rules regarding plugins.
22 lines
546 B
Ruby
22 lines
546 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseNarrativeBot
|
|
module PostGuardianExtension
|
|
extend ActiveSupport::Concern
|
|
|
|
prepended do
|
|
alias_method :existing_can_create_post?, :can_create_post?
|
|
|
|
def can_create_post?(parent)
|
|
if SiteSetting.discourse_narrative_bot_enabled &&
|
|
parent.try(:subtype) == "system_message" &&
|
|
parent.try(:user) == ::DiscourseNarrativeBot::Base.new.discobot_user
|
|
return true
|
|
end
|
|
|
|
existing_can_create_post?(parent)
|
|
end
|
|
end
|
|
end
|
|
end
|