Merge branch 'standalone_develop' into pm_project_develop

This commit is contained in:
xxq250 2024-04-29 11:11:18 +08:00
commit 0a2ab5eddc
3 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ class Admins::ProjectsController < Admins::BaseController
sort_by = Project.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_on'
sort_direction = %w(desc asc).include?(params[:sort_direction]) ? params[:sort_direction] : 'desc'
search = params[:search].to_s.strip
projects = Project.where("name like ?", "%#{search}%").order("#{sort_by} #{sort_direction}")
projects = Project.where("name like ? OR identifier LIKE ?", "%#{search}%", "%#{search}%").order("#{sort_by} #{sort_direction}")
@projects = paginate projects.includes(:owner, :members, :issues, :versions, :attachments, :project_score)
end

View File

@ -67,10 +67,11 @@ class Organizations::TeamsController < Organizations::BaseController
tip_exception("组织团队不允许被删除") if @team.owner?
ActiveRecord::Base.transaction do
Gitea::Organization::Team::DeleteService.call(@organization.gitea_token, @team.gtid)
all_user_ids = @organization.team_users.pluck(:user_id)
other_user_ids = @organization.team_users.where.not(team_id: @team.id).pluck(:user_id)
team_user_ids = @team.team_users.pluck(:user_id)
# 当前删除团队中成员在其他组织其他团队不存在的成员需清除组织
remove_user_ids = team_user_ids - all_user_ids
remove_user_ids = team_user_ids - other_user_ids
Rails.logger.info "remove_user_ids ===========> #{remove_user_ids}"
@team.destroy!
if remove_user_ids.present?
User.where(id: remove_user_ids).each do |user|

View File

@ -4,7 +4,7 @@
<div class="box search-form-container project-list-form">
<%= form_tag(admins_projects_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<%= text_field_tag(:search, params[:search], class: 'form-control col-12 col-md-2 mr-3', placeholder: '项目名称检索') %>
<%= text_field_tag(:search, params[:search], class: 'form-control col-12 col-md-2 mr-3', placeholder: '项目名称/标识检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
<% end %>