diff --git a/app/controllers/organizations/organizations_controller.rb b/app/controllers/organizations/organizations_controller.rb index 58aa0d29d..0ae113590 100644 --- a/app/controllers/organizations/organizations_controller.rb +++ b/app/controllers/organizations/organizations_controller.rb @@ -31,6 +31,7 @@ class Organizations::OrganizationsController < Organizations::BaseController Organizations::CreateForm.new(organization_params.merge(original_name: "")).validate! @organization = Organizations::CreateService.call(current_user, organization_params) Util.write_file(@image, avatar_path(@organization)) if params[:image].present? + Cache::V2::OwnerCommonService.new(@organization.id).reset end rescue Exception => e uid_logger_error(e.message) @@ -48,6 +49,7 @@ class Organizations::OrganizationsController < Organizations::BaseController Gitea::Organization::UpdateService.call(current_user.gitea_token, login, @organization.reload) Util.write_file(@image, avatar_path(@organization)) if params[:image].present? + Cache::V2::OwnerCommonService.new(@organization.id).reset end rescue Exception => e uid_logger_error(e.message) diff --git a/app/models/organization.rb b/app/models/organization.rb index 56351a415..adf43a2cd 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -81,15 +81,15 @@ class Organization < Owner scope :with_visibility, ->(visibility) { joins(:organization_extension).where(organization_extensions: {visibility: visibility}) if visibility.present? } - after_save :reset_cache_data + # after_save :reset_cache_data def gitea_token team_users.joins(:team).where(teams: {authorize: "owner"}).take&.user&.gitea_token end - def reset_cache_data - Cache::V2::OwnerCommonService.new(self.id).reset - end + # def reset_cache_data + # Cache::V2::OwnerCommonService.new(self.id).reset + # end def self.build(name, nickname, gitea_token=nil) self.create!(login: name, nickname: nickname, gitea_token: gitea_token)