[ADD]组织项目相关

This commit is contained in:
viletyy 2021-01-19 19:02:51 +08:00
parent 289d1877d6
commit fef43caf4c
5 changed files with 7 additions and 25 deletions

View File

@ -31,20 +31,4 @@ class Organizations::BaseController < ApplicationController
def project_mark
params[:repo_name] || params[:id]
end
def org_limited_condition
@organization.organization_extension.limited? && !current_user.logged?
end
def org_privacy_condition
@organization.organization_extension.privacy? && @organization.organization_users.where(user_id: current_user.id).blank?
end
def team_not_found_condition
@team.team_users.where(user_id: current_user.id).blank? && !@organization.is_owner?(current_user)
end
def user_mark
params[:username] || params[:id]
end
end

View File

@ -31,7 +31,6 @@ class Organizations::OrganizationsController < Organizations::BaseController
end
def update
tip_exception("您没有权限进行该操作") unless @organization.is_owner?(current_user)
ActiveRecord::Base.transaction do
login = @organization.login
@organization.update!(login: organization_params[:name]) if organization_params[:name].present?

View File

@ -11,7 +11,10 @@ class Organizations::TeamProjectsController < Organizations::BaseController
end
def create
<<<<<<< HEAD
tip_exception("该组织团队项目包括组织所有项目,不允许更改") if @team.includes_all_project
=======
>>>>>>> ceda008... [ADD]
ActiveRecord::Base.transaction do
@team_project = TeamProject.build(@organization.id, @team.id, @operate_project.id)
Gitea::Organization::TeamProject::CreateService.call(@organization.gitea_token, @team.gtid, @organization.login, @operate_project.identifier)
@ -47,7 +50,11 @@ class Organizations::TeamProjectsController < Organizations::BaseController
end
def load_operate_project
<<<<<<< HEAD
@operate_project = Project.find_by(id: project_mark) || Project.find_by(identifier: project_mark)
=======
@operate_project = Project.find_by(name: params[:id]) || Project.find_by(identifier: params[:id])
>>>>>>> ceda008... [ADD]
tip_exception("项目不存在") if @operate_project.nil?
end

View File

@ -31,8 +31,4 @@ class OrganizationUser < ApplicationRecord
def teams
organization.teams.joins(:team_users).where(team_users: {user_id: user_id})
end
def teams
organization.teams.joins(:team_users).where(team_users: {user_id: user_id})
end
end

View File

@ -65,11 +65,7 @@ class Organizations::Teams::CreateService < ApplicationService
end
def create_gitea_team
<<<<<<< HEAD
@gitea_team = Gitea::Organization::Team::CreateService.call(org.gitea_token, org, team)
=======
@gitea_team = Gitea::Organization::Team::CreateService.call(user.gitea_token, org, team)
>>>>>>> 4a50873... [ADD]
end
def sync_team_gtid