This commit is contained in:
yystopf 2021-10-27 11:03:34 +08:00
parent c019766df2
commit 01f99a2f12
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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