add: undo_join_projects

This commit is contained in:
vilet.yy 2021-06-10 10:49:26 +08:00
parent 5489ea9fbc
commit 77c1b1e188
2 changed files with 4 additions and 1 deletions

View File

@ -28,13 +28,15 @@ class UsersController < ApplicationController
def show
#待办事项,现在未做
if User.current.login == @user.login
if User.current.admin? || User.current.login == @user.login
@waiting_applied_messages = @user.applied_messages.waiting
@common_applied_transfer_projects = AppliedTransferProject.where(owner_id: @user.id).common + AppliedTransferProject.where(owner_id: Organization.joins(team_users: :team).where(team_users: {user_id: @user.id}, teams: {authorize: %w(admin owner)} )).common
@common_applied_projects = AppliedProject.where(project_id: @user.full_admin_projects).common
@undo_events = @waiting_applied_messages.size + @common_applied_transfer_projects.size
else
@waiting_applied_messages = AppliedMessage.none
@common_applied_transfer_projects = AppliedTransferProject.none
@common_applied_projects = AppliedProject.none
@undo_events = 0
end
#用户的组织数量

View File

@ -1,6 +1,7 @@
json.partial! 'users/user', locals: { user: @user }
json.undo_messages @waiting_applied_messages.size
json.undo_transfer_projects @common_applied_transfer_projects.size
json.undo_join_projects @common_applied_projects.size
json.undo_events @undo_events
json.user_composes_count @user_composes_count
json.user_org_count @user_org_count