DEV: Update rubocop-discourse to latest version

The lastest version of rubocop-discourse enables rules regarding
plugins.
This commit is contained in:
Loïc Guitaut
2024-02-01 17:28:10 +01:00
committed by Loïc Guitaut
parent 7a6ba47e7b
commit f7d7092a7a
27 changed files with 169 additions and 118 deletions

View File

@ -0,0 +1,21 @@
# 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