Merge branch 'standalone_develop' into pm_project_develop
This commit is contained in:
commit
0a2ab5eddc
|
@ -5,7 +5,7 @@ class Admins::ProjectsController < Admins::BaseController
|
||||||
sort_by = Project.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_on'
|
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'
|
sort_direction = %w(desc asc).include?(params[:sort_direction]) ? params[:sort_direction] : 'desc'
|
||||||
search = params[:search].to_s.strip
|
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)
|
@projects = paginate projects.includes(:owner, :members, :issues, :versions, :attachments, :project_score)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,11 @@ class Organizations::TeamsController < Organizations::BaseController
|
||||||
tip_exception("组织团队不允许被删除") if @team.owner?
|
tip_exception("组织团队不允许被删除") if @team.owner?
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
Gitea::Organization::Team::DeleteService.call(@organization.gitea_token, @team.gtid)
|
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)
|
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!
|
@team.destroy!
|
||||||
if remove_user_ids.present?
|
if remove_user_ids.present?
|
||||||
User.where(id: remove_user_ids).each do |user|
|
User.where(id: remove_user_ids).each do |user|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<div class="box search-form-container project-list-form">
|
<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 %>
|
<%= 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': '搜索中...') %>
|
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||||
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
|
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue