forked from Trustie/forgeplus
Merge branch 'standalone_develop' into dev_local_v1
This commit is contained in:
commit
e4498a4970
|
|
@ -289,6 +289,13 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
|||
render_not_found('疑修不存在!') if @issue.blank?
|
||||
end
|
||||
|
||||
# def load_issue_by_index
|
||||
# return render_parameter_missing if params[:pm_project_id].blank? || params[:pm_issue_type].blank? || params[:enterprise_identifier].blank?
|
||||
# @issue = Issue.find_issues_by_pm(params[:enterprise_identifier], params[:pm_issue_type])
|
||||
# .find_by(pm_issue_type_index3: params[:index])
|
||||
# render_not_found('疑修不存在!') if @issue.blank?
|
||||
# end
|
||||
|
||||
def load_issues
|
||||
return render_error('请输入正确的ID数组!') unless params[:ids].is_a?(Array)
|
||||
params[:ids].each do |id|
|
||||
|
|
@ -327,6 +334,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
|||
:branch_name, :start_date, :due_date, :time_scale,
|
||||
:subject, :description, :blockchain_token_num, :root_subject,
|
||||
:pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id, :project_id,
|
||||
:status_msg, :enterprise_identifier,
|
||||
issue_tag_ids: [],
|
||||
assigner_ids: [],
|
||||
attachment_ids: [],
|
||||
|
|
|
|||
|
|
@ -32,18 +32,8 @@ module LaboratoryHelper
|
|||
end
|
||||
|
||||
def default_course_links
|
||||
# my_projects: "/users/#{current_user.try(:login)}/projects",
|
||||
# my_projects: "https://www.trustie.net/users/#{current_user.try(:login)}/user_projectlist",
|
||||
{
|
||||
new_syllabuses: "https://www.trustie.net/syllabuses/new",
|
||||
new_course: "https://www.trustie.net/courses/new",
|
||||
edit_account: "https://www.trustie.net/my/account",
|
||||
my_courses: "https://www.trustie.net/users/#{current_user.try(:login)}/user_courselist",
|
||||
my_projects: "/users/#{current_user.try(:login)}/projects",
|
||||
my_organ: "https://www.trustie.net/users/#{current_user.try(:login)}/user_organizations",
|
||||
default_url: Rails.application.config_for(:configuration)['platform_url'],
|
||||
tiding_url: "https://www.trustie.net/users/#{current_user.try(:login)}/user_messages",
|
||||
register_url: "https://www.trustie.net/login?login=false"
|
||||
default_url: Rails.application.config_for(:configuration)['platform_url']
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
class SettingsController < ApplicationController
|
||||
def show
|
||||
@old_projects_url = nil
|
||||
get_navbar
|
||||
site_page_deploy_domain
|
||||
get_add_menu
|
||||
get_common_menu
|
||||
get_sub_competitions
|
||||
get_personal_menu
|
||||
get_third_party
|
||||
# get_third_party
|
||||
get_third_party_new
|
||||
get_top_system_notification
|
||||
end
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ module RepositoriesHelper
|
|||
s_content = s_content.starts_with?("/") ? s_content[1..-1] : s_content[0..-1]
|
||||
s_content = File.expand_path(s_content, file_path)
|
||||
s_content = s_content.split("#{Rails.root}/")[1]
|
||||
next if s_content.blank?
|
||||
# content = content.gsub(s[0], "/#{s_content}")
|
||||
join_xxx = s_content.include?("?") ? "&" : "?"
|
||||
s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}#{join_xxx}ref=#{ref}"].join
|
||||
|
|
@ -190,6 +191,7 @@ module RepositoriesHelper
|
|||
path = [owner&.login, repo&.identifier, 'tree', ref, file_path].join("/")
|
||||
s_content = File.expand_path(s_content, path)
|
||||
s_content = s_content.split("#{Rails.root}")[1]
|
||||
next if s_content.blank?
|
||||
case k.to_s
|
||||
when 'ss_src'
|
||||
content = content.gsub("src=\"#{s[0]}\"", "src=\"/#{s_content}\"")
|
||||
|
|
@ -202,7 +204,7 @@ module RepositoriesHelper
|
|||
when 'ss_href_1'
|
||||
content = content.gsub("href=\'#{s[0]}\'", "href=\'#{s_content}\'")
|
||||
else
|
||||
content = content.gsub("(#{s[0]})", "(/#{s_content})")
|
||||
content = content.gsub("(#{s[0]})", "(#{s_content})")
|
||||
end
|
||||
end
|
||||
rescue
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
class CommitLog < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :project
|
||||
belongs_to :repository
|
||||
# belongs_to :repository
|
||||
|
||||
has_many :project_trends, as: :trend, dependent: :destroy
|
||||
|
||||
|
|
|
|||
|
|
@ -298,6 +298,38 @@ class Issue < ApplicationRecord
|
|||
self.project.decrement!(:closed_issues_count) if self.status_id == 5 && self.project.present?
|
||||
end
|
||||
|
||||
# def self.find_issues_by_pm(enterprise_identifier, pm_issue_type)
|
||||
# case pm_issue_type.to_i
|
||||
# when 1
|
||||
# Issue.issue_issue.where(enterprise_identifier: enterprise_identifier)
|
||||
# .where(pm_issue_type: pm_issue_type)
|
||||
# .where(pm_issue_type_index1: index)
|
||||
# when 2
|
||||
# Issue.issue_issue.where(enterprise_identifier: enterprise_identifier)
|
||||
# .where(pm_issue_type: pm_issue_type)
|
||||
# .where(pm_issue_type_index2: index)
|
||||
# when 3
|
||||
# Issue.issue_issue.where(enterprise_identifier: enterprise_identifier)
|
||||
# .where(pm_issue_type: pm_issue_type)
|
||||
# .where(pm_issue_type_index3: index)
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def self.build_pm_index(enterprise_identifier, pm_issue_type)
|
||||
# last_issue = Issue.find_issues_by_pm(enterprise_identifier, pm_issue_type).order("pm_issue_type_index#{pm_issue_type.to_i} asc").last
|
||||
# deleted_issue_count = ($redis_cache.hget("pm_issue_cache_delete_count", enterprise_identifier) || 0).to_i
|
||||
#
|
||||
# last_issue.send("pm_issue_type_index#{pm_issue_type.to_i}").present? ? last_issue.send("pm_issue_type_index#{pm_issue_type.to_i}") + deleted_issue_count : 0
|
||||
# end
|
||||
#
|
||||
# def incre_pm_issue_cache_delete_count(count=1)
|
||||
# $redis_cache.hincrby("pm_issue_cache_delete_count", self.enterprise_identifier, count)
|
||||
# end
|
||||
#
|
||||
# def del_pm_issue_cache_delete_count
|
||||
# $redis_cache.hdel("pm_issue_cache_delete_count", self.enterprise_identifier)
|
||||
# end
|
||||
|
||||
def send_update_message_to_notice_system
|
||||
SendTemplateMessageJob.perform_later('IssueExpire', self.id) if Site.has_notice_menu? && self.due_date == Date.today + 1.days
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Api::Pm::Issues::CreateService < ApplicationService
|
|||
|
||||
attr_reader :project, :current_user
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num, :root_subject
|
||||
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login
|
||||
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :enterprise_identifier, :pm_issue_type
|
||||
attr_accessor :created_issue
|
||||
|
||||
validates :subject, presence: true
|
||||
|
|
@ -36,6 +36,7 @@ class Api::Pm::Issues::CreateService < ApplicationService
|
|||
@time_scale = params[:time_scale]
|
||||
@linkable_id = params[:link_able_id]
|
||||
@root_subject = params[:root_subject]
|
||||
@enterprise_identifier = params[:enterprise_identifier]
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
@ -74,6 +75,7 @@ class Api::Pm::Issues::CreateService < ApplicationService
|
|||
@created_issue.attachments = @attachments unless attachment_ids.blank?
|
||||
@created_issue.issue_tags = @issue_tags unless issue_tag_ids.blank?
|
||||
@created_issue.pm_project_id = @pm_project_id
|
||||
@created_issue.enterprise_identifier = @enterprise_identifier
|
||||
@created_issue.pm_sprint_id = @pm_sprint_id
|
||||
@created_issue.time_scale = @time_scale
|
||||
@created_issue.issue_tags_value = @issue_tags.order('id asc').pluck(:id).join(',') unless issue_tag_ids.blank?
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Api::Pm::Issues::UpdateService < ApplicationService
|
|||
include Api::V1::Issues::Concerns::Loadable
|
||||
|
||||
attr_reader :project, :issue, :current_user, :operate_by
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num,:status_msg
|
||||
attr_reader :target_pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :time_scale
|
||||
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :before_issue_tag_ids, :before_assigner_ids, :project_id
|
||||
attr_accessor :add_assigner_ids, :previous_issue_changes, :updated_issue, :atme_receivers
|
||||
|
|
@ -18,6 +18,7 @@ class Api::Pm::Issues::UpdateService < ApplicationService
|
|||
@current_user = current_user
|
||||
@operate_by = operate_by
|
||||
@status_id = params[:status_id]
|
||||
@status_msg = params[:status_msg]
|
||||
@priority_id = params[:priority_id]
|
||||
@milestone_id = params[:milestone_id]
|
||||
@branch_name = params[:branch_name]
|
||||
|
|
@ -201,7 +202,12 @@ class Api::Pm::Issues::UpdateService < ApplicationService
|
|||
# 修改状态
|
||||
if @updated_issue.previous_changes["status_id"].present?
|
||||
journal = @updated_issue.journals.create!({user_id: current_user.id, operate_by: @operate_by})
|
||||
journal.journal_details.create!({property: @updated_issue.pm_issue_type_string, prop_key: "status_id", old_value: @updated_issue.previous_changes["status_id"][0], value: @updated_issue.previous_changes["status_id"][1]})
|
||||
journal.journal_details.create!({property: @updated_issue.pm_issue_type_string,
|
||||
prop_key: "status_id",
|
||||
status_msg: @status_msg,
|
||||
old_value: @updated_issue.previous_changes["status_id"][0],
|
||||
value: @updated_issue.previous_changes["status_id"][1]}
|
||||
)
|
||||
end
|
||||
|
||||
# 修改优先级
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ class Api::V1::Users::DeleteUserService < ApplicationService
|
|||
end
|
||||
@user.destroy!
|
||||
del_user_data_by_sql(@user.id)
|
||||
Gitea::User::DeleteService.call(@user.login, true)
|
||||
end
|
||||
Gitea::User::DeleteService.call(@user.login, true)
|
||||
return true
|
||||
rescue
|
||||
raise Error, "服务器错误,请联系系统管理员!"
|
||||
|
|
@ -32,7 +32,11 @@ class Api::V1::Users::DeleteUserService < ApplicationService
|
|||
end
|
||||
|
||||
def del_user_data_by_sql(user_id)
|
||||
sql1 = "delete from memos where author_id=#{user_id}"
|
||||
ActiveRecord::Base.connection.execute(sql1)
|
||||
if ActiveRecord::Base.connection.table_exists?("memos")
|
||||
sql1 = "delete from memos where author_id=#{user_id}"
|
||||
ActiveRecord::Base.connection.execute(sql1)
|
||||
else
|
||||
Rails.logger.info "memos table does not exist"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -13,6 +13,7 @@ if journal.is_journal_detail?
|
|||
detail = journal.journal_details.take
|
||||
json.operate_category journal.pm_operate_category
|
||||
json.operate_content journal.is_journal_detail? ? journal.pm_operate_content : nil
|
||||
json.status_msg detail.status_msg
|
||||
else
|
||||
json.notes journal.notes
|
||||
json.comments_count journal.comments_count
|
||||
|
|
|
|||
|
|
@ -1,33 +1,4 @@
|
|||
json.setting do
|
||||
# if @laboratory.present?
|
||||
# setting = @laboratory.laboratory_setting
|
||||
# json.name setting.name || default_setting.name
|
||||
# json.nav_logo_url (setting.nav_logo_url || default_setting.nav_logo_url)&.[](1..-1)
|
||||
# json.login_logo_url (setting.login_logo_url || default_setting.login_logo_url)&.[](1..-1)
|
||||
# json.tab_logo_url (setting.tab_logo_url || default_setting.tab_logo_url)&.[](1..-1)
|
||||
#
|
||||
# json.subject_banner_url (setting.subject_banner_url || default_setting.subject_banner_url)&.[](1..-1)
|
||||
# json.course_banner_url (setting.course_banner_url || default_setting.course_banner_url)&.[](1..-1)
|
||||
# json.competition_banner_url (setting.competition_banner_url || default_setting.competition_banner_url)&.[](1..-1)
|
||||
# json.moop_cases_banner_url (setting.moop_cases_banner_url || default_setting.moop_cases_banner_url)&.[](1..-1)
|
||||
# json.oj_banner_url (setting.oj_banner_url || default_setting.oj_banner_url)&.[](1..-1)
|
||||
#
|
||||
# json.navbar setting.navbar || default_setting.navbar
|
||||
#
|
||||
# json.footer setting.footer || default_setting.footer
|
||||
#
|
||||
# end
|
||||
|
||||
# nav_bar = default_setting.navbar
|
||||
|
||||
# if User.current.logged?
|
||||
# nav_bar[2]["link"] = "https://forgeplus.trustie.net/users/#{current_user.login}/projects"
|
||||
# nav_bar[2]["hidden"] = false
|
||||
# else
|
||||
# nav_bar[2]["link"] = ""
|
||||
# nav_bar[2]["hidden"] = true
|
||||
# end
|
||||
|
||||
json.name default_setting.name
|
||||
json.nav_logo_url default_setting.nav_logo_url&.[](1..-1)
|
||||
json.login_logo_url default_setting.login_logo_url&.[](1..-1)
|
||||
|
|
@ -35,11 +6,11 @@ json.setting do
|
|||
json.site_page_deploy_domain @deploy_domain
|
||||
|
||||
json.subject_banner_url default_setting.subject_banner_url&.[](1..-1)
|
||||
json.course_banner_url default_setting.course_banner_url&.[](1..-1)
|
||||
# json.course_banner_url default_setting.course_banner_url&.[](1..-1)
|
||||
json.competition_banner_url EduSetting.get("competition_banner_url").to_s
|
||||
json.competition_banner_href EduSetting.get("competition_banner_href").to_s
|
||||
json.moop_cases_banner_url default_setting.moop_cases_banner_url&.[](1..-1)
|
||||
json.oj_banner_url default_setting.oj_banner_url&.[](1..-1)
|
||||
# json.moop_cases_banner_url default_setting.moop_cases_banner_url&.[](1..-1)
|
||||
# json.oj_banner_url default_setting.oj_banner_url&.[](1..-1)
|
||||
|
||||
json.navbar @navbar
|
||||
|
||||
|
|
@ -62,15 +33,15 @@ json.setting do
|
|||
end
|
||||
|
||||
json.common @common
|
||||
json.third_party @third_party
|
||||
# json.third_party @third_party
|
||||
json.third_party_new @third_party_new
|
||||
|
||||
if @top_system_notification.present?
|
||||
json.system_notification do
|
||||
json.(@top_system_notification, :id, :subject, :sub_subject, :content)
|
||||
json.is_read @top_system_notification.read_member?(current_user&.id)
|
||||
end
|
||||
else
|
||||
json.system_notification nil
|
||||
end
|
||||
# if @top_system_notification.present?
|
||||
# json.system_notification do
|
||||
# json.(@top_system_notification, :id, :subject, :sub_subject, :content)
|
||||
# json.is_read @top_system_notification.read_member?(current_user&.id)
|
||||
# end
|
||||
# else
|
||||
# json.system_notification nil
|
||||
# end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class AddJournalDetailMsg < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :journal_details, :status_msg, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
class AddIssueEnterprise < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :issues, :enterprise_identifier, :string
|
||||
add_index :issues, :enterprise_identifier
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Reference in New Issue