mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 04:35:45 +08:00
[ADD]组织、组织团队
This commit is contained in:
@@ -32,12 +32,19 @@ class Organizations::BaseController < ApplicationController
|
||||
params[:repo_name] || params[:id]
|
||||
end
|
||||
|
||||
private
|
||||
def limited_condition
|
||||
def org_limited_condition
|
||||
@organization.organization_extension.limited? && !current_user.logged?
|
||||
end
|
||||
|
||||
def privacy_condition
|
||||
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
|
||||
@@ -11,7 +11,6 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
||||
@organizations = Organization.from("( #{ logged_organizations_sql } UNION #{ privacy_organizations_sql } ) AS users")
|
||||
else
|
||||
@organizations = Organization.with_visibility("common")
|
||||
kaminari_paginate(@organizations)
|
||||
end
|
||||
@organizations = @organizations.ransack(login_cont: params[:search]).result if params[:search].present?
|
||||
@organizations = @organizations.includes(:organization_extension).order("organization_extensions.#{sort_by} #{sort_direction}")
|
||||
@@ -32,6 +31,7 @@ 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?
|
||||
|
||||
Reference in New Issue
Block a user