diff options
Diffstat (limited to 'app/models/integrations/shimo.rb')
-rw-r--r-- | app/models/integrations/shimo.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/integrations/shimo.rb b/app/models/integrations/shimo.rb index 4f42fda2577..0e1023bb7a7 100644 --- a/app/models/integrations/shimo.rb +++ b/app/models/integrations/shimo.rb @@ -5,7 +5,11 @@ module Integrations prop_accessor :external_wiki_url validates :external_wiki_url, presence: true, public_url: true, if: :activated? + after_commit :cache_project_has_shimo + def render? + return false unless Feature.enabled?(:shimo_integration, project) + valid? && activated? end @@ -43,5 +47,14 @@ module Integrations } ] end + + private + + def cache_project_has_shimo + return unless project && !project.destroyed? + + project.project_setting.save! unless project.project_setting.persisted? + project.project_setting.update_column(:has_shimo, activated?) + end end end |