From 383660c778ee1bc08f86e587613583559d4fa829 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 15 Sep 2022 09:38:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=BF=A1=E6=81=AF=E6=96=B9=E5=BC=8F=E6=94=B9?= =?UTF-8?q?=E5=9C=A8=E6=8E=A7=E5=88=B6=E5=99=A8=E9=87=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations/organizations_controller.rb | 2 ++ app/models/organization.rb | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) 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)