forked from Trustie/forgeplus
Compare commits
13 Commits
a2ab42f392
...
27d73f0c11
Author | SHA1 | Date |
---|---|---|
![]() |
27d73f0c11 | |
|
a8f06eb022 | |
|
6598eb6b76 | |
|
c97188aff8 | |
|
7d466217c7 | |
|
d86d7f5d3e | |
|
a3517e651f | |
|
74706ab7a2 | |
|
f96bcfa162 | |
|
145463f967 | |
|
6a6698bc74 | |
|
41cbeae2f7 | |
|
9645f38e31 |
|
@ -55,21 +55,39 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController
|
|||
|
||||
def group_issues
|
||||
@enterprise_identifier = params[:enterprise_identifier] || ''
|
||||
@all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
|
||||
root_id = params[:root_id] || -1
|
||||
@weekly_begin_date = params[:weekly_begin_date] || Date.today.beginning_of_week.to_s
|
||||
@weekly_end_date = params[:weekly_end_date] || Date.today.end_of_week.to_s
|
||||
@all_issues = Issue.none
|
||||
if root_id.to_i == -1
|
||||
@all_issues = Issue.where(root_id: nil, enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
|
||||
elsif root_id.to_i.positive?
|
||||
@all_issues = Issue.where(root_id: root_id, enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
|
||||
else
|
||||
@all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
|
||||
end
|
||||
@all_issues = @all_issues.where(pm_project_id: params[:pm_project_ids].split(",")) if params[:pm_project_ids].present?
|
||||
@all_issues = @all_issues.where(pm_issue_type: params[:pm_issue_type].to_i) if params[:pm_issue_type].present?
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s)
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", @weekly_begin_date, @weekly_end_date)
|
||||
@this_week_all_issues = @this_week_all_issues.order('created_on desc')
|
||||
@this_week_all_issues = kaminari_paginate(@this_week_all_issues)
|
||||
end
|
||||
def personal_issues
|
||||
@enterprise_identifier = params[:enterprise_identifier] || ''
|
||||
return render_error('请输入正确的用户ID.') if params[:user_id].blank?
|
||||
@all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']})
|
||||
@weekly_begin_date = params[:weekly_begin_date] || Date.today.beginning_of_week.to_s
|
||||
@weekly_end_date = params[:weekly_end_date] || Date.today.end_of_week.to_s
|
||||
root_id = params[:root_id] || -1
|
||||
@all_issues = Issue.none
|
||||
if root_id.to_i == -1
|
||||
@all_issues = Issue.joins(:issue_participants).where(root_id: nil, issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']})
|
||||
else
|
||||
@all_issues = Issue.joins(:issue_participants).where(root_id: root_id, issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']})
|
||||
end
|
||||
@all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s).distinct
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", @weekly_begin_date, @weekly_end_date).distinct
|
||||
@this_week_all_issues = @this_week_all_issues.order('created_on desc')
|
||||
@next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s).distinct
|
||||
@next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (@weekly_begin_date.to_date+1.week).to_s, (@weekly_end_date.to_date+1.week).to_s).distinct
|
||||
@next_week_all_issues = @next_week_all_issues.order('created_on desc')
|
||||
this_week_page = params[:this_week_page] || 1
|
||||
this_week_limit = params[:this_week_limit] || 15
|
||||
|
|
|
@ -148,7 +148,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
|||
interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, del_content_params(sha).merge(identifier: @project.identifier))
|
||||
tip_exception(interactor.error) unless interactor.success?
|
||||
end
|
||||
Gitea::ActionRun.where(repo_id: @pipeline.project.gpid).destroy_all
|
||||
Gitea::ActionRun.where(repo_id: @pipeline.project.gpid, workflow_id: "#{@pipeline.pipeline_name}.yml").destroy_all
|
||||
@pipeline.destroy!
|
||||
end
|
||||
render_ok
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: tokens
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer default("0"), not null
|
||||
# action :string(30) default(""), not null
|
||||
# value :string(40) default(""), not null
|
||||
# created_on :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_tokens_on_user_id (user_id)
|
||||
# tokens_value (value) UNIQUE
|
||||
#
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: tokens
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer default("0"), not null
|
||||
# action :string(30) default(""), not null
|
||||
# value :string(40) default(""), not null
|
||||
# created_on :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_tokens_on_user_id (user_id)
|
||||
# tokens_value (value) UNIQUE
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
@ -50,7 +50,10 @@ class Token < ActiveRecord::Base
|
|||
token = Token.create(:user => user, :action => type)
|
||||
Rails.logger.info "###### Token.get_token_from_user is nul and agine create token: #{token&.value}"
|
||||
else
|
||||
token.update_attribute(:created_on, Time.now)
|
||||
unless Rails.cache.read("token::update::created_on::#{token.id}").present?
|
||||
token.update_attribute(:created_on, Time.now)
|
||||
Rails.cache.write("token::update::created_on::#{token.id}", true, expires_in: 5.minutes)
|
||||
end
|
||||
end
|
||||
token
|
||||
end
|
||||
|
|
|
@ -693,8 +693,9 @@ class User < Owner
|
|||
def self.try_to_autologin(key)
|
||||
user = Token.find_active_user('autologin', key)
|
||||
if user
|
||||
Rails.cache.fetch("user::update::last_login_on::#{user.id}",:expires_in => 5.minutes) do
|
||||
unless Rails.cache.read("user::update::last_login_on::#{user.id}").present?
|
||||
user.update(last_login_on: Time.now)
|
||||
Rails.cache.write("user::update::last_login_on::#{user.id}", true, expires_in: 5.minutes)
|
||||
end
|
||||
end
|
||||
user
|
||||
|
|
|
@ -35,6 +35,7 @@ class UserAction < ApplicationRecord
|
|||
when "DestroyProject" then "删除项目"
|
||||
when "Login" then "登录"
|
||||
when "Logout" then "退出登录"
|
||||
when "DestroyOrganization" then "删除组织"
|
||||
else self.action_type
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="box search-form-container user-list-form">
|
||||
<%= form_tag(admins_user_actions_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||
操作类型:
|
||||
<% action_type_options = [['自定义',''],['用户注销','DestroyUser'], ['删除项目', 'DestroyProject']] %>
|
||||
<% action_type_options = [['自定义',''],['用户注销','DestroyUser'], ['删除项目', 'DestroyProject'], ['删除组织', 'DestroyOrganization']] %>
|
||||
<%= select_tag(:action_type_select, options_for_select(action_type_options), class: 'form-control') %>
|
||||
<%= text_field_tag(:action_type, params[:action_type], class: 'form-control col-sm-2 ml-3',style: 'display:;', placeholder: '自定义操作类型检索') %>
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '操作人用户名/邮箱/手机号检索') %>
|
||||
|
|
Loading…
Reference in New Issue