diff --git a/app/models/organization.rb b/app/models/organization.rb index 843c2b05f..4fd0886da 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -81,6 +81,12 @@ class Organization < Owner scope :with_visibility, ->(visibility) { joins(:organization_extension).where(organization_extensions: {visibility: visibility}) if visibility.present? } + after_save :reset_cache_data + + def reset_cache_data + Cache::V2::OwnerCommonService.new(self.login, self.mail).reset + end + def self.build(name, nickname, gitea_token=nil) self.create!(login: name, nickname: nickname, gitea_token: gitea_token) end diff --git a/app/models/user.rb b/app/models/user.rb index 7a172020c..ae20b83d3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -188,7 +188,8 @@ class User < Owner :show_email, :show_location, :show_department, :technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true - before_save :update_hashed_password, :set_lastname, :reset_cache_data + before_save :update_hashed_password, :set_lastname + after_save :reset_cache_data after_create do SyncTrustieJob.perform_later("user", 1) if allow_sync_to_trustie? end