fix: organization gitea_token read by associations

This commit is contained in:
yystopf 2022-04-18 10:52:48 +08:00
parent 2dfd69ae21
commit 8f5bb0e2d9
2 changed files with 5 additions and 1 deletions

View File

@ -83,6 +83,10 @@ class Organization < Owner
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

View File

@ -47,7 +47,7 @@ class Organizations::CreateService < ApplicationService
end
def create_org_and_extension
@organization = Organization.build(params[:name], params[:nickname], user.gitea_token)
@organization = Organization.build(params[:name], params[:nickname])
org_extension = OrganizationExtension.build(organization.id, description, website,
location, repo_admin_change_team_access,
visibility, max_repo_creation)