From fef43caf4c4b1572a27886b73f01942a51a13ce1 Mon Sep 17 00:00:00 2001 From: viletyy Date: Tue, 19 Jan 2021 19:02:51 +0800 Subject: [PATCH] =?UTF-8?q?[ADD]=E7=BB=84=E7=BB=87=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations/base_controller.rb | 16 ---------------- .../organizations/organizations_controller.rb | 1 - .../organizations/team_projects_controller.rb | 7 +++++++ app/models/organization_user.rb | 4 ---- .../organizations/teams/create_service.rb | 4 ---- 5 files changed, 7 insertions(+), 25 deletions(-) diff --git a/app/controllers/organizations/base_controller.rb b/app/controllers/organizations/base_controller.rb index 8bd4b2dd4..2e8ae0cf9 100644 --- a/app/controllers/organizations/base_controller.rb +++ b/app/controllers/organizations/base_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/organizations/organizations_controller.rb b/app/controllers/organizations/organizations_controller.rb index 2236d95bb..428948a73 100644 --- a/app/controllers/organizations/organizations_controller.rb +++ b/app/controllers/organizations/organizations_controller.rb @@ -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? diff --git a/app/controllers/organizations/team_projects_controller.rb b/app/controllers/organizations/team_projects_controller.rb index f221c98db..1af476b83 100644 --- a/app/controllers/organizations/team_projects_controller.rb +++ b/app/controllers/organizations/team_projects_controller.rb @@ -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 diff --git a/app/models/organization_user.rb b/app/models/organization_user.rb index 1bf328f19..cf9e22371 100644 --- a/app/models/organization_user.rb +++ b/app/models/organization_user.rb @@ -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 diff --git a/app/services/organizations/teams/create_service.rb b/app/services/organizations/teams/create_service.rb index 867d41b12..81ad78772 100644 --- a/app/services/organizations/teams/create_service.rb +++ b/app/services/organizations/teams/create_service.rb @@ -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