forked from Trustie/forgeplus
Compare commits
71 Commits
standalone
...
hh_develop
| Author | SHA1 | Date |
|---|---|---|
|
|
dec264d169 | |
|
|
7055974443 | |
|
|
3536918938 | |
|
|
56278b84f2 | |
|
|
882a50cf56 | |
|
|
db4031b8bf | |
|
|
ecfc39565c | |
|
|
9ced678f91 | |
|
|
7951ca28d5 | |
|
|
4bbb843edf | |
|
|
747646cd9d | |
|
|
d0d906d04c | |
|
|
bc639488aa | |
|
|
99fbecc834 | |
|
|
8d0a6d267a | |
|
|
b1c03ed5e8 | |
|
|
ef12f85687 | |
|
|
e120c4dac2 | |
|
|
e1cf2fcdeb | |
|
|
c4f380873e | |
|
|
5cb2e55f74 | |
|
|
1dd3fbc69a | |
|
|
b97c42d0ae | |
|
|
a2612d8009 | |
|
|
2f2655525f | |
|
|
1a93477635 | |
|
|
7c664addbd | |
|
|
c6b79f82bc | |
|
|
4e3f9cc019 | |
|
|
5ed7b3e4ad | |
|
|
4e2c46260c | |
|
|
9ba00b21c9 | |
|
|
b11f5fd228 | |
|
|
90dbe0730a | |
|
|
d6633cb73a | |
|
|
a7a6abd22a | |
|
|
c956667ce0 | |
|
|
5701c818ed | |
|
|
1ac2ddfaa5 | |
|
|
4aac05d4e1 | |
|
|
84b56bfcb8 | |
|
|
7485564bb9 | |
|
|
b5acf2308a | |
|
|
e3f4313c80 | |
|
|
b223abe229 | |
|
|
b3bede308c | |
|
|
2f170a54c6 | |
|
|
22293572ac | |
|
|
8720cab1e9 | |
|
|
959c1e8d95 | |
|
|
29dc3fff39 | |
|
|
298abdd1b1 | |
|
|
26f87fba16 | |
|
|
1e9a32a93e | |
|
|
2dc79052c2 | |
|
|
380ca3a066 | |
|
|
237b0afb08 | |
|
|
e14936e820 | |
|
|
655c85851f | |
|
|
1c7e414aa4 | |
|
|
099fc52e00 | |
|
|
490957ec3b | |
|
|
b1884d30d5 | |
|
|
98d8ee1fb6 | |
|
|
2ca77732c8 | |
|
|
70d22f7c4f | |
|
|
25d0e784bb | |
|
|
5d45b24299 | |
|
|
b6b8befde7 | |
|
|
f33b9559cd | |
|
|
f9bc2258ec |
|
|
@ -192,7 +192,9 @@ class AccountsController < ApplicationController
|
|||
|
||||
sync_params = {
|
||||
password: params[:password].to_s,
|
||||
email: @user.mail
|
||||
email: @user.mail,
|
||||
login_name: @user.login,
|
||||
source_id: 0
|
||||
}
|
||||
|
||||
interactor = Gitea::User::UpdateInteractor.call(@user.login, sync_params)
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ class AttachmentsController < ApplicationController
|
|||
if @file.container && current_user.logged?
|
||||
if @file.container.is_a?(Issue)
|
||||
course = @file.container.project
|
||||
candown = course.member?(current_user)
|
||||
candown = course.member?(current_user) || course.is_public
|
||||
elsif @file.container.is_a?(Journal)
|
||||
course = @file.container.issue.project
|
||||
candown = course.member?(current_user)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Ci::BaseController < ApplicationController
|
|||
namespace = params[:owner]
|
||||
id = params[:repo] || params[:id]
|
||||
|
||||
@ci_user, @repo = Ci::Repo.find_with_namespace(namespace, id)
|
||||
@ci_user, @repo = Ci::Repo.find_with_namespace(namespace, id, current_user.login)
|
||||
end
|
||||
|
||||
def load_all_repo
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Ci::SecretsController < Ci::BaseController
|
|||
end
|
||||
|
||||
def ci_drone_url
|
||||
user = User.find_by(login: params[:owner])
|
||||
user = User.find_by(login: params[:owner]) || User.find_by(login: current_user.login)
|
||||
user&.ci_cloud_account.drone_url
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class CompareController < ApplicationController
|
|||
if @base.blank? || @head.blank?
|
||||
return -2, "请选择分支"
|
||||
else
|
||||
return -2, "目标仓库未开启合并请求(PR)功能" unless @project.has_menu_permission("pulls")
|
||||
if @head.include?(":")
|
||||
fork_project = @project.forked_projects.joins(:owner).where(users: {login: @head.to_s.split("/")[0]}).take
|
||||
return -2, "请选择正确的仓库" unless fork_project.present?
|
||||
|
|
@ -50,6 +51,6 @@ class CompareController < ApplicationController
|
|||
end
|
||||
|
||||
def gitea_compare(base, head)
|
||||
Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, CGI.escape(base), CGI.escape(head), current_user.gitea_token)
|
||||
Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), current_user.gitea_token)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ module Ci::CloudAccountManageable
|
|||
|
||||
def drone_oauth_user!(url, state)
|
||||
logger.info "[drone] drone_oauth_user url: #{url}"
|
||||
conn = Faraday.new(url: url) do |req|
|
||||
conn = Faraday.new(url: "#{Gitea.gitea_config[:domain]}#{url}") do |req|
|
||||
req.request :url_encoded
|
||||
req.adapter Faraday.default_adapter
|
||||
req.headers["cookie"] = "_session_=#{SecureRandom.hex(28)}; _oauth_state_=#{state}"
|
||||
|
|
@ -188,7 +188,8 @@ module Ci::CloudAccountManageable
|
|||
response = conn.get
|
||||
logger.info "[drone] response headers: #{response.headers}"
|
||||
|
||||
response.headers['location'].include?('error') ? false : true
|
||||
true
|
||||
# response.headers['location'].include?('error') ? false : true
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -108,7 +108,11 @@ module LoginHelper
|
|||
def sync_pwd_to_gitea!(user, hash={})
|
||||
return true if user.is_sync_pwd?
|
||||
|
||||
sync_params = { email: user.mail }
|
||||
sync_params = {
|
||||
login_name: user.name,
|
||||
source_id: 0,
|
||||
email: user.mail
|
||||
}
|
||||
interactor = Gitea::User::UpdateInteractor.call(user.login, sync_params.merge(hash))
|
||||
if interactor.success?
|
||||
Rails.logger.info "########_ login is #{user.login} sync_pwd_to_gitea success _########"
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ class IssuesController < ApplicationController
|
|||
@filter_issues = @all_issues
|
||||
@filter_issues = @filter_issues.where.not(status_id: IssueStatus::CLOSED) if params[:status_type].to_i == IssueStatus::ADD
|
||||
@filter_issues = @filter_issues.where(status_id: IssueStatus::CLOSED) if params[:status_type].to_i == IssueStatus::SOLVING
|
||||
@filter_issues = @filter_issues.where("subject LIKE ? OR description LIKE ? ", "%#{params[:search]}%", "%#{params[:search]}%") if params[:search].present?
|
||||
@filter_issues = @filter_issues.where("issues.subject LIKE ? OR issues.description LIKE ? ", "%#{params[:search]}%", "%#{params[:search]}%") if params[:search].present?
|
||||
@open_issues = @all_issues.where.not(status_id: IssueStatus::CLOSED)
|
||||
@close_issues = @all_issues.where(status_id: IssueStatus::CLOSED)
|
||||
@assign_to_me = @filter_issues.where(assigned_to_id: current_user&.id)
|
||||
@my_published = @filter_issues.where(author_id: current_user&.id)
|
||||
scopes = Issues::ListQueryService.call(issues,params.delete_if{|k,v| v.blank?}, "Issue")
|
||||
@issues_size = scopes.size
|
||||
@assign_to_me = scopes.where(assigned_to_id: current_user&.id)
|
||||
@my_published = scopes.where(author_id: current_user&.id)
|
||||
@issues = paginate(scopes)
|
||||
|
||||
respond_to do |format|
|
||||
|
|
@ -149,6 +149,8 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
@issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "create")
|
||||
@issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: ProjectTrend::CLOSE) if params[:status_id].to_i == 5
|
||||
|
||||
|
||||
Rails.logger.info "[ATME] maybe to at such users: #{@atme_receivers.pluck(:login)}"
|
||||
AtmeService.call(current_user, @atme_receivers, @issue) if @atme_receivers.size > 0
|
||||
|
|
@ -178,6 +180,7 @@ class IssuesController < ApplicationController
|
|||
elsif params[:issue_tag_ids].is_a?(Array) && params[:issue_tag_ids].size == 1
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
next if tag == [""]
|
||||
IssueTagsRelate.create!(issue_id: @issue.id, issue_tag_id: tag)
|
||||
end
|
||||
else
|
||||
|
|
@ -244,7 +247,7 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
if params[:status_id].to_i == 5 #任务由非关闭状态到关闭状态时
|
||||
@issue.issue_times.update_all(end_time: Time.now)
|
||||
@issue.update_closed_issues_count_in_project!
|
||||
# @issue.update_closed_issues_count_in_project!
|
||||
if @issue.issue_type.to_s == "2" && last_status_id != 5
|
||||
if @issue.assigned_to_id.present? && last_status_id == 3 #只有当用户完成100%时,才给token
|
||||
post_to_chain("add", @issue.token, @issue.get_assign_user.try(:login))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
class NoticesController < ApplicationController
|
||||
|
||||
def create
|
||||
tip_exception("参数有误") if params["source"].blank?
|
||||
user_id = params[:user_id]
|
||||
|
||||
if params["source"] == "CompetitionBegin"
|
||||
competition_id = params[:competition_id]
|
||||
SendTemplateMessageJob.perform_later('CompetitionBegin', user_id, competition_id)
|
||||
elsif params["source"] == "CompetitionResult"
|
||||
competition_id = params[:competition_id]
|
||||
SendTemplateMessageJob.perform_later('CompetitionResult', user_id, competition_id)
|
||||
elsif params["source"] == "CompetitionReview"
|
||||
competition_id = params[:competition_id]
|
||||
SendTemplateMessageJob.perform_later('CompetitionReview', user_id, competition_id)
|
||||
else
|
||||
tip_exception("#{params["source"]}未配置")
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
end
|
||||
|
|
@ -5,7 +5,11 @@ class Organizations::OrganizationUsersController < Organizations::BaseController
|
|||
def index
|
||||
@organization_users = @organization.organization_users.includes(:user)
|
||||
search = params[:search].to_s.downcase
|
||||
@organization_users = @organization_users.joins(:user).merge(User.like(search))
|
||||
user_condition_users = User.like(search).to_sql
|
||||
team_condition_teams = User.joins(:teams).merge(@organization.teams.like(search)).to_sql
|
||||
users = User.from("( #{user_condition_users} UNION #{team_condition_teams }) AS users")
|
||||
|
||||
@organization_users = @organization_users.where(user_id: users).distinct
|
||||
|
||||
@organization_users = kaminari_paginate(@organization_users)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Organizations::TeamsController < Organizations::BaseController
|
|||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
if @organization.teams.count >= 50
|
||||
return render_forbidden("组织的团队数量已超过限制!")
|
||||
return tip_exception("组织的团队数量已超过限制!")
|
||||
else
|
||||
Organizations::CreateTeamForm.new(team_params).validate!
|
||||
@team = Organizations::Teams::CreateService.call(current_user, @organization, team_params)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class PraiseTreadController < ApplicationController
|
|||
begin
|
||||
return normal_status(2, "你已点过赞了") if current_user.liked?(@project)
|
||||
current_user.like!(@project)
|
||||
SendTemplateMessageJob.perform_later('ProjectPraised', current_user.id, @project.id) if Site.has_notice_menu?
|
||||
render_ok({praises_count: @project.praises_count, praised: current_user.liked?(@project)})
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class ProjectsController < ApplicationController
|
|||
Projects::MigrateForm.new(mirror_params).validate!
|
||||
|
||||
@project =
|
||||
if enable_accelerator?(mirror_params[:clone_addr])
|
||||
if EduSetting.get("mirror_address").to_s.include?("github") && enable_accelerator?(mirror_params[:clone_addr])
|
||||
source_clone_url = mirror_params[:clone_addr]
|
||||
uid_logger("########## 已动加速器 ##########")
|
||||
result = Gitea::Accelerator::MigrateService.call(mirror_params)
|
||||
|
|
@ -71,6 +71,11 @@ class ProjectsController < ApplicationController
|
|||
else
|
||||
Projects::MigrateService.call(current_user, mirror_params)
|
||||
end
|
||||
elsif EduSetting.get("mirror_address").to_s.include?("cnpmjs") && mirror_params[:clone_addr].include?("github.com")
|
||||
source_clone_url = mirror_params[:clone_addr]
|
||||
clone_url = source_clone_url.gsub('github.com', 'github.com.cnpmjs.org')
|
||||
uid_logger("########## 更改clone_addr ##########")
|
||||
Projects::MigrateService.call(current_user, mirror_params.merge(source_clone_url: source_clone_url, clone_addr: clone_url))
|
||||
else
|
||||
Projects::MigrateService.call(current_user, mirror_params)
|
||||
end
|
||||
|
|
@ -130,7 +135,7 @@ class ProjectsController < ApplicationController
|
|||
validate_params = project_params.slice(:name, :description,
|
||||
:project_category_id, :project_language_id, :private, :identifier)
|
||||
|
||||
Projects::UpdateForm.new(validate_params.merge(user_id: @project.user_id, project_identifier: @project.identifier)).validate!
|
||||
Projects::UpdateForm.new(validate_params.merge(user_id: @project.user_id, project_identifier: @project.identifier, project_name: @project.name)).validate!
|
||||
|
||||
private = @project.forked_from_project.present? ? !@project.forked_from_project.is_public : params[:private] || false
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class PullRequestsController < ApplicationController
|
|||
before_action :require_login, except: [:index, :show, :files, :commits]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :load_repository
|
||||
before_action :check_menu_authorize
|
||||
before_action :check_menu_authorize, only: [:index, :show, :create, :update, :refuse_merge, :pr_merge]
|
||||
before_action :find_pull_request, except: [:index, :new, :create, :check_can_merge,:get_branches,:create_merge_infos, :files, :commits]
|
||||
before_action :load_pull_request, only: [:files, :commits]
|
||||
before_action :find_atme_receivers, only: [:create, :update]
|
||||
|
|
@ -16,7 +16,7 @@ class PullRequestsController < ApplicationController
|
|||
issues = issues.where(is_private: false) unless current_user.present? && (current_user.admin? || @project.member?(current_user))
|
||||
@all_issues = issues.distinct
|
||||
@filter_issues = @all_issues
|
||||
@filter_issues = @filter_issues.where("subject LIKE ? OR description LIKE ? ", "%#{params[:search]}%", "%#{params[:search]}%") if params[:search].present?
|
||||
@filter_issues = @filter_issues.where("issues.subject LIKE ? OR issues.description LIKE ? ", "%#{params[:search]}%", "%#{params[:search]}%") if params[:search].present?
|
||||
@open_issues = @filter_issues.joins(:pull_request).where(pull_requests: {status: PullRequest::OPEN})
|
||||
@close_issues = @filter_issues.joins(:pull_request).where(pull_requests: {status: PullRequest::CLOSED})
|
||||
@merged_issues = @filter_issues.joins(:pull_request).where(pull_requests: {status: PullRequest::MERGED})
|
||||
|
|
@ -274,12 +274,12 @@ class PullRequestsController < ApplicationController
|
|||
base: params[:base], #目标分支
|
||||
milestone: 0, #里程碑,未与本地的里程碑关联
|
||||
}
|
||||
assignee_login = User.find_by_id(params[:assigned_to_id])&.login
|
||||
@requests_params = @local_params.merge({
|
||||
assignee: current_user.try(:login),
|
||||
# assignees: ["#{params[:assigned_login].to_s}"],
|
||||
assignees: ["#{current_user.try(:login).to_s}"],
|
||||
labels: params[:issue_tag_ids],
|
||||
due_date: Time.now
|
||||
assignees: ["#{assignee_login.to_s}"],
|
||||
labels: params[:issue_tag_ids]
|
||||
# due_date: Time.now
|
||||
})
|
||||
@issue_params = {
|
||||
author_id: current_user.id,
|
||||
|
|
|
|||
|
|
@ -150,8 +150,11 @@ class RepositoriesController < ApplicationController
|
|||
if params[:filepath].present? || @project.educoder?
|
||||
@contributors = []
|
||||
else
|
||||
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
|
||||
result = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
|
||||
@contributors = result.is_a?(Hash) && result.key?(:status) ? [] : result
|
||||
end
|
||||
rescue
|
||||
@contributors = []
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
@ -238,7 +241,7 @@ class RepositoriesController < ApplicationController
|
|||
def archive
|
||||
domain = Gitea.gitea_config[:domain]
|
||||
api_url = Gitea.gitea_config[:base_url]
|
||||
archive_url = "/repos/#{@owner.login}/#{@repository.identifier}/archive/#{CGI.escape(params[:archive])}"
|
||||
archive_url = "/repos/#{@owner.login}/#{@repository.identifier}/archive/#{Addressable::URI.escape(params[:archive])}"
|
||||
|
||||
file_path = [domain, api_url, archive_url].join
|
||||
file_path = [file_path, "access_token=#{current_user&.gitea_token}"].join("?") if @repository.hidden?
|
||||
|
|
@ -252,7 +255,7 @@ class RepositoriesController < ApplicationController
|
|||
domain = Gitea.gitea_config[:domain]
|
||||
api_url = Gitea.gitea_config[:base_url]
|
||||
|
||||
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{CGI.escape(params[:filepath])}?ref=#{CGI.escape(params[:ref])}"
|
||||
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{Addressable::URI.escape(params[:filepath])}?ref=#{Addressable::URI.escape(params[:ref])}"
|
||||
file_path = [domain, api_url, url].join
|
||||
file_path = [file_path, "access_token=#{current_user&.gitea_token}"].join("&")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
class SettingsController < ApplicationController
|
||||
def show
|
||||
@old_projects_url = nil
|
||||
get_navbar
|
||||
get_add_menu
|
||||
get_common_menu
|
||||
get_personal_menu
|
||||
|
|
@ -8,6 +9,14 @@ class SettingsController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
def get_navbar
|
||||
@navbar = default_laboratory.navbar
|
||||
if User.current.logged?
|
||||
pernal_index = {"name"=>"个人主页", "link"=>get_site_url("link", "/current_user"), "hidden"=>false}
|
||||
@navbar << pernal_index
|
||||
end
|
||||
end
|
||||
|
||||
def get_add_menu
|
||||
@add = []
|
||||
Site.add.select(:id, :name, :url, :key).to_a.map(&:serializable_hash).each do |site|
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Users::StatisticsController < Users::BaseController
|
|||
@commit_data = []
|
||||
date_range.each do |date|
|
||||
@date_data << date.strftime("%Y.%m.%d")
|
||||
@issue_data << observed_user.issues.where("DATE(created_on) = ?", date).size
|
||||
@issue_data << observed_user.issues.issue_issue.where("DATE(created_on) = ?", date).size
|
||||
@pull_request_data << observed_user.pull_requests.where("DATE(created_at) = ?", date).size
|
||||
date_commit_data = commit_data.blank? ? nil : commit_data.select{|item| item["timestamp"] == date.to_time.to_i}
|
||||
@commit_data << (date_commit_data.blank? ? 0 : date_commit_data[0]["contributions"].to_i)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ class Users::TemplateMessageSettingsController < Users::BaseController
|
|||
def get_current_setting
|
||||
@current_setting = @_observed_user.user_template_message_setting
|
||||
@current_setting = UserTemplateMessageSetting.build(@_observed_user.id) if @current_setting.nil?
|
||||
@current_setting.notification_body.merge!(UserTemplateMessageSetting.init_notification_body.except(*@current_setting.notification_body.keys))
|
||||
@current_setting.email_body.merge!(UserTemplateMessageSetting.init_email_body.except(*@current_setting.email_body.keys))
|
||||
end
|
||||
|
||||
def setting_params
|
||||
|
|
|
|||
|
|
@ -91,10 +91,9 @@ await octokit.request('GET /api/users/:login/messages.json')
|
|||
类型|说明
|
||||
--------- | -----------
|
||||
|IssueAssigned | 有新指派给我的疑修 |
|
||||
|IssueAssignerExpire | 我负责的疑修截止日期到达最后一天 |
|
||||
|IssueExpire | 我创建或负责的疑修截止日期到达最后一天 |
|
||||
|IssueAtme | 在疑修中@我 |
|
||||
|IssueChanged | 我创建或负责的疑修状态变更 |
|
||||
|IssueCreatorExpire | 我创建的疑修截止日期到达最后一天 |
|
||||
|IssueDeleted | 我创建或负责的疑修删除 |
|
||||
|IssueJournal | 我创建或负责的疑修有新的评论 |
|
||||
|LoginIpTip | 登录异常提示 |
|
||||
|
|
@ -109,6 +108,7 @@ await octokit.request('GET /api/users/:login/messages.json')
|
|||
|ProjectLeft | 账号被移出项目 |
|
||||
|ProjectMemberJoined | 我管理的仓库有成员加入 |
|
||||
|ProjectMemberLeft | 我管理的仓库有成员移出 |
|
||||
|ProjectMilestoneCompleted | 我管理的仓库有里程碑完成度100% |
|
||||
|ProjectMilestone | 我管理的仓库有新的里程碑 |
|
||||
|ProjectPraised | 我管理的仓库被点赞 |
|
||||
|ProjectPullRequest | 我管理/关注的仓库有新的合并请求 |
|
||||
|
|
|
|||
|
|
@ -50,4 +50,10 @@ class BaseForm
|
|||
def strip(str)
|
||||
str.to_s.strip.presence
|
||||
end
|
||||
|
||||
# 1 手机类型;0 邮箱类型
|
||||
# 注意新版的login是自动名生成的
|
||||
def phone_mail_type value
|
||||
value =~ /^1\d{10}$/ ? 1 : 0
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class Projects::UpdateForm < BaseForm
|
||||
attr_accessor :name, :description, :project_category_id, :project_language_id, :private, :identifier, :user_id, :project_identifier
|
||||
attr_accessor :name, :description, :project_category_id, :project_language_id, :private, :identifier, :user_id, :project_identifier, :project_name
|
||||
validates :name, presence: true
|
||||
validates :name, length: { maximum: 50 }
|
||||
validates :description, length: { maximum: 200 }
|
||||
|
|
@ -10,6 +10,7 @@ class Projects::UpdateForm < BaseForm
|
|||
check_project_language(project_language_id)
|
||||
|
||||
check_repository_name(user_id, identifier) unless identifier.blank? || identifier == project_identifier
|
||||
check_project_name(user_id, name) unless name.blank? || name == project_name
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ module Register
|
|||
|
||||
def check!
|
||||
Rails.logger.info "Register::Form params: code: #{code}; login: #{login}; namespace: #{namespace}; password: #{password}; type: #{type}"
|
||||
db_verifi_code =
|
||||
type = phone_mail_type(strip(login))
|
||||
db_verifi_code =
|
||||
if type == 1
|
||||
check_phone(login)
|
||||
VerificationCode.where(phone: login, code: code, code_type: 1).last
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module RepositoriesHelper
|
|||
|
||||
def download_type(str)
|
||||
default_type = %w(xlsx xls ppt pptx pdf zip 7z rar exe pdb obj idb RData rdata doc docx mpp vsdx dot otf eot ttf woff woff2 mp4 mov wmv flv mpeg avi avchd webm mkv)
|
||||
default_type.include?(str&.downcase)
|
||||
default_type.include?(str&.downcase) || str.blank?
|
||||
end
|
||||
|
||||
def image_type?(str)
|
||||
|
|
@ -57,6 +57,7 @@ module RepositoriesHelper
|
|||
total_images = ss + ss_src
|
||||
if total_images.length > 0
|
||||
total_images.each do |s|
|
||||
begin
|
||||
image_title = /\"(.*?)\"/
|
||||
r_content = s[0]
|
||||
remove_title = r_content.to_s.scan(image_title)
|
||||
|
|
@ -75,6 +76,9 @@ module RepositoriesHelper
|
|||
new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw?filepath=#{r_content}&ref=#{ref}"].join
|
||||
end
|
||||
content = content.gsub(/#{r_content}/, new_r_content)
|
||||
rescue
|
||||
next
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -96,7 +100,9 @@ module RepositoriesHelper
|
|||
|
||||
def decode64_content(entry, owner, repo, ref, path=nil)
|
||||
if is_readme?(entry['type'], entry['name'])
|
||||
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
||||
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
Rails.logger.info("content===#{content}")
|
||||
readme_render_decode64_content(content, owner, repo, ref)
|
||||
else
|
||||
file_type = File.extname(entry['name'].to_s)[1..-1]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ class CacheAsyncClearJob < ApplicationJob
|
|||
Cache::V2::ProjectCommonService.new(id).clear
|
||||
when "owner_common_service"
|
||||
Cache::V2::OwnnerCommonService.new(id).clear
|
||||
when "project_rank_service"
|
||||
Cache::V2::ProjectRankService.new(id).clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -3,8 +3,7 @@ class DelayExpiredIssueJob < ApplicationJob
|
|||
|
||||
def perform
|
||||
Issue.where(due_date: Date.today + 1.days).find_each do |issue|
|
||||
SendTemplateMessageJob.perform_later('IssueAssignerExpire', issue.id) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('IssueCreatorExpire', issue.id) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('IssueExpire', issue.id) if Site.has_notice_menu?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -24,13 +24,6 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_email_string, email_title, email_content = MessageTemplate::IssueAssigned.get_email_message_content(receiver, operator, issue)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'IssueAssignerExpire'
|
||||
issue_id = args[0]
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
return unless issue.present?
|
||||
receivers = User.where(id: issue&.assigned_to_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::IssueAssignerExpire.get_message_content(receivers, issue)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {issue_id: issue.id})
|
||||
when 'IssueAtme'
|
||||
receivers, operator_id, issue_id = args[0], args[1], args[2]
|
||||
operator = User.find_by_id(operator_id)
|
||||
|
|
@ -52,13 +45,17 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_email_string, email_title, email_content = MessageTemplate::IssueChanged.get_email_message_content(receiver, operator, issue, change_params)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'IssueCreatorExpire'
|
||||
when 'IssueExpire'
|
||||
issue_id = args[0]
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
return unless issue.present?
|
||||
receivers = User.where(id: issue&.author_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::IssueCreatorExpire.get_message_content(receivers, issue)
|
||||
receivers = User.where(id: [issue&.assigned_to_id, issue&.author_id])
|
||||
receivers_string, content, notification_url = MessageTemplate::IssueExpire.get_message_content(receivers, issue)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {issue_id: issue.id})
|
||||
receivers.find_each do |receiver|
|
||||
receivers_email_string, email_title, email_content = MessageTemplate::IssueExpire.get_email_message_content(receiver, issue)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'IssueDeleted'
|
||||
operator_id, issue_title, issue_assigned_to_id, issue_author_id = args[0], args[1], args[2], args[3]
|
||||
operator = User.find_by_id(operator_id)
|
||||
|
|
@ -94,6 +91,14 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_email_string, email_title, email_content = MessageTemplate::OrganizationLeft.get_email_message_content(receiver, organization)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'ProjectForked'
|
||||
operator_id, project_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
project = Project.find_by_id(project_id)
|
||||
return unless operator.present? && project.present?
|
||||
receivers = project&.all_managers.where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectForked.get_message_content(receivers, operator, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, project_id: project.id})
|
||||
when 'ProjectIssue'
|
||||
operator_id, issue_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
|
|
@ -163,6 +168,37 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_email_string, email_title, email_content = MessageTemplate::ProjectMemberLeft.get_email_message_content(receiver, user, project)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'ProjectMilestoneCompleted'
|
||||
milestone_id = args[0]
|
||||
milestone = Version.find_by_id(milestone_id)
|
||||
return unless milestone.present? && milestone&.project.present?
|
||||
receivers = milestone&.project&.all_managers
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectMilestoneCompleted.get_message_content(receivers, milestone)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {milestone_id: milestone_id})
|
||||
receivers.find_each do |receiver|
|
||||
receivers_email_string, email_title, email_content = MessageTemplate::ProjectMilestoneCompleted.get_email_message_content(receiver, milestone)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'ProjectMilestone'
|
||||
milestone_id, operator_id = args[0], args[1]
|
||||
milestone = Version.find_by_id(milestone_id)
|
||||
operator = User.find_by_id(operator_id)
|
||||
return unless milestone.present? && milestone&.project.present? && operator.present?
|
||||
receivers = milestone&.project&.all_managers.where.not(id: operator_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectMilestone.get_message_content(receivers, operator, milestone)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {milestone_id: milestone_id, operator_id: operator_id})
|
||||
receivers.find_each do |receiver|
|
||||
receivers_email_string, email_title, email_content = MessageTemplate::ProjectMilestone.get_email_message_content(receiver, operator, milestone)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'ProjectPraised'
|
||||
operator_id, project_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
project = Project.find_by_id(project_id)
|
||||
return unless operator.present? && project.present?
|
||||
receivers = project&.all_managers.where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectPraised.get_message_content(receivers, operator, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, project_id: project.id})
|
||||
when 'ProjectPullRequest'
|
||||
operator_id, pull_request_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
|
|
@ -290,6 +326,30 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_email_string, email_title, email_content = MessageTemplate::TeamLeft.get_email_message_content(receiver, organization, team)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'CompetitionBegin'
|
||||
user_id, competition_id = args[0], args[1]
|
||||
user = User.find_by_id(user_id)
|
||||
project = Project.find_by_sql("select *,title as name from competitions where id=#{competition_id}")
|
||||
return unless user.present? && project.present?
|
||||
receivers = User.where(id: user_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::CompetitionBegin.get_message_content(receivers, project.first)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user_id, competition_name: project.first&.name, identifier: project.first&.identifier})
|
||||
when 'CompetitionReview'
|
||||
user_id, competition_id = args[0], args[1]
|
||||
user = User.find_by_id(user_id)
|
||||
project = Project.find_by_sql("select *,title as name from competitions where id=#{competition_id}")
|
||||
return unless user.present? && project.present?
|
||||
receivers = User.where(id: user_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::CompetitionReview.get_message_content(receivers, project.first)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user_id, competition_name: project.first&.name, identifier: project.first&.identifier})
|
||||
when 'CompetitionResult'
|
||||
user_id, competition_id = args[0], args[1]
|
||||
user = User.find_by_id(user_id)
|
||||
project = Project.find_by_sql("select *,title as name from competitions where id=#{competition_id}")
|
||||
return unless user.present? && project.present?
|
||||
receivers = User.where(id: user_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::CompetitionResult.get_message_content(receivers, project.first)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user_id, competition_name: project.first&.name, identifier: project.first&.identifier})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
module Trace
|
||||
class << self
|
||||
def trace_config
|
||||
trace_config = {}
|
||||
|
||||
begin
|
||||
config = Rails.application.config_for(:configuration).symbolize_keys!
|
||||
trace_config = config[:trace].symbolize_keys!
|
||||
raise 'trace config missing' if trace_config.blank?
|
||||
rescue => exception
|
||||
raise ex if Rails.env.production?
|
||||
|
||||
puts %Q{\033[33m [warning] gitea config or configuration.yml missing,
|
||||
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
|
||||
trace_config = {}
|
||||
end
|
||||
|
||||
trace_config
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -5,10 +5,10 @@ class Ci::Repo < Ci::RemoteBase
|
|||
has_one :perm, foreign_key: :perm_repo_uid
|
||||
has_many :builds, foreign_key: :build_repo_id, dependent: :destroy
|
||||
|
||||
def self.find_with_namespace(namespace_path, identifier)
|
||||
def self.find_with_namespace(namespace_path, identifier, user_login)
|
||||
logger.info "########namespace_path: #{namespace_path} ########identifier: #{identifier} "
|
||||
|
||||
user = Ci::User.find_by_user_login namespace_path
|
||||
user_login = user_login || namespace_path
|
||||
user = Ci::User.find_by(user_login: user_login)
|
||||
repo = Ci::Repo.where(repo_namespace: namespace_path, repo_name: identifier).first
|
||||
|
||||
[user, repo]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module Matchable
|
|||
scope :with_project_category, ->(category_id) { where(project_category_id: category_id) unless category_id.blank? }
|
||||
scope :with_project_language, ->(language_id) { where(project_language_id: language_id) unless language_id.blank? }
|
||||
scope :with_project_type, ->(project_type) { where(project_type: project_type) if Project.project_types.include?(project_type) }
|
||||
scope :by_name_or_identifier, ->(search) { where("name like :search or identifier LIKE :search", :search => "#{search.split(" ").join('|')}%") unless search.blank? }
|
||||
scope :by_name_or_identifier, ->(search) { where("name like :search or identifier LIKE :search", :search => "%#{search.split(" ").join('|')}%") unless search.blank? }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class Issue < ApplicationRecord
|
|||
scope :issue_index_includes, ->{includes(:tracker, :priority, :version, :issue_status, :journals,:issue_tags,user: :user_extension)}
|
||||
scope :closed, ->{where(status_id: 5)}
|
||||
after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic
|
||||
after_update :change_versions_count
|
||||
after_save :change_versions_count, :send_update_message_to_notice_system
|
||||
after_destroy :update_closed_issues_count_in_project!, :decre_project_common, :decre_user_statistic, :decre_platform_statistic
|
||||
|
||||
def incre_project_common
|
||||
|
|
@ -170,11 +170,25 @@ class Issue < ApplicationRecord
|
|||
end
|
||||
|
||||
def change_versions_count
|
||||
if self.version.present? && self.saved_change_to_status_id?
|
||||
if self.saved_change_to_fixed_version_id?
|
||||
before_version = Version.find_by_id(self.fixed_version_id_before_last_save)
|
||||
Rails.logger.info self.fixed_version_id_before_last_save
|
||||
if before_version.present?
|
||||
Rails.logger.info self.status_id
|
||||
Rails.logger.info self.status_id_before_last_save
|
||||
# 更改前状态为完成 或者 更改前后都为完成状态
|
||||
if self.status_id_before_last_save == 5
|
||||
percent = before_version.issues_count == 0 ? 0.0 : ((before_version.closed_issues_count - 1).to_f / before_version.issues_count)
|
||||
before_version.update_attributes(closed_issues_count: (before_version.closed_issues_count - 1), percent: percent)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.version.present? && (self.saved_change_to_status_id? || self.saved_change_to_fixed_version_id?)
|
||||
if self.status_id == 5
|
||||
percent = self.version.issues_count == 0 ? 0.0 : ((self.version.closed_issues_count + 1).to_f / self.version.issues_count)
|
||||
self.version.update_attributes(closed_issues_count: (self.version.closed_issues_count + 1), percent: percent)
|
||||
elsif self.status_id_before_last_save == 5
|
||||
elsif self.status_id_before_last_save == 5 && !self.saved_change_to_fixed_version_id?
|
||||
percent = self.version.issues_count == 0 ? 0.0 : ((self.version.closed_issues_count - 1).to_f / self.version.issues_count)
|
||||
self.version.update_attributes(closed_issues_count: (self.version.closed_issues_count - 1), percent: percent)
|
||||
end
|
||||
|
|
@ -182,7 +196,11 @@ class Issue < ApplicationRecord
|
|||
end
|
||||
|
||||
def update_closed_issues_count_in_project!
|
||||
self.project.decrement!(:closed_issues_count)
|
||||
self.project.decrement!(:closed_issues_count) if self.status_id == 5
|
||||
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
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,61 +13,72 @@
|
|||
#
|
||||
|
||||
class MessageTemplate < ApplicationRecord
|
||||
PLATFORM = 'GitLink'
|
||||
|
||||
def self.build_init_data
|
||||
MessageTemplate::IssueAssignerExpire.destroy_all
|
||||
MessageTemplate::IssueCreatorExpire.destroy_all
|
||||
self.create(type: 'MessageTemplate::FollowedTip', sys_notice: '<b>{nickname}</b> 关注了你', notification_url: '{baseurl}/{login}')
|
||||
email_html = File.read("#{email_template_html_dir}/issue_assigned.html")
|
||||
self.create(type: 'MessageTemplate::IssueAssigned', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 指派给你一个疑修:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}', email: email_html, email_title: 'GitLink: {nickname1} 在 {nickname2}/{repository} 指派给你一个疑修')
|
||||
self.create(type: 'MessageTemplate::IssueAssignerExpire', sys_notice: '您负责的疑修 <b>{title}</b> 已临近截止日期,请尽快处理', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}')
|
||||
self.create(type: 'MessageTemplate::IssueAssigned', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 指派给你一个疑修:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}', email: email_html, email_title: "#{PLATFORM}: {nickname1} 在 {nickname2}/{repository} 指派给你一个疑修")
|
||||
self.create(type: 'MessageTemplate::IssueAtme', sys_notice: '<b>{nickname}</b> 在疑修 <b>{title}</b> 中@我', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}')
|
||||
email_html = File.read("#{email_template_html_dir}/issue_changed.html")
|
||||
self.create(type: 'MessageTemplate::IssueChanged', sys_notice: '在项目 <b>{nickname2}/{repository}</b> 的疑修 <b>{title}</b> 中:{ifassigner}{nickname1}将负责人从 <b>{assigner1}</b> 修改为 <b>{assigner2}</b> {endassigner}{ifstatus}{nickname1}将状态从 <b>{status1}</b> 修改为 <b>{status2}</b> {endstatus}{iftracker}{nickname1}将类型从 <b>{tracker1}</b> 修改为 <b>{tracker2}</b> {endtracker}{ifpriority}{nickname1}将优先级从 <b>{priority1}</b> 修改为 <b>{priority2}</b> {endpriority}{ifmilestone}{nickname1}将里程碑从 <b>{milestone1}</b> 修改为 <b>{milestone2}</b> {endmilestone}{iftag}{nickname1}将标记从 <b>{tag1}</b> 修改为 <b>{tag2}</b> {endtag}{ifdoneratio}{nickname1}将完成度从 <b>{doneratio1}</b> 修改为 <b>{doneratio2}</b> {enddoneratio}{ifbranch}{nickname1}将指定分支从 <b>{branch1}</b> 修改为 <b>{branch2}</b> {endbranch}{ifstartdate}{nickname1}将开始日期从 <b>{startdate1}</b> 修改为 <b>{startdate2}</b> {endstartdate}{ifduedate}{nickname1}将结束日期从 <b>{duedate1}</b> 修改为 <b>{duedate2}</b> {endduedate}', email: email_html, email_title: 'GitLink: 疑修 {title} 有状态变更', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}')
|
||||
self.create(type: 'MessageTemplate::IssueCreatorExpire', sys_notice: '您发布的疑修 <b>{title}</b> 已临近截止日期,请尽快处理', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}')
|
||||
self.create(type: 'MessageTemplate::IssueChanged', sys_notice: '在项目 <b>{nickname2}/{repository}</b> 的疑修 <b>{title}</b> 中:{ifassigner}{nickname1}将负责人从 <b>{assigner1}</b> 修改为 <b>{assigner2}</b> {endassigner}{ifstatus}{nickname1}将状态从 <b>{status1}</b> 修改为 <b>{status2}</b> {endstatus}{iftracker}{nickname1}将类型从 <b>{tracker1}</b> 修改为 <b>{tracker2}</b> {endtracker}{ifpriority}{nickname1}将优先级从 <b>{priority1}</b> 修改为 <b>{priority2}</b> {endpriority}{ifmilestone}{nickname1}将里程碑从 <b>{milestone1}</b> 修改为 <b>{milestone2}</b> {endmilestone}{iftag}{nickname1}将标记从 <b>{tag1}</b> 修改为 <b>{tag2}</b> {endtag}{ifdoneratio}{nickname1}将完成度从 <b>{doneratio1}</b> 修改为 <b>{doneratio2}</b> {enddoneratio}{ifbranch}{nickname1}将指定分支从 <b>{branch1}</b> 修改为 <b>{branch2}</b> {endbranch}{ifstartdate}{nickname1}将开始日期从 <b>{startdate1}</b> 修改为 <b>{startdate2}</b> {endstartdate}{ifduedate}{nickname1}将结束日期从 <b>{duedate1}</b> 修改为 <b>{duedate2}</b> {endduedate}', email: email_html, email_title: "#{PLATFORM}: 疑修 {title} 有状态变更", notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}')
|
||||
email_html = File.read("#{email_template_html_dir}/issue_expire.html")
|
||||
self.create(type: 'MessageTemplate::IssueExpire', sys_notice: '疑修 <b>{title}</b> 已临近截止日期,请尽快处理', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}', email: email_html, email_title: "#{PLATFORM}: 疑修截止日期到达最后一天")
|
||||
email_html = File.read("#{email_template_html_dir}/issue_deleted.html")
|
||||
self.create(type: 'MessageTemplate::IssueDeleted', sys_notice: '{nickname}已将疑修 <b>{title}</b> 删除', email: email_html, email_title: 'GitLink: 疑修 {title} 有状态变更', notification_url: '')
|
||||
self.create(type: 'MessageTemplate::IssueDeleted', sys_notice: '{nickname}已将疑修 <b>{title}</b> 删除', email: email_html, email_title: "#{PLATFORM}: 疑修 {title} 有状态变更", notification_url: '')
|
||||
self.create(type: 'MessageTemplate::IssueJournal', sys_notice: '{nickname}评论疑修{title}:<b>{notes}</b>', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}')
|
||||
self.create(type: 'MessageTemplate::LoginIpTip', sys_notice: '您的账号{nickname}于{login_time)在非常用的IP地址{ip}登录,如非本人操作,请立即修改密码', notification_url: '')
|
||||
email_html = File.read("#{email_template_html_dir}/organization_joined.html")
|
||||
self.create(type: 'MessageTemplate::OrganizationJoined', sys_notice: '你已加入 <b>{organization}</b> 组织', notification_url: '{baseurl}/{login}', email: email_html, email_title: 'GitLink: 你已加入 {organization} 组织')
|
||||
self.create(type: 'MessageTemplate::OrganizationJoined', sys_notice: '你已加入 <b>{organization}</b> 组织', notification_url: '{baseurl}/{login}', email: email_html, email_title: "#{PLATFORM}: 你已加入 {organization} 组织")
|
||||
email_html = File.read("#{email_template_html_dir}/organization_left.html")
|
||||
self.create(type: 'MessageTemplate::OrganizationLeft', sys_notice: '你已被移出 <b>{organization}</b> 组织', notification_url: '', email: email_html, email_title: 'GitLink: 你已被移出 {organization} 组织')
|
||||
self.create(type: 'MessageTemplate::OrganizationLeft', sys_notice: '你已被移出 <b>{organization}</b> 组织', notification_url: '', email: email_html, email_title: "#{PLATFORM}: 你已被移出 {organization} 组织")
|
||||
self.create(type: 'MessageTemplate::ProjectDeleted', sys_notice: '你关注的仓库{nickname}/{repository}已被删除', notification_url: '')
|
||||
self.create(type: 'MessageTemplate::ProjectFollowed', sys_notice: '<b>{nickname}</b> 关注了你管理的仓库', notification_url: '{baseurl}/{login}')
|
||||
self.create(type: 'MessageTemplate::ProjectForked', sys_notice: '<b>{nickname1}</b> 复刻了你管理的仓库{nickname1}/{repository1}到{nickname2}/{repository2}', notification_url: '{baseurl}/{owner}/{identifier}')
|
||||
self.create(type: 'MessageTemplate::ProjectForked', sys_notice: '<b>{nickname1}</b> 复刻了你管理的仓库 <b>{nickname2}/{repository}</b> 到 <b>{nickname1}/{repository}</b>', notification_url: '{baseurl}/{owner}/{identifier}')
|
||||
email_html = File.read("#{email_template_html_dir}/project_issue.html")
|
||||
self.create(type: 'MessageTemplate::ProjectIssue', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 新建疑修:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}', email: email_html, email_title: 'GitLink: {nickname1} 在 {nickname2}/{repository} 新建了一个疑修')
|
||||
self.create(type: 'MessageTemplate::ProjectIssue', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 新建疑修:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/issues/{id}', email: email_html, email_title: "#{PLATFORM}: {nickname1} 在 {nickname2}/{repository} 新建了一个疑修")
|
||||
email_html = File.read("#{email_template_html_dir}/project_joined.html")
|
||||
self.create(type: 'MessageTemplate::ProjectJoined', sys_notice: '你已加入 <b>{repository}</b> 项目', notification_url: '{baseurl}/{owner}/{identifier}', email: email_html, email_title: 'GitLink: 你已加入 {repository} 项目')
|
||||
self.create(type: 'MessageTemplate::ProjectJoined', sys_notice: '你已加入 <b>{repository}</b> 项目', notification_url: '{baseurl}/{owner}/{identifier}', email: email_html, email_title: "#{PLATFORM}: 你已加入 {repository} 项目")
|
||||
email_html = File.read("#{email_template_html_dir}/project_left.html")
|
||||
self.create(type: 'MessageTemplate::ProjectLeft', sys_notice: '你已被移出 <b>{repository}</b> 项目', notification_url: '', email: email_html, email_title: 'GitLink: 你已被移出 {repository} 项目')
|
||||
self.create(type: 'MessageTemplate::ProjectLeft', sys_notice: '你已被移出 <b>{repository}</b> 项目', notification_url: '', email: email_html, email_title: "#{PLATFORM}: 你已被移出 {repository} 项目")
|
||||
email_html = File.read("#{email_template_html_dir}/project_member_joined.html")
|
||||
self.create(type: 'MessageTemplate::ProjectMemberJoined', sys_notice: '<b>{nickname1}</b> 已加入项目 <b>{nickname2}/{repository}</b>', notification_url: '{baseurl}/{owner}/{identifier}', email: email_html, email_title: 'GitLink: {nickname1} 已加入项目 {nickname2}/{repository}')
|
||||
self.create(type: 'MessageTemplate::ProjectMemberJoined', sys_notice: '<b>{nickname1}</b> 已加入项目 <b>{nickname2}/{repository}</b>', notification_url: '{baseurl}/{owner}/{identifier}', email: email_html, email_title: "#{PLATFORM}: {nickname1} 已加入项目 {nickname2}/{repository}")
|
||||
email_html = File.read("#{email_template_html_dir}/project_member_left.html")
|
||||
self.create(type: 'MessageTemplate::ProjectMemberLeft', sys_notice: '<b>{nickname1}</b> 已被移出项目 <b>{nickname2}/{repository}</b>', notification_url: '{baseurl}/{owner}/{identifier}', email: email_html, email_title: 'GitLink: {nickname1} 已被移出项目 {nickname2}/{repository}')
|
||||
self.create(type: 'MessageTemplate::ProjectMilestone', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 创建了一个里程碑:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/milestones/{id}')
|
||||
self.create(type: 'MessageTemplate::ProjectPraised', sys_notice: '<b>{nickname}</b> 点赞了你管理的仓库', notification_url: '{baseurl}/{login}')
|
||||
self.create(type: 'MessageTemplate::ProjectMemberLeft', sys_notice: '<b>{nickname1}</b> 已被移出项目 <b>{nickname2}/{repository}</b>', notification_url: '{baseurl}/{owner}/{identifier}', email: email_html, email_title: "#{PLATFORM}: {nickname1} 已被移出项目 {nickname2}/{repository}")
|
||||
email_html = File.read("#{email_template_html_dir}/project_milestone.html")
|
||||
self.create(type: 'MessageTemplate::ProjectMilestone', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 创建了一个里程碑:<b>{name}</b>', notification_url: '{baseurl}/{owner}/{identifier}/milestones/{id}', email: email_html, email_title: "#{PLATFORM}: {nickname1} 在 {nickname2}/{repository} 新建了一个里程碑")
|
||||
email_html = File.read("#{email_template_html_dir}/project_milestone_completed.html")
|
||||
self.create(type: 'MessageTemplate::ProjectMilestoneCompleted', sys_notice: '在 <b>{nickname}/{repository}</b> 仓库,里程碑 <b>{name}</b> 的完成度已达到100%', notification_url: '{baseurl}/{owner}/{identifier}/milestones/{id}', email: email_html, email_title: "#{PLATFORM}: 仓库 {nickname}/{repository} 有里程碑已完成")
|
||||
self.create(type: 'MessageTemplate::ProjectPraised', sys_notice: '<b>{nickname1}</b> 点赞了你管理的仓库 <b>{nickname2}/{repository}</b>', notification_url: '{baseurl}/{login}')
|
||||
email_html = File.read("#{email_template_html_dir}/project_pull_request.html")
|
||||
self.create(type: 'MessageTemplate::ProjectPullRequest', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 提交了一个合并请求:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}', email: email_html, email_title: 'GitLink: {nickname1} 在 {nickname2}/{repository} 提交了一个合并请求')
|
||||
self.create(type: 'MessageTemplate::ProjectPullRequest', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 提交了一个合并请求:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}', email: email_html, email_title: "#{PLATFORM}: {nickname1} 在 {nickname2}/{repository} 提交了一个合并请求")
|
||||
email_html = File.read("#{email_template_html_dir}/project_role.html")
|
||||
self.create(type: 'MessageTemplate::ProjectRole', sys_notice: '仓库 <b>{nickname}/{repository}</b> 已把你的角色改为 <b>{role}</b>', email: email_html, email_title: 'GitLink: 在 {nickname}/{repository} 项目你的账号有权限变更', notification_url: '{baseurl}/{owner}/{identifier}')
|
||||
self.create(type: 'MessageTemplate::ProjectRole', sys_notice: '仓库 <b>{nickname}/{repository}</b> 已把你的角色改为 <b>{role}</b>', email: email_html, email_title: '#{PLATFORM}: 在 {nickname}/{repository} 项目你的账号有权限变更', notification_url: '{baseurl}/{owner}/{identifier}')
|
||||
email_html = File.read("#{email_template_html_dir}/project_setting_changed.html")
|
||||
self.create(type: 'MessageTemplate::ProjectSettingChanged', sys_notice: '{nickname1}更改了 <b>{nickname2}/{repository}</b> 仓库设置:{ifname}更改项目名称为"<b>{name}</b>"{endname}{ifidentifier}更改项目标识为"<b>{identifier}</b>"{endidentifier}{ifdescription}更改项目简介为"<b>{description}</b>"{enddescription}{ifcategory}更改项目类别为"<b>{category}</b>"{endcategory}{iflanguage}更改项目语言为"<b>{language}</b>"{endlanguage}{ifpermission}将仓库设为"<b>{permission}</b>"{endpermission}{ifnavbar}将项目导航更改为"<b>{navbar}</b>"{endnavbar}', notification_url: '{baseurl}/{owner}/{identifier}/settings', email: email_html, email_title: 'GitLink: 您管理的仓库 {nickname2}/{repository} 仓库设置已被更改')
|
||||
self.create(type: 'MessageTemplate::ProjectSettingChanged', sys_notice: '{nickname1}更改了 <b>{nickname2}/{repository}</b> 仓库设置:{ifname}更改项目名称为"<b>{name}</b>"{endname}{ifidentifier}更改项目标识为"<b>{identifier}</b>"{endidentifier}{ifdescription}更改项目简介为"<b>{description}</b>"{enddescription}{ifcategory}更改项目类别为"<b>{category}</b>"{endcategory}{iflanguage}更改项目语言为"<b>{language}</b>"{endlanguage}{ifpermission}将仓库设为"<b>{permission}</b>"{endpermission}{ifnavbar}将项目导航更改为"<b>{navbar}</b>"{endnavbar}', notification_url: '{baseurl}/{owner}/{identifier}/settings', email: email_html, email_title: "#{PLATFORM}: 您管理的仓库 {nickname2}/{repository} 仓库设置已被更改")
|
||||
self.create(type: 'MessageTemplate::ProjectTransfer', sys_notice: '你关注的仓库{nickname1}/{repository1}已被转移至{nickname2}/{repository2}', notification_url: '{baseurl}/{owner}/{identifier}')
|
||||
self.create(type: 'MessageTemplate::ProjectVersion', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 创建了发行版:<b>{title}</b>', notification_url: '{baseurl}/{owner}/{identifier}/releases')
|
||||
email_html = File.read("#{email_template_html_dir}/pull_request_assigned.html")
|
||||
self.create(type: 'MessageTemplate::PullRequestAssigned', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 指派给你一个合并请求:<b>{title}<b>', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}', email: email_html, email_title: 'GitLink: {nickname1} 在 {nickname2}/{repository} 指派给你一个合并请求')
|
||||
self.create(type: 'MessageTemplate::PullRequestAssigned', sys_notice: '{nickname1}在 <b>{nickname2}/{repository}</b> 指派给你一个合并请求:<b>{title}<b>', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}', email: email_html, email_title: "#{PLATFORM}: {nickname1} 在 {nickname2}/{repository} 指派给你一个合并请求")
|
||||
self.create(type: 'MessageTemplate::PullRequestAtme', sys_notice: '<b>{nickname}</b> 在合并请求 <b>{title}</b> 中@我', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}')
|
||||
email_html = File.read("#{email_template_html_dir}/pull_request_changed.html")
|
||||
self.create(type: 'MessageTemplate::PullRequestChanged', sys_notice: '在项目{nickname2}/{repository}的合并请求 <b>{title}</b> 中:{ifassigner}{nickname1}将审查成员从 <b>{assigner1}</b> 修改为 <b>{assigner2}</b> {endassigner}{ifmilestone}{nickname1}将里程碑从 <b>{milestone1}</b> 修改为 <b>{milestone2}</b> {endmilestone}{iftag}{nickname1}将标记从 <b>{tag1}</b> 修改为 <b>{tag2}</b> {endtag}{ifpriority}{nickname1}将优先级从 <b>{priority1}</b> 修改为 <b>{priority2}</b> {endpriority}', email: email_html, email_title: 'GitLink: 合并请求 {title} 有状态变更', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}')
|
||||
self.create(type: 'MessageTemplate::PullRequestChanged', sys_notice: '在项目{nickname2}/{repository}的合并请求 <b>{title}</b> 中:{ifassigner}{nickname1}将审查成员从 <b>{assigner1}</b> 修改为 <b>{assigner2}</b> {endassigner}{ifmilestone}{nickname1}将里程碑从 <b>{milestone1}</b> 修改为 <b>{milestone2}</b> {endmilestone}{iftag}{nickname1}将标记从 <b>{tag1}</b> 修改为 <b>{tag2}</b> {endtag}{ifpriority}{nickname1}将优先级从 <b>{priority1}</b> 修改为 <b>{priority2}</b> {endpriority}', email: email_html, email_title: "#{PLATFORM}: 合并请求 {title} 有状态变更", notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}')
|
||||
email_html = File.read("#{email_template_html_dir}/pull_request_closed.html")
|
||||
self.create(type: 'MessageTemplate::PullRequestClosed', sys_notice: '你提交的合并请求:{title} <b>被拒绝</b>', email: email_html, email_title: 'GitLink: 合并请求 {title} 有状态变更', notification_url: '')
|
||||
self.create(type: 'MessageTemplate::PullRequestClosed', sys_notice: '你提交的合并请求:{title} <b>被拒绝</b>', email: email_html, email_title: "#{PLATFORM}: 合并请求 {title} 有状态变更", notification_url: '')
|
||||
self.create(type: 'MessageTemplate::PullRequestJournal', sys_notice: '{nickname}评论合并请求{title}:<b>{notes}</b>', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}')
|
||||
email_html = File.read("#{email_template_html_dir}/pull_request_merged.html")
|
||||
self.create(type: 'MessageTemplate::PullRequestMerged', sys_notice: '你提交的合并请求:{title} <b>已通过</b>', email: email_html, email_title: 'GitLink: 合并请求 {title} 有状态变更', notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}')
|
||||
self.create(type: 'MessageTemplate::PullRequestMerged', sys_notice: '你提交的合并请求:{title} <b>已通过</b>', email: email_html, email_title: "#{PLATFORM}: 合并请求 {title} 有状态变更", notification_url: '{baseurl}/{owner}/{identifier}/pulls/{id}')
|
||||
email_html = File.read("#{email_template_html_dir}/team_joined.html")
|
||||
self.create(type: 'MessageTemplate::TeamJoined', sys_notice: '你已被拉入组织 <b>{organization}</b> 的 <b>{team}</b> 团队,拥有<b>{role}</b>权限', email: email_html, email_title: 'GitLink: 在 {organization} 组织你的账号有权限变更', notification_url: '{baseurl}/{login}')
|
||||
self.create(type: 'MessageTemplate::TeamJoined', sys_notice: '你已被拉入组织 <b>{organization}</b> 的 <b>{team}</b> 团队,拥有<b>{role}</b>权限', email: email_html, email_title: "#{PLATFORM}: 在 {organization} 组织你的账号有权限变更", notification_url: '{baseurl}/{login}')
|
||||
email_html = File.read("#{email_template_html_dir}/team_left.html")
|
||||
self.create(type: 'MessageTemplate::TeamLeft', sys_notice: '你已被移出组织 <b>{organization}</b> 的 <b>{team}</b> 团队', email: email_html, email_title: 'GitLink: 在 {organization} 组织你的账号有权限变更', notification_url: '{baseurl}/{login}')
|
||||
self.create(type: 'MessageTemplate::TeamLeft', sys_notice: '你已被移出组织 <b>{organization}</b> 的 <b>{team}</b> 团队', email: email_html, email_title: "#{PLATFORM}: 在 {organization} 组织你的账号有权限变更", notification_url: '{baseurl}/{login}')
|
||||
|
||||
# 竞赛通知
|
||||
self.create(type: 'MessageTemplate::CompetitionBegin', sys_notice: '你报名的竞赛 <b>{competition_name}</b> 已进入比赛进行阶段,可在此期间提交作品', notification_url: '{to_url}')
|
||||
self.create(type: 'MessageTemplate::CompetitionResult', sys_notice: '你报名的竞赛 <b>{competition_name}</b> 已进入成绩公示阶段,可查看排行榜信息', notification_url: '{to_url}')
|
||||
self.create(type: 'MessageTemplate::CompetitionReview', sys_notice: '你报名的竞赛 <b>{competition_name}</b> 距作品提交结束日期仅剩3天,若尚未提交参赛作品,请尽快提交', notification_url: '{to_url}')
|
||||
end
|
||||
|
||||
def self.sys_notice
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: message_templates
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255)
|
||||
# sys_notice :text(65535)
|
||||
# email :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# notification_url :string(255)
|
||||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# 报名的竞赛进入比赛进行阶段
|
||||
# 触发场景
|
||||
# 赛队成员报名的竞赛已进入比赛进行阶段
|
||||
# 通知文案格式
|
||||
# 你报名的竞赛 xxx 已进入比赛进行阶段,可在此阶段提交作品
|
||||
# 时间:x分钟/小时/天/月前
|
||||
# 通知文案示例
|
||||
# 你报名的竞赛 代码审查大赛 已进入比赛进行阶段,可在此期间提交作品
|
||||
# 时间:3小时前
|
||||
# 点击通知跳转页面
|
||||
# 点击此通知将跳转到代码审查大赛详情页:
|
||||
# http://117.50.100.12:8080/competitions/lgw7st/home
|
||||
class MessageTemplate::CompetitionBegin < MessageTemplate
|
||||
|
||||
# MessageTemplate::FollowedTip.get_message_content(User.where(login: 'yystopf'), User.last)
|
||||
def self.get_message_content(receivers, competition)
|
||||
return receivers_string(receivers), sys_notice.to_s.gsub('{competition_name}', competition&.name), notification_url.to_s.gsub('{to_url}', "/competitions/#{competition.identifier}/home")
|
||||
# rescue
|
||||
# return '', '', ''
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: message_templates
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255)
|
||||
# sys_notice :text(65535)
|
||||
# email :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# notification_url :string(255)
|
||||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# 报名的竞赛进入成绩公示阶段
|
||||
# 触发场景
|
||||
# 赛队成员报名的竞赛已进入成绩公示阶段
|
||||
# 通知文案格式
|
||||
# 你报名的竞赛 xxx 已进入成绩公示阶段,可查看排行榜信息
|
||||
# 时间:x分钟/小时/天/月前
|
||||
# 通知文案示例
|
||||
# 你报名的竞赛 代码审查大赛 已进入成绩公示阶段,可查看排行榜信息
|
||||
# 时间:3小时前
|
||||
# 点击通知跳转页面
|
||||
# 点击此通知将跳转到代码审查大赛详情页:
|
||||
# http://117.50.100.12:8080/competitions/lgw7st/home
|
||||
class MessageTemplate::CompetitionResult < MessageTemplate
|
||||
|
||||
# MessageTemplate::FollowedTip.get_message_content(User.where(login: 'yystopf'), User.last)
|
||||
def self.get_message_content(receivers, competition)
|
||||
return receivers_string(receivers), sys_notice.gsub('{competition_name}', competition&.title), notification_url.gsub('{to_url}', "/competitions/#{competition.identifier}/home")
|
||||
rescue
|
||||
return '', '', ''
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: message_templates
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255)
|
||||
# sys_notice :text(65535)
|
||||
# email :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# notification_url :string(255)
|
||||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# 报名的竞赛比赛结束时间临近
|
||||
# 触发场景
|
||||
# 赛队成员报名的竞赛阶段处于比赛进行中,且距比赛结束日期仅剩3天
|
||||
# 通知文案格式
|
||||
# 你报名的竞赛 xxx 距作品提交结束日期仅剩3天,若尚未提交参赛作品,请尽快提交
|
||||
# 时间:x分钟/小时/天/月前
|
||||
# 通知文案示例
|
||||
# 你报名的竞赛 代码审查大赛 距作品提交结束日期仅剩3天,若尚未提交参赛作品,请尽快提交
|
||||
# 时间:3小时前
|
||||
# 点击通知跳转页面
|
||||
# 点击此通知将跳转到代码审查大赛详情页:
|
||||
# http://117.50.100.12:8080/competitions/lgw7st/home
|
||||
class MessageTemplate::CompetitionReview < MessageTemplate
|
||||
|
||||
# MessageTemplate::FollowedTip.get_message_content(User.where(login: 'yystopf'), User.last)
|
||||
def self.get_message_content(receivers, competition)
|
||||
return receivers_string(receivers), sys_notice.gsub('{competition_name}', competition&.title), notification_url.gsub('{to_url}', "/competitions/#{competition.identifier}/home")
|
||||
rescue
|
||||
return '', '', ''
|
||||
end
|
||||
end
|
||||
|
|
@ -53,6 +53,7 @@ class MessageTemplate::IssueAssigned < MessageTemplate
|
|||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{title}', issue&.subject)
|
||||
content.gsub!('{id}', issue&.id.to_s)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -359,6 +359,7 @@ class MessageTemplate::IssueChanged < MessageTemplate
|
|||
else
|
||||
content.gsub!(/({ifduedate})(.*)({endduedate})/, '')
|
||||
end
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,29 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: message_templates
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255)
|
||||
# sys_notice :text(65535)
|
||||
# email :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# notification_url :string(255)
|
||||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# 我创建的疑修截止日期到达最后一天
|
||||
class MessageTemplate::IssueCreatorExpire < MessageTemplate
|
||||
|
||||
# MessageTemplate::IssueCreatorExpire.get_message_content(User.where(login: 'yystopf'), Issue.last)
|
||||
def self.get_message_content(receivers, issue)
|
||||
project = issue&.project
|
||||
owner = project&.owner
|
||||
content = sys_notice.gsub('{title}', issue&.subject)
|
||||
url = notification_url.gsub('{owner}', owner&.login).gsub('{identifier}', project&.identifier).gsub('{id}', issue&.id.to_s)
|
||||
return receivers_string(receivers), content, url
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::IssueAssignerExpire.get_message_content [ERROR] #{e}")
|
||||
return '', '', ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -41,6 +41,7 @@ class MessageTemplate::IssueDeleted < MessageTemplate
|
|||
content.gsub!('{login}', operator&.login)
|
||||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{title}', issue_title)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: message_templates
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255)
|
||||
# sys_notice :text(65535)
|
||||
# email :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# notification_url :string(255)
|
||||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# 我创建或负责的疑修截止日期到达最后一天
|
||||
class MessageTemplate::IssueExpire < MessageTemplate
|
||||
|
||||
# MessageTemplate::IssueCreatorExpire.get_message_content(User.where(login: 'yystopf'), Issue.last)
|
||||
def self.get_message_content(receivers, issue)
|
||||
receivers.each do |receiver|
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.notification_body["CreateOrAssign::IssueExpire"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_notification_body["CreateOrAssign::IssueExpire"] : send_setting
|
||||
receivers = receivers.where.not(id: receiver.id) unless send_setting
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
project = issue&.project
|
||||
owner = project&.owner
|
||||
content = sys_notice.gsub('{title}', issue&.subject)
|
||||
url = notification_url.gsub('{owner}', owner&.login).gsub('{identifier}', project&.identifier).gsub('{id}', issue&.id.to_s)
|
||||
|
||||
return receivers_string(receivers), content, url
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::IssueExpire.get_message_content [ERROR] #{e}")
|
||||
return '', '', ''
|
||||
end
|
||||
|
||||
def self.get_email_message_content(receiver, issue)
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.email_body["CreateOrAssign::IssueExpire"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_email_body["CreateOrAssign::IssueExpire"] : send_setting
|
||||
return '', '', '' unless send_setting
|
||||
project = issue&.project
|
||||
owner = project&.owner
|
||||
title = email_title
|
||||
|
||||
content = email
|
||||
content.gsub!('{receiver}', receiver&.real_name)
|
||||
content.gsub!('{nickname}', owner&.real_name)
|
||||
content.gsub!('{login}', owner&.login)
|
||||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{title}', issue&.subject)
|
||||
content.gsub!('{id}', issue&.id.to_s)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
return '', '', ''
|
||||
end
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::IssueExpire.get_email_message_content [ERROR] #{e}")
|
||||
return '', '', ''
|
||||
end
|
||||
end
|
||||
|
|
@ -41,6 +41,7 @@ class MessageTemplate::OrganizationJoined < MessageTemplate
|
|||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{login}', organization&.login)
|
||||
content.gsub!('{organization}', organization&.real_name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class MessageTemplate::OrganizationLeft < MessageTemplate
|
|||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{login}', organization&.login)
|
||||
content.gsub!('{organization}', organization&.real_name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class MessageTemplate::OrganizationRole < MessageTemplate
|
|||
content.gsub!('{login}', organization&.login)
|
||||
content.gsub!('{organization}', organization&.real_name)
|
||||
content.gsub!('{role}', role)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -12,11 +12,21 @@
|
|||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# TODO 我管理的仓库被复刻
|
||||
# 我管理的仓库被复刻
|
||||
class MessageTemplate::ProjectForked < MessageTemplate
|
||||
|
||||
# MessageTemplate::ProjectForked.get_message_content(User.where(login: 'yystopf'))
|
||||
def self.get_message_content(receivers)
|
||||
def self.get_message_content(receivers, user, project)
|
||||
receivers.each do |receiver|
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.notification_body["ManageProject::Forked"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_notification_body["ManageProject::Forked"] : send_setting
|
||||
receivers = receivers.where.not(id: receiver.id) unless send_setting
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
content = sys_notice.gsub('{nickname1}', user&.real_name).gsub('{nickname2}', project&.owner&.real_name).gsub('{repository}', project&.name)
|
||||
url = notification_url.gsub('{owner}', user&.login).gsub('{identifier}', project&.identifier)
|
||||
return receivers_string(receivers), content, url
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::ProjectForked.get_message_content [ERROR] #{e}")
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class MessageTemplate::ProjectIssue < MessageTemplate
|
|||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{id}', issue&.id.to_s)
|
||||
content.gsub!('{title}', issue&.subject)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class MessageTemplate::ProjectJoined < MessageTemplate
|
|||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{nickname}', project&.owner&.real_name)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class MessageTemplate::ProjectLeft < MessageTemplate
|
|||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{nickname}', project&.owner&.real_name)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class MessageTemplate::ProjectMemberJoined < MessageTemplate
|
|||
content.gsub!('{nickname1}', user&.real_name)
|
||||
content.gsub!('{nickname2}', project&.owner&.real_name)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class MessageTemplate::ProjectMemberLeft < MessageTemplate
|
|||
content.gsub!('{nickname1}', user&.real_name)
|
||||
content.gsub!('{nickname2}', project&.owner&.real_name)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -12,14 +12,61 @@
|
|||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# TODO 我管理的仓库有新的里程碑
|
||||
# 我管理的仓库有新的里程碑
|
||||
class MessageTemplate::ProjectMilestone < MessageTemplate
|
||||
|
||||
# MessageTemplate::ProjectMilestone.get_message_content(User.where(login: 'yystopf'))
|
||||
def self.get_message_content(receivers)
|
||||
def self.get_message_content(receivers, operator, milestone)
|
||||
receivers.each do |receiver|
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.notification_body["ManageProject::Milestone"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_notification_body["ManageProject::Milestone"] : send_setting
|
||||
receivers = receivers.where.not(id: receiver.id) unless receiver.user_template_message_setting.notification_body["ManageProject::Milestone"]
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
project = milestone&.project
|
||||
owner = project&.owner
|
||||
content = sys_notice.gsub('{nickname1}', operator&.real_name).gsub('{nickname2}', owner&.real_name).gsub('{repository}', project&.name).gsub('{name}', milestone&.name)
|
||||
url = notification_url.gsub('{owner}', owner&.login).gsub('{identifier}', project&.identifier).gsub('{id}', milestone&.id.to_s)
|
||||
|
||||
return receivers_string(receivers), content, url
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::ProjectMilestone.get_message_content [ERROR] #{e}")
|
||||
return '', '', ''
|
||||
end
|
||||
|
||||
def self.get_email_message_content(receiver, operator, milestone)
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.email_body["ManageProject::Milestone"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_email_body["ManageProject::Milestone"] : send_setting
|
||||
return '', '', '' unless send_setting
|
||||
project = milestone&.project
|
||||
owner = project&.owner
|
||||
title = email_title
|
||||
title.gsub!('{nickname1}', operator&.real_name)
|
||||
title.gsub!('{nickname2}', owner&.real_name)
|
||||
title.gsub!('{repository}', project&.name)
|
||||
|
||||
content = email
|
||||
content.gsub!('{receiver}', receiver&.real_name)
|
||||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{nickname1}', operator&.real_name)
|
||||
content.gsub!('{nickname2}', owner&.real_name)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{login}', owner&.login)
|
||||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{id}', milestone&.id.to_s)
|
||||
content.gsub!('{name}', milestone&.name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
return '', '', ''
|
||||
end
|
||||
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::ProjectMilestone.get_email_message_content [ERROR] #{e}")
|
||||
return '', '', ''
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: message_templates
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255)
|
||||
# sys_notice :text(65535)
|
||||
# email :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# notification_url :string(255)
|
||||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# 我管理的仓库有里程碑完成
|
||||
class MessageTemplate::ProjectMilestoneCompleted < MessageTemplate
|
||||
|
||||
# MessageTemplate::ProjectMilestoneCompleted.get_message_content(User.where(login: 'yystopf'))
|
||||
def self.get_message_content(receivers, milestone)
|
||||
receivers.each do |receiver|
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.notification_body["ManageProject::MilestoneCompleted"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_notification_body["ManageProject::MilestoneCompleted"] : send_setting
|
||||
receivers = receivers.where.not(id: receiver.id) unless send_setting
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
project = milestone&.project
|
||||
owner = project&.owner
|
||||
content = sys_notice.gsub('{nickname}', owner&.real_name).gsub('{repository}', project&.name).gsub('{name}', milestone&.name)
|
||||
url = notification_url.gsub('{owner}', owner&.login).gsub('{identifier}', project&.identifier).gsub('{id}', milestone&.id.to_s)
|
||||
|
||||
return receivers_string(receivers), content, url
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::ProjectMilestoneCompleted.get_message_content [ERROR] #{e}")
|
||||
return '', '', ''
|
||||
end
|
||||
|
||||
def self.get_email_message_content(receiver, milestone)
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.email_body["ManageProject::MilestoneCompleted"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_email_body["ManageProject::MilestoneCompleted"] : send_setting
|
||||
return '', '', '' unless send_setting
|
||||
project = milestone&.project
|
||||
owner = project&.owner
|
||||
title = email_title
|
||||
title.gsub!('{nickname}', owner&.real_name)
|
||||
title.gsub!('{repository}', project&.name)
|
||||
|
||||
content = email
|
||||
content.gsub!('{receiver}', receiver&.real_name)
|
||||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{nickname}', owner&.real_name)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{login}', owner&.login)
|
||||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{id}', milestone&.id.to_s)
|
||||
content.gsub!('{name}', milestone&.name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
return '', '', ''
|
||||
end
|
||||
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::ProjectMilestoneCompleted.get_email_message_content [ERROR] #{e}")
|
||||
return '', '', ''
|
||||
end
|
||||
end
|
||||
|
|
@ -12,11 +12,21 @@
|
|||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# TODO 我管理的仓库被点赞
|
||||
# 我管理的仓库被点赞
|
||||
class MessageTemplate::ProjectPraised < MessageTemplate
|
||||
|
||||
# MessageTemplate::ProjectPraised.get_message_content(User.where(login: 'yystopf'))
|
||||
def self.get_message_content(receivers)
|
||||
def self.get_message_content(receivers, user, project)
|
||||
receivers.each do |receiver|
|
||||
if receiver.user_template_message_setting.present?
|
||||
send_setting = receiver.user_template_message_setting.notification_body["ManageProject::Praised"]
|
||||
send_setting = send_setting.nil? ? UserTemplateMessageSetting.init_notification_body["ManageProject::Praised"] : send_setting
|
||||
receivers = receivers.where.not(id: receiver.id) unless send_setting
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
content = sys_notice.gsub('{nickname1}', user&.real_name).gsub('{nickname2}', project&.owner&.real_name).gsub('{repository}', project&.name)
|
||||
url = notification_url.gsub('{login}', user&.login)
|
||||
return receivers_string(receivers), content, url
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::ProjectPraised.get_message_content [ERROR] #{e}")
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class MessageTemplate::ProjectPullRequest < MessageTemplate
|
|||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{id}', pull_request&.id.to_s)
|
||||
content.gsub!('{title}', pull_request&.title)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class MessageTemplate::ProjectRole < MessageTemplate
|
|||
content.gsub!('{identifier}', project&.identifier)
|
||||
content.gsub!('{repository}', project&.name)
|
||||
content.gsub!('{role}', role)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ class MessageTemplate::ProjectSettingChanged < MessageTemplate
|
|||
else
|
||||
content.gsub!(/({ifnavbar})(.*)({endnavbar})/, '')
|
||||
end
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class MessageTemplate::PullRequestAssigned < MessageTemplate
|
|||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{title}', pull_request&.title)
|
||||
content.gsub!('{id}', pull_request&.id.to_s)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ class MessageTemplate::PullRequestChanged < MessageTemplate
|
|||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{title}', pull_request&.title)
|
||||
content.gsub!('{id}', pull_request&.id.to_s)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
change_count = change_params.keys.size
|
||||
# 合并请求审查成员修改
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class MessageTemplate::PullRequestClosed < MessageTemplate
|
|||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{title}', pull_request&.title)
|
||||
content.gsub!('{id}', pull_request&.id.to_s)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class MessageTemplate::PullRequestMerged < MessageTemplate
|
|||
content.gsub!('{baseurl}', base_url)
|
||||
content.gsub!('{title}', pull_request&.title)
|
||||
content.gsub!('{id}', pull_request&.id.to_s)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class MessageTemplate::TeamJoined < MessageTemplate
|
|||
content.gsub!('{organization}', organization&.real_name)
|
||||
content.gsub!('{team}', team&.nickname)
|
||||
content.gsub!('{role}', team&.authorize_name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class MessageTemplate::TeamLeft < MessageTemplate
|
|||
content.gsub!('{organization}', organization&.real_name)
|
||||
content.gsub!('{team}', team&.nickname)
|
||||
content.gsub!('{role}', team&.authorize_name)
|
||||
content.gsub!('{platform}', PLATFORM)
|
||||
|
||||
return receiver&.mail, title, content
|
||||
else
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ class Project < ApplicationRecord
|
|||
has_many :has_pinned_users, through: :pinned_projects, source: :user
|
||||
has_many :webhooks, class_name: "Gitea::Webhook", primary_key: :gpid, foreign_key: :repo_id
|
||||
after_create :incre_user_statistic, :incre_platform_statistic
|
||||
after_save :check_project_members, :reset_cache_data
|
||||
before_save :set_invite_code, :reset_unmember_followed, :set_recommend_and_is_pinned
|
||||
after_save :check_project_members
|
||||
before_save :set_invite_code, :reset_unmember_followed, :set_recommend_and_is_pinned, :reset_cache_data
|
||||
before_destroy :decre_project_common, :decre_forked_from_project_count
|
||||
after_destroy :decre_user_statistic, :decre_platform_statistic
|
||||
scope :project_statics_select, -> {select(:id,:name, :is_public, :identifier, :status, :project_type, :user_id, :forked_count, :description, :visits, :project_category_id, :project_language_id, :license_id, :ignore_id, :watchers_count, :created_on)}
|
||||
|
|
@ -154,7 +154,7 @@ class Project < ApplicationRecord
|
|||
end
|
||||
|
||||
def reset_cache_data
|
||||
CacheAsyncResetJob.perform_later("project_common_service", self.id)
|
||||
CacheAsyncResetJob.set(wait: 5.seconds).perform_later("project_common_service", self.id)
|
||||
if changes[:user_id].present?
|
||||
CacheAsyncSetJob.perform_later("user_statistic_service", {project_count: -1}, changes[:user_id].first)
|
||||
CacheAsyncSetJob.perform_later("user_statistic_service", {project_count: 1}, changes[:user_id].last)
|
||||
|
|
@ -167,6 +167,14 @@ class Project < ApplicationRecord
|
|||
CacheAsyncSetJob.perform_later("platform_statistic_service", {project_language_count_key: first_language&.name, project_language_count: -1})
|
||||
CacheAsyncSetJob.perform_later("platform_statistic_service", {project_language_count_key: last_language&.name, project_language_count: 1})
|
||||
end
|
||||
if changes[:is_public].present?
|
||||
if changes[:is_public][0] && !changes[:is_public][1]
|
||||
CacheAsyncClearJob.perform_later('project_rank_service', self.id)
|
||||
end
|
||||
if !changes[:is_public][0] && changes[:is_public][1]
|
||||
$redis_cache.srem("v2-project-rank-deleted", self.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def decre_project_common
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ class Team < ApplicationRecord
|
|||
has_many :team_units, dependent: :destroy
|
||||
has_many :team_users, dependent: :destroy
|
||||
|
||||
scope :like, lambda { |keywords|
|
||||
sql = "teams.nickname LIKE :search OR teams.name LIKE :search"
|
||||
where(sql, :search => "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
|
||||
}
|
||||
|
||||
validates :name, uniqueness: {scope: :organization_id}
|
||||
|
||||
enum authorize: {read: 1, write: 2, admin: 3, owner: 4}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class TeamUser < ApplicationRecord
|
|||
before_destroy :remove_project_member
|
||||
|
||||
def self.build(organization_id, user_id, team_id)
|
||||
self.create!(organization_id: organization_id, user_id: user_id, team_id: team_id)
|
||||
self.find_or_create_by!(organization_id: organization_id, user_id: user_id, team_id: team_id)
|
||||
end
|
||||
|
||||
def remove_project_member
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class TemplateMessageSetting < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.build_init_data
|
||||
TemplateMessageSetting.destroy_all
|
||||
TemplateMessageSetting::CreateOrAssign.build_init_data
|
||||
TemplateMessageSetting::ManageProject.build_init_data
|
||||
TemplateMessageSetting::Normal.build_init_data
|
||||
|
|
|
|||
|
|
@ -27,5 +27,6 @@ class TemplateMessageSetting::CreateOrAssign < TemplateMessageSetting
|
|||
def self.build_init_data
|
||||
self.find_or_create_by(name: "疑修状态变更", key: "IssueChanged")
|
||||
self.find_or_create_by(name: "合并请求状态变更", key: "PullRequestChanged")
|
||||
self.find_or_create_by(name: "疑修截止日期到达最后一天", key: "IssueExpire", notification_disabled: false)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,5 +29,9 @@ class TemplateMessageSetting::ManageProject < TemplateMessageSetting
|
|||
self.find_or_create_by(name: "有新的合并请求", key: "PullRequest")
|
||||
self.find_or_create_by(name: "有成员变动", key: "Member")
|
||||
self.find_or_create_by(name: "仓库设置被更改", key: "SettingChanged")
|
||||
self.find_or_create_by(name: "被点赞", key: "Praised", notification_disabled: false, email_disabled: true)
|
||||
self.find_or_create_by(name: "被fork", key: "Forked", notification_disabled: false, email_disabled: true)
|
||||
self.find_or_create_by(name: "有新的里程碑", key: "Milestone", notification_disabled: false)
|
||||
self.find_or_create_by(name: "有里程碑已完成", key: "MilestoneCompleted", notification_disabled: false)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: trace_users
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer
|
||||
# username :string(255)
|
||||
# password :string(255)
|
||||
# unit :string(255)
|
||||
# telnumber :string(255)
|
||||
# email :string(255)
|
||||
# name :string(255)
|
||||
# token :text(65535)
|
||||
# expired_at :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_trace_users_on_user_id (user_id)
|
||||
#
|
||||
|
||||
# 代码溯源 用户
|
||||
class TraceUser < ApplicationRecord
|
||||
|
||||
belongs_to :user
|
||||
|
||||
|
||||
def build_self_data
|
||||
return if user.nil?
|
||||
|
||||
self.username = user.login
|
||||
self.password = SecureRandom.hex
|
||||
self.unit = user.custom_department.blank? ? 'GitLink' : user.custom_department
|
||||
self.telnumber = user.phone.blank? ? '13800000000' : user.phone
|
||||
self.email = user.mail
|
||||
self.name = user.nickname.blank? ? user.login : user.nickname
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
|
||||
def build_token
|
||||
return if username.blank? || password.blank? || unit.blank? || telnumber.blank? || email.blank? || name.blank?
|
||||
|
||||
response = Trace::AddUserService.call(username, password, unit, telnumber, email, name)
|
||||
self.token = response[1]['token']
|
||||
self.expired_at = Time.now + 1.hours
|
||||
end
|
||||
|
||||
def refresh_token
|
||||
return if username.blank? || password.blank? || unit.blank? || telnumber.blank? || email.blank? || name.blank?
|
||||
|
||||
response = Trace::LoginService.call(username, password)
|
||||
self.token = response[1]['token']
|
||||
self.expired_at = Time.now + 1.hours
|
||||
end
|
||||
end
|
||||
|
|
@ -173,6 +173,7 @@ class User < Owner
|
|||
|
||||
has_many :system_notification_histories
|
||||
has_many :system_notifications, through: :system_notification_histories
|
||||
has_one :trace_user, dependent: :destroy
|
||||
|
||||
# Groups and active users
|
||||
scope :active, lambda { where(status: STATUS_ACTIVE) }
|
||||
|
|
@ -776,6 +777,24 @@ class User < Owner
|
|||
self.nickname.present? && self.mail.present?
|
||||
end
|
||||
|
||||
def trace_token
|
||||
if trace_user.present?
|
||||
if trace_user.expired_at < Time.now
|
||||
trace_user.refresh_token
|
||||
trace_user.save
|
||||
end
|
||||
return trace_user.token
|
||||
else
|
||||
tu = TraceUser.new
|
||||
tu.user = self
|
||||
tu.build_self_data
|
||||
tu.build_token
|
||||
tu.save
|
||||
|
||||
return tu.token
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
def validate_password_length
|
||||
# 管理员的初始密码是5位
|
||||
|
|
|
|||
|
|
@ -35,10 +35,15 @@ class UserTemplateMessageSetting < ApplicationRecord
|
|||
"Normal::PullRequestAssigned": true,
|
||||
"CreateOrAssign::IssueChanged": true,
|
||||
"CreateOrAssign::PullRequestChanged": true,
|
||||
"CreateOrAssign::IssueExpire": true,
|
||||
"ManageProject::Issue": true,
|
||||
"ManageProject::PullRequest": true,
|
||||
"ManageProject::Member": true,
|
||||
"ManageProject::SettingChanged": true,
|
||||
"ManageProject::Praised": true,
|
||||
"ManageProject::Forked": true,
|
||||
"ManageProject::Milestone": true,
|
||||
"ManageProject::MilestoneCompleted": true,
|
||||
}.stringify_keys!
|
||||
end
|
||||
|
||||
|
|
@ -51,10 +56,15 @@ class UserTemplateMessageSetting < ApplicationRecord
|
|||
"Normal::PullRequestAssigned": false,
|
||||
"CreateOrAssign::IssueChanged": false,
|
||||
"CreateOrAssign::PullRequestChanged": false,
|
||||
"CreateOrAssign::IssueExpire": false,
|
||||
"ManageProject::Issue": false,
|
||||
"ManageProject::PullRequest": false,
|
||||
"ManageProject::Member": false,
|
||||
"ManageProject::SettingChanged": false,
|
||||
"ManageProject::Praised": false,
|
||||
"ManageProject::Forked": false,
|
||||
"ManageProject::Milestone": false,
|
||||
"ManageProject::MilestoneCompleted": false,
|
||||
}.stringify_keys!
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,19 @@ class Version < ApplicationRecord
|
|||
# issues.select(:id,:status_id).where(status_id: 5).size
|
||||
# end
|
||||
|
||||
after_create :send_create_message_to_notice_system
|
||||
after_save :send_update_message_to_notice_system
|
||||
|
||||
def version_user
|
||||
User.select(:login, :lastname,:firstname, :nickname)&.find_by_id(self.user_id)
|
||||
end
|
||||
|
||||
private
|
||||
def send_create_message_to_notice_system
|
||||
SendTemplateMessageJob.perform_later('ProjectMilestone', self.id, self.user_id) if Site.has_notice_menu?
|
||||
end
|
||||
|
||||
def send_update_message_to_notice_system
|
||||
SendTemplateMessageJob.perform_later('ProjectMilestoneCompleted', self.id) if Site.has_notice_menu? && self.percent == 1.0
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ class Cache::V2::UserDateRankService < ApplicationService
|
|||
end
|
||||
|
||||
def read_rank
|
||||
user_rank
|
||||
user_rank unless @user_id.blank?
|
||||
end
|
||||
|
||||
def read_statistic
|
||||
user_statistic
|
||||
user_statistic unless @user_id.blank?
|
||||
end
|
||||
|
||||
def call
|
||||
set_user_rank
|
||||
set_user_rank unless @user_id.blank?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class Gitea::ClientService < ApplicationService
|
|||
req.headers['Content-Type'] = 'application/json'
|
||||
req.response :logger # 显示日志
|
||||
req.adapter Faraday.default_adapter
|
||||
req.options.timeout = 100 # open/read timeout in seconds
|
||||
req.options.timeout = 1200 # open/read timeout in seconds
|
||||
req.options.open_timeout = 10 # connection open timeout in seconds
|
||||
if token.blank?
|
||||
req.basic_auth(username, secret)
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ class Issues::ListQueryService < ApplicationService
|
|||
end
|
||||
|
||||
if search_name.present?
|
||||
issues = issues.where("subject LIKE ? OR description LIKE ? ", "%#{search_name}%", "%#{search_name}%")
|
||||
issues = issues.where("issues.subject LIKE ? OR issues.description LIKE ? ", "%#{search_name}%", "%#{search_name}%")
|
||||
end
|
||||
|
||||
if start_time&.present? || end_time&.present?
|
||||
issues = issues.where("start_date between ? and ?",start_time&.present? ? start_time.to_date : Time.now.to_date, end_time&.present? ? end_time.to_date : Time.now.to_date)
|
||||
issues = issues.where("issues.start_date between ? and ?",start_time&.present? ? start_time.to_date : Time.now.to_date, end_time&.present? ? end_time.to_date : Time.now.to_date)
|
||||
end
|
||||
|
||||
issues = issues.where(author_id: params[:author_id]) if params[:author_id].present? && params[:author_id].to_s != "all"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ class Projects::ForkService < ApplicationService
|
|||
new_repository.update_column('url', result['clone_url']) if result
|
||||
|
||||
ForkUser.create(project_id: @project.id, fork_project_id: clone_project.id, user_id: clone_project.user_id)
|
||||
|
||||
SendTemplateMessageJob.perform_later('ProjectForked', @target_owner.id, @project.id) if Site.has_notice_menu?
|
||||
|
||||
clone_project
|
||||
end
|
||||
rescue => e
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Projects::TransferService < ApplicationService
|
|||
update_owner
|
||||
update_repo_url
|
||||
update_visit_teams
|
||||
update_fork_info
|
||||
end
|
||||
|
||||
Rails.logger.info("##### Project transfer_service end ######")
|
||||
|
|
@ -40,6 +41,11 @@ class Projects::TransferService < ApplicationService
|
|||
end
|
||||
end
|
||||
|
||||
def update_fork_info
|
||||
fork_user = ForkUser.find_by(user_id: @owner.id, fork_project_id: @project.id)
|
||||
fork_user.update(user_id: @new_owner.id) if fork_user.present?
|
||||
end
|
||||
|
||||
def gitea_update_owner
|
||||
begin
|
||||
@gitea_repo = Gitea::Repository::TransferService.call(owner&.gitea_token, owner&.login, project.identifier, new_owner&.login)
|
||||
|
|
|
|||
|
|
@ -125,12 +125,15 @@ class PullRequests::CreateService < ApplicationService
|
|||
end
|
||||
|
||||
def gitea_pull_request_params
|
||||
merge_original_pull_params.except(:milestone)
|
||||
assignee_login = User.find_by_id(params[:assigned_to_id])&.login
|
||||
merge_original_pull_params.except(:milestone).merge(
|
||||
# assignees: ["#{params[:assigned_login].to_s}"],
|
||||
assignees: ["#{assignee_login.to_s}"])
|
||||
end
|
||||
|
||||
def merge_original_pull_params
|
||||
base_pull_params[:head] = CGI.escape(base_pull_params[:head])
|
||||
base_pull_params[:base] = CGI.escape(base_pull_params[:base])
|
||||
base_pull_params[:head] = Addressable::URI.escape(base_pull_params[:head])
|
||||
base_pull_params[:base] = Addressable::URI.escape(base_pull_params[:base])
|
||||
if pull_request.is_original && @params[:merge_user_login]
|
||||
base_pull_params.merge(head: "#{@params[:merge_user_login]}:#{base_pull_params[:head]}")
|
||||
else
|
||||
|
|
@ -154,6 +157,7 @@ class PullRequests::CreateService < ApplicationService
|
|||
raise "head参数不能为空" if @params[:head].blank?
|
||||
raise "base参数不能为空" if @params[:base].blank?
|
||||
raise "fork_project_id参数错误" if is_original && !@project.forked_projects.pluck(:id).include?(@params[:fork_project_id].to_i)
|
||||
raise "merge_user_login参数错误" if is_original && @project.fork_users.joins(:user).where(users: {login: @params[:merge_user_login]}).blank?
|
||||
raise "分支内容相同,无需创建合并请求" if @params[:head] === @params[:base] && !is_original
|
||||
raise "合并请求已存在" if @project&.pull_requests.where(head: @params[:head], base: @params[:base], status: 0, is_original: is_original, fork_project_id: @params[:fork_project_id]).present?
|
||||
raise @pull_issue.errors.full_messages.join(", ") unless pull_issue.valid?
|
||||
|
|
@ -162,7 +166,7 @@ class PullRequests::CreateService < ApplicationService
|
|||
|
||||
def compare_head_base!
|
||||
head = pull_request.is_original && @params[:merge_user_login] ? "#{@params[:merge_user_login]}/#{@project.identifier}:#{@params[:head]}" : @params[:head]
|
||||
compare_result = Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, CGI.escape(@params[:base]), CGI.escape(head), @current_user.gitea_token)
|
||||
compare_result = Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, Addressable::URI.escape(@params[:base]), Addressable::URI.escape(head), @current_user.gitea_token)
|
||||
raise '分支内容相同,无需创建合并请求' if compare_result["Commits"].blank? && compare_result["Diff"].blank?
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
# 代码溯源 添加用户
|
||||
class Trace::AddUserService < Trace::ClientService
|
||||
|
||||
# 用户名 密码 单位 手机号 邮箱 昵称
|
||||
attr_accessor :username, :password, :unit, :telnumber, :email, :name
|
||||
|
||||
def initialize(username, password, unit, telnumber, email, name)
|
||||
@username = username
|
||||
@password = password
|
||||
@unit = unit
|
||||
@telnumber = telnumber
|
||||
@email = email
|
||||
@name = name
|
||||
end
|
||||
|
||||
def call
|
||||
result = post(url, {data: request_params})
|
||||
response = render_response(result)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def request_params
|
||||
{
|
||||
username: username,
|
||||
password: password,
|
||||
unit: unit,
|
||||
telnumber: telnumber,
|
||||
email: email,
|
||||
name: name
|
||||
}
|
||||
end
|
||||
|
||||
def url
|
||||
"/user/addccfuser".freeze
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# 代码溯源 查询检测结果
|
||||
class Trace::CheckResultService < Trace::ClientService
|
||||
|
||||
attr_accessor :token, :project_name, :file_name, :page_num, :page_size
|
||||
|
||||
def initialize(token, project_name=nil, file_name=nil, page_num=1, page_size=15)
|
||||
@token = token
|
||||
@project_name = project_name
|
||||
@file_name = file_name
|
||||
@page_num = page_num
|
||||
@page_size = page_size
|
||||
end
|
||||
|
||||
def call
|
||||
result = authed_get(token, url, request_params)
|
||||
reponse = render_response(result)
|
||||
end
|
||||
|
||||
private
|
||||
def request_params
|
||||
{
|
||||
product_name: project_name,
|
||||
file_name: file_name,
|
||||
pageNum: page_num,
|
||||
pageSize: page_size,
|
||||
}
|
||||
end
|
||||
|
||||
def url
|
||||
"/user/checkresult".freeze
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# 代码溯源 开始检测
|
||||
class Trace::CheckService < Trace::ClientService
|
||||
|
||||
attr_accessor :token, :project, :if_branch, :branch_tag
|
||||
|
||||
def initialize(token, project, if_branch, branch_tag)
|
||||
@token = token
|
||||
@project = project
|
||||
@if_branch = if_branch
|
||||
@branch_tag = branch_tag
|
||||
end
|
||||
|
||||
def call
|
||||
result = authed_post(token, url, {data: request_params})
|
||||
reponse = render_response(result)
|
||||
end
|
||||
|
||||
private
|
||||
def request_params
|
||||
repo = Gitea::Repository::GetService.call(project&.owner&.login, project&.identifier)
|
||||
{
|
||||
product_name: project&.name,
|
||||
product_type: project&.category&.name,
|
||||
code_type: project&.language&.name,
|
||||
product_desc: project&.description,
|
||||
git_url: repo['clone_url'],
|
||||
if_branch: if_branch,
|
||||
branch_tag: branch_tag
|
||||
}
|
||||
end
|
||||
|
||||
def url
|
||||
"/user/check".freeze
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
class Trace::ClientService < ApplicationService
|
||||
|
||||
def post(url, params={})
|
||||
puts "[trace][POST] request params: #{params}"
|
||||
conn.post do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
end
|
||||
end
|
||||
|
||||
def authed_post(token, url, params={})
|
||||
puts "[trace][POST] request params: #{params}"
|
||||
puts "[trace][POST] request token: #{token}"
|
||||
conn.post do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
req.headers['Authorization'] = token
|
||||
end
|
||||
end
|
||||
|
||||
def get(url, params={})
|
||||
puts "[trace][GET] request params: #{params}"
|
||||
conn.get do |req|
|
||||
req.url full_url(url, 'get')
|
||||
params.each_pair do |key, value|
|
||||
req.params["#{key}"] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def authed_get(token, url, params={})
|
||||
puts "[trace][GET] request params: #{params}"
|
||||
puts "[trace][GET] request token: #{token}"
|
||||
conn.get do |req|
|
||||
req.url full_url(url, 'get')
|
||||
params.each_pair do |key, value|
|
||||
req.params["#{key}"] = value
|
||||
end
|
||||
req.headers['Authorization'] = token
|
||||
end
|
||||
end
|
||||
|
||||
def delete(url, params={})
|
||||
puts "[trace][DELETE] request params: #{params}"
|
||||
conn.delete do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
end
|
||||
end
|
||||
|
||||
def authed_delete(token, url, params={})
|
||||
puts "[trace][DELETE] request params: #{params}"
|
||||
puts "[trace][DELETE] request token: #{token}"
|
||||
conn.delete do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
req.headers['Authorization'] = token
|
||||
end
|
||||
end
|
||||
|
||||
def patch(url, params={})
|
||||
puts "[trace][PATCH] request params: #{params}"
|
||||
conn.patch do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
end
|
||||
end
|
||||
|
||||
def authed_patch(token, url, params={})
|
||||
puts "[trace][PATCH] request params: #{params}"
|
||||
puts "[trace][PATCH] request token: #{token}"
|
||||
conn.patch do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
req.headers['Authorization'] = token
|
||||
end
|
||||
end
|
||||
|
||||
def put(url, params={})
|
||||
puts "[trace][PUT] request params: #{params}"
|
||||
conn.put do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
end
|
||||
end
|
||||
|
||||
def authed_put(token, url, params={})
|
||||
puts "[trace][PUT] request params: #{params}"
|
||||
puts "[trace][PUT] request token: #{token}"
|
||||
conn.put do |req|
|
||||
req.url full_url(url)
|
||||
req.body = params[:data].to_json
|
||||
req.headers['Authorization'] = token
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def conn
|
||||
@client ||= begin
|
||||
Faraday.new(url: domain) do |req|
|
||||
req.request :url_encoded
|
||||
req.headers['Content-Type'] = 'application/json'
|
||||
req.adapter Faraday.default_adapter
|
||||
end
|
||||
end
|
||||
|
||||
@client
|
||||
end
|
||||
|
||||
def base_url
|
||||
Trace.trace_config[:base_url]
|
||||
end
|
||||
|
||||
def domain
|
||||
Trace.trace_config[:domain]
|
||||
end
|
||||
|
||||
def api_url
|
||||
[domain, base_url].join('')
|
||||
end
|
||||
|
||||
def full_url(api_rest, action='post')
|
||||
url = [api_url, api_rest].join('').freeze
|
||||
url = action === 'get' ? url : URI.escape(url)
|
||||
url = URI.escape(url) unless url.ascii_only?
|
||||
puts "[trace] request url: #{url}"
|
||||
return url
|
||||
end
|
||||
|
||||
def log_error(status, body)
|
||||
puts "[trace] status: #{status}"
|
||||
puts "[trace] body: #{body}"
|
||||
end
|
||||
|
||||
def render_response(response)
|
||||
status = response.status
|
||||
body = JSON.parse(response&.body)
|
||||
|
||||
log_error(status, body)
|
||||
|
||||
return [body["code"], body["Data"], body["Error"]]
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# 代码溯源 用户登录
|
||||
class Trace::LoginService < Trace::ClientService
|
||||
|
||||
# 用户名 密码
|
||||
attr_accessor :username, :password
|
||||
|
||||
def initialize(username, password)
|
||||
@username = username
|
||||
@password = password
|
||||
end
|
||||
|
||||
def call
|
||||
result = post(url, {data: request_params})
|
||||
response = render_response(result)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def request_params
|
||||
{
|
||||
username: username,
|
||||
password: password,
|
||||
}
|
||||
end
|
||||
|
||||
def url
|
||||
"/user/login".freeze
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# 代码溯源 导出pdf
|
||||
class Trace::PdfReportService < Trace::ClientService
|
||||
|
||||
attr_accessor :token, :task_id
|
||||
|
||||
def initialize(token, task_id)
|
||||
@token = token
|
||||
@task_id = task_id
|
||||
end
|
||||
|
||||
def call
|
||||
result = authed_get(token, url, request_params)
|
||||
response = render_response(result)
|
||||
end
|
||||
|
||||
private
|
||||
def request_params
|
||||
{
|
||||
task_id: task_id
|
||||
}
|
||||
end
|
||||
|
||||
def url
|
||||
"/user/pdfreport".freeze
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# 代码溯源 重新检测
|
||||
class Trace::ReloadCheckService < Trace::ClientService
|
||||
|
||||
attr_accessor :token, :fake_project_id
|
||||
def initialize(token, fake_project_id)
|
||||
@token = token
|
||||
@fake_project_id = fake_project_id
|
||||
end
|
||||
|
||||
def call
|
||||
result = authed_post(token, url, {data: request_params})
|
||||
response = render_response(result)
|
||||
end
|
||||
|
||||
private
|
||||
def request_params
|
||||
{
|
||||
project_id: fake_project_id
|
||||
}
|
||||
end
|
||||
|
||||
def url
|
||||
'/user/reloadcheck'.freeze
|
||||
end
|
||||
end
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
</div>
|
||||
<div class="form-group ">
|
||||
<label for="status">类型:</label>
|
||||
<%= p.select :site_type, options_for_select(Site.site_types.map { |key, value| [key.humanize, key] }), {}, class: "form-control" %>
|
||||
<%= p.select :site_type, options_for_select(Site.site_types.map { |key, value| [key.humanize, key] }, @site.site_type), {}, class: "form-control" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ json.user do
|
|||
json.partial! "organizations/user_detail", user: org_user.user
|
||||
end
|
||||
|
||||
json.team_names org_user.teams.pluck(:name)
|
||||
json.team_names org_user.teams.pluck(:nickname)
|
||||
json.created_at org_user.created_at.strftime("%Y-%m-%d")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
json.type @owner.type
|
||||
json.type @owner&.type
|
||||
if @owner.is_a?(Organization)
|
||||
json.partial! "organizations/organizations/detail", organization: @owner
|
||||
json.can_create_project @can_create_project
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
json.count @forks_count
|
||||
json.users do
|
||||
json.array! @fork_users.each do |f|
|
||||
user = f.user
|
||||
user = f.user.present? ? f.user : Organization.find_by(id: f.user_id)
|
||||
json.id f.fork_project.id
|
||||
json.identifier f.fork_project.identifier
|
||||
json.name "#{user.try(:show_real_name)}/#{f.fork_project.try(:name)}"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if @project.forge?
|
|||
json.type entry['type']
|
||||
json.size entry['size']
|
||||
|
||||
json.content decode64_content(entry, @owner, @repository, @ref, @path)
|
||||
json.content direct_download ? nil : decode64_content(entry, @owner, @repository, @ref, @path)
|
||||
json.target entry['target']
|
||||
|
||||
download_url =
|
||||
|
|
|
|||
|
|
@ -49,6 +49,14 @@ if @result[:repo]
|
|||
json.empty @result[:repo]['empty']
|
||||
json.full_name @result[:repo]['full_name']
|
||||
json.private @result[:repo]['private']
|
||||
else
|
||||
json.size 0
|
||||
json.ssh_url nil
|
||||
json.clone_url nil
|
||||
json.default_branch 'master'
|
||||
json.empty nil
|
||||
json.full_name nil
|
||||
json.private !@project.is_public
|
||||
end
|
||||
json.license_name @project.license_name
|
||||
json.branches_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['branch_count'] || 0) : 0
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ json.setting do
|
|||
#
|
||||
# end
|
||||
|
||||
nav_bar = default_setting.navbar
|
||||
# nav_bar = default_setting.navbar
|
||||
|
||||
# if User.current.logged?
|
||||
# nav_bar[2]["link"] = "https://forgeplus.trustie.net/users/#{current_user.login}/projects"
|
||||
|
|
@ -39,7 +39,7 @@ json.setting do
|
|||
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 nav_bar
|
||||
json.navbar @navbar
|
||||
|
||||
json.footer default_setting.footer
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ default: &default
|
|||
write_domain: ''
|
||||
read_domain: ''
|
||||
base_url: ''
|
||||
|
||||
trace:
|
||||
domain: ''
|
||||
base_url: ''
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
|
|
|
|||
1923
config/routes.rb
1923
config/routes.rb
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,17 @@
|
|||
class CreateTraceUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :trace_users do |t|
|
||||
t.references :user
|
||||
t.string :username
|
||||
t.string :password
|
||||
t.string :unit
|
||||
t.string :telnumber
|
||||
t.string :email
|
||||
t.string :name
|
||||
t.text :token
|
||||
t.datetime :expired_at
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
# 竞赛通知
|
||||
|
||||
namespace :competition_notice do
|
||||
|
||||
desc "竞赛通知-进入提交作品状态"
|
||||
task submit_work_begin: :environment do
|
||||
competitions = Project.find_by_sql("select * from competitions where status=1 and DATE_FORMAT(enroll_end_time,'%Y-%m-%d %h:00:00') ='#{(Time.now - 1.day).strftime('%Y-%m-%d %H:00:00')}' ")
|
||||
competitions.each do |c|
|
||||
competition_teams = Project.find_by_sql("select * from competition_teams where competition_id=#{c.id} ")
|
||||
competition_teams.each do |team|
|
||||
SendTemplateMessageJob.perform_later('CompetitionBegin', team.user_id, c.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "竞赛通知-截止提交作品时间前3小时"
|
||||
task submit_work_end: :environment do
|
||||
competitions = Project.find_by_sql("select * from competitions where status=1 and DATE_FORMAT(end_time,'%Y-%m-%d %h:00:00') ='#{(Time.now + 3.hours).strftime('%Y-%m-%d %H:00:00')}' ")
|
||||
competitions.each do |c|
|
||||
competition_teams = Project.find_by_sql("select * from competition_teams where competition_id=#{c.id} ")
|
||||
competition_teams.each do |team|
|
||||
SendTemplateMessageJob.perform_later('CompetitionReview', team.user_id, c.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "竞赛通知-报名的竞赛进入成绩公示阶段"
|
||||
task submit_work_result: :environment do
|
||||
competitions = Project.find_by_sql("select * from competitions where status=1 and DATE_FORMAT(review_time,'%Y-%m-%d %h:00:00') ='#{(Time.now - 1.day).strftime('%Y-%m-%d %H:00:00')}' ")
|
||||
competitions.each do |c|
|
||||
competition_teams = Project.find_by_sql("select * from competition_teams where competition_id=#{c.id} ")
|
||||
competition_teams.each do |team|
|
||||
SendTemplateMessageJob.perform_later('CompetitionResult', team.user_id, c.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1141,8 +1141,8 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<td>有新指派给我的疑修</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IssueAssignerExpire</td>
|
||||
<td>我负责的疑修截止日期到达最后一天</td>
|
||||
<td>IssueExpire</td>
|
||||
<td>我创建或负责的疑修截止日期到达最后一天</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IssueAtme</td>
|
||||
|
|
@ -1153,10 +1153,6 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<td>我创建或负责的疑修状态变更</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IssueCreatorExpire</td>
|
||||
<td>我创建的疑修截止日期到达最后一天</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IssueDeleted</td>
|
||||
<td>我创建或负责的疑修删除</td>
|
||||
</tr>
|
||||
|
|
@ -1213,6 +1209,10 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<td>我管理的仓库有成员移出</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProjectMilestoneCompleted</td>
|
||||
<td>我管理的仓库有里程碑完成度100%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProjectMilestone</td>
|
||||
<td>我管理的仓库有新的里程碑</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="88" viewBox="0 0 400 88">
|
||||
<defs>
|
||||
<linearGradient id="linear-gradient" y1="0.501" x2="1" y2="0.501" gradientUnits="objectBoundingBox">
|
||||
<stop offset="0" stop-color="#6dffff"/>
|
||||
<stop offset="1" stop-color="#0080ff"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="logo" transform="translate(-181 -101)">
|
||||
<rect id="矩形_1" data-name="矩形 1" width="400" height="88" transform="translate(181 101)" fill="#fff" opacity="0"/>
|
||||
<g id="顶部logo" transform="translate(181.055 106.72)">
|
||||
<path id="形状" d="M64.185,77.408H51.334V0h8.379V69.74h4.473v7.668Zm10.223-8.6,0,0-6.029-3.653V10.536l6.033-3.655V68.809Zm-38.624-.144V17.273l-3.337-1.217V6.881l12.71,7.382v6.953L41.891,20V65.511l-6.1,3.152ZM22.152,60.493V17.059L28.9,20.427v36.7l-6.742,3.365Zm69.793,0h0l-3.051-.5L85.2,53.9v3.941l-2.343-1.217V20.856l2.84-1.433,3.265,4.445-.072-5.734,3.054-1.147V60.493ZM.072,57.841H0V23.295l14.626,4.874v5.806L5.68,32.326V47.52L10.508,45.3V40.5H7.74V35.551l6.957.715V50.388L.073,57.84Zm120.7-.142h-.005l-9.226-.432-5.678-7.382v4.946l-5.894-1.219V27.881l5.894-1.433v4.8l5.325-7.169,8.021-.859L108.417,40.354l12.351,17.341Z" transform="translate(0 0)" fill="url(#linear-gradient)"/>
|
||||
<path id="形状-2" data-name="形状" d="M192.836,66.37l0,0-1.63-1.215a16.1,16.1,0,0,0,1.136-2.222A15.2,15.2,0,0,0,193,61.32c.04-.111.08-.22.12-.326a12.573,12.573,0,0,0,.567-1.934l1.918.5a4.741,4.741,0,0,0-.142.646c-.066.2-.132.414-.205.652-.085.276-.179.58-.292.925a22.742,22.742,0,0,1-.852,2.15,27.108,27.108,0,0,1-1.278,2.434ZM64.824,66.3h0l-.991-.356-.924-.358c.142-.571.253-1.115.351-1.595.051-.248.1-.482.146-.7.085-.423.144-.847.207-1.3.044-.318.09-.645.148-1l.01-.12c.068-.806.132-1.567.132-2.388V50.6h6.888l1.491-2.222H66.1c-.237.359-.453.677-.645.957-.154.226-.294.43-.419.62-.1.124-.188.23-.263.32-.146.174-.234.279-.234.326l-1.491-1.5c.418-.565.851-1.148,1.136-1.577.172-.3.369-.607.578-.927.137-.211.277-.425.416-.65a14.379,14.379,0,0,0,.713-1.361c.071-.149.14-.293.209-.432l1.777,1a3.542,3.542,0,0,1-.31.7c-.042.079-.082.157-.118.229h7.668v1.718L73.272,50.53h1.136V50.1H76.4V63.646a2.617,2.617,0,0,1-.639,1.793,2.039,2.039,0,0,1-1.633.718H72.989V63.934h1.136c.191,0,.283-.117.283-.358V61.712H71v3.943H69.013V61.712H65.676c-.043.386-.11.738-.174,1.08-.043.226-.083.439-.112.641a8.225,8.225,0,0,1-.173.91c-.042.181-.082.352-.11.522-.071.437-.143.725-.214,1a2.19,2.19,0,0,0-.07.426Zm6.105-9.317v2.58h3.409v-2.58Zm-5.042.072v2.508h3.054V57.053Zm5.042-4.3v2.006h3.409V52.752Zm-5.042,0v2.006h3.054V52.752ZM188.649,66.3l0,0-1.7-1.142c.058-.118.128-.272.209-.45.117-.256.262-.574.429-.913.288-.584.575-1.234.852-1.934a15.544,15.544,0,0,0,.611-1.811q.05-.172.1-.339a7.222,7.222,0,0,0,.283-2.006V44.511h15.62v2.22h-13.7V57.555a8.817,8.817,0,0,1-.211,1.862,19.834,19.834,0,0,1-.5,1.937c-.208.627-.418,1.192-.622,1.738l-.019.052a16.993,16.993,0,0,1-.639,1.577c-.113.231-.207.442-.29.628-.073.162-.141.314-.206.447a2.02,2.02,0,0,0-.211.5Zm14.554-.07v0l-2.342-6.449,1.777-.862,2.413,6.451-1.844.86Zm-6.036,0h-1.491V64.006h1.491a.259.259,0,0,0,.214-.072.266.266,0,0,0,.072-.216V58.486h-4.828V48.953h3.123l1.208-2.222,1.7,1.219-.567,1h4.189v-.5h1.988v7.526a2.635,2.635,0,0,1-.639,1.793,2,2,0,0,1-1.442.726,1.727,1.727,0,0,1-.193-.011H199.44v5.232a2.627,2.627,0,0,1-.639,1.793A2.313,2.313,0,0,1,197.167,66.229Zm-2.554-11.182v1.289h7.382c.214,0,.286-.072.286-.286v-1Zm0-3.8v1.5h7.668v-1.5Zm-9.87,14.981h0l-1.772-.932,3.407-7.884,1.846.931-3.478,7.884Zm-124.25,0h-4.4v-9.1c-.142.214-.286.433-.425.646l-.121.183c-.1.156-.2.309-.306.46l-1.561-1.361A12.764,12.764,0,0,0,55.1,54.545l.012-.029c.345-.837.7-1.7.912-2.409.2-.746.339-1.293.5-1.934a5.114,5.114,0,0,0,.211-1V47.376H54.812V45.154h8.237v2.222h-4.4v2.078c0,.048-.032.224-.1.575-.032.174-.071.386-.117.644a22.027,22.027,0,0,1-.78,2.8h3.123v-.43h1.988V63.718a2.617,2.617,0,0,1-.639,1.793A2.039,2.039,0,0,1,60.493,66.229ZM57.936,55.762v8.316h2.415c.212,0,.283-.073.283-.288V55.762ZM167.774,66.157h-1.988V56.05h-8.379a17.373,17.373,0,0,1-1.064,3.869c-.455,1.111-.906,2.189-1.421,3.154-.518.9-.935,1.6-1.277,2.15-.528.62-.639.811-.639.862l-1.563-1.433c.007-.01.215-.289.5-.718.292-.443.671-1.135,1.066-1.865a24.842,24.842,0,0,0,1.277-2.722,23.343,23.343,0,0,0,1.064-3.37h-5.181V53.756h5.467a1.614,1.614,0,0,0,.07-.574V47.235h-4.045V45.012h19.6v2.222h-3.479v6.593h5.042V56.05h-5.042V66.157ZM157.691,47.235v5.947a1.447,1.447,0,0,0-.07.574h8.093V47.235ZM87.9,66.157h0v0l-.281-1.073-.283-1.075a5.866,5.866,0,0,0,.78-.288c.449-.193,1.022-.45,1.918-.859.636-.321,1.448-.79,2.485-1.433a17.173,17.173,0,0,0,2.626-2.009H87.259V57.2h9.87a13.358,13.358,0,0,0,.78-1.363,8.376,8.376,0,0,0,.569-1.433v-4.73h1.988V54.9a6,6,0,0,1-.994,2.294H109.2v2.22h-8.1l7.882,4.8-.993,1.934-8.452-5.16.783-1.577h-2.2A18.535,18.535,0,0,1,96.063,61.5c-.605.49-1.325,1.03-2.2,1.649a16.9,16.9,0,0,1-2.132,1.291c-.247.125-.475.248-.694.368a9.545,9.545,0,0,1-1.152.563,10.6,10.6,0,0,1-1.066.463c-.1.038-.193.074-.281.11A2.943,2.943,0,0,1,87.9,66.157Zm40.328-4.946a3.976,3.976,0,0,1-3.9-3.943,3.905,3.905,0,1,1,7.81,0A3.977,3.977,0,0,1,128.226,61.21ZM94.572,56.765h0l-5.322-2.435.711-2.078,5.325,2.436-.71,2.076Zm165.006-.358H218.966V54.831h40.612v1.577Zm-218.469,0H.5V54.831H41.109v1.577Zm145.764-.5,0,0-3.618-3.725,1.277-1.649,3.692,3.727L186.874,55.9ZM96.845,54.044h0L91.52,51.533l.78-2.078,5.325,2.58-.779,2.006Zm-7.457-2.8H87.4V46.373h9.942L96.7,45.012l1.774-1,1.064,2.436h7.526v-.43h1.988v5.16h-1.988V48.6H89.388v2.652Zm97.484-1.291,0,0-3.69-3.725,1.28-1.646,3.692,3.725-1.278,1.646ZM25.985,33.9H0V.144H41.394l-2.557,4.37v.072h-26.7V29.53h17.4v-11.9H20.8V13.188H41.25V33.9l-11.713,0V30.319L25.986,33.9Zm207.676-.07h0l-11.356,0V.072h11.358v18.2l11.005-8.17h14.059L245.732,20.141l12.706,13.685-12.706,0L233.661,21.217V33.833Zm-66.1,0H156.2V10.106h11.36V33.831Zm-24.354,0h-31.1V.072h11.857V29.458h21.725l-2.484,4.372Zm-44.587,0H79.946V14.407H73.911V10.178h6.036V2.436h11.36v7.742H101.6l-2.84,4.229H91.307V29.746h9.8L98.62,33.829Zm-35.287,0H51.972V10.106h11.36V33.831Zm148.39-.144H200.5V10.034l-3.9,4.229h-7.1V33.687H178.141V10.034h33.582V33.687ZM167.56,7.31H156.2V0h11.36V7.31Zm-104.228,0H51.972V0h11.36V7.31Z" transform="translate(140.368 8.673)" fill="#fffdfd"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.2 KiB |
|
|
@ -24,7 +24,7 @@
|
|||
<div class="new_content">
|
||||
<div style="width: 598px; background:#fff; margin:20px auto;">
|
||||
<div style="height:50px; width: 578px; background:#3b94d6; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
|
||||
<a href="{baseurl}"><img src="{baseurl}/images/email_logo.png" height="45" ></a>
|
||||
<a href="{baseurl}"><img src="{baseurl}/images/email_logo.svg" height="45" ></a>
|
||||
<p style="color:#fff; float:right; margin-top:15px;">确实开源,协同创新</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
<div style="padding:20px; color:#333; line-height: 1.9;background: #eee;border:1px solid #ddd; border-top:none; width: 558px;">
|
||||
<p style="color:#888; float:left;">如果您在使用中有任何的疑问和建议,欢迎您给我们反馈意见<br/>
|
||||
QQ群:1071514693</p>
|
||||
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">GitLink团队</p>
|
||||
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">{platform}团队</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<div class="new_content">
|
||||
<div style="width: 598px; background:#fff; margin:20px auto;">
|
||||
<div style="height:50px; width: 578px; background:#3b94d6; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
|
||||
<a href="{baseurl}"><img src="{baseurl}/images/email_logo.png" height="45" ></a>
|
||||
<a href="{baseurl}"><img src="{baseurl}/images/email_logo.svg" height="45" ></a>
|
||||
<p style="color:#fff; float:right; margin-top:15px;">确实开源,协同创新</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<div style="padding:20px; color:#333; line-height: 1.9;background: #eee;border:1px solid #ddd; border-top:none; width: 558px;">
|
||||
<p style="color:#888; float:left;">如果您在使用中有任何的疑问和建议,欢迎您给我们反馈意见<br/>
|
||||
QQ群:1071514693</p>
|
||||
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">GitLink团队</p>
|
||||
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">{platform}团队</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<div class="new_content">
|
||||
<div style="width: 598px; background:#fff; margin:20px auto;">
|
||||
<div style="height:50px; width: 578px; background:#3b94d6; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
|
||||
<a href="{baseurl}"><img src="{baseurl}/images/email_logo.png" height="45" ></a>
|
||||
<a href="{baseurl}"><img src="{baseurl}/images/email_logo.svg" height="45" ></a>
|
||||
<p style="color:#fff; float:right; margin-top:15px;">确实开源,协同创新</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
<div style="padding:20px; color:#333; line-height: 1.9;background: #eee;border:1px solid #ddd; border-top:none; width: 558px;">
|
||||
<p style="color:#888; float:left;">如果您在使用中有任何的疑问和建议,欢迎您给我们反馈意见<br/>
|
||||
QQ群:1071514693</p>
|
||||
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">GitLink团队</p>
|
||||
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">{platform}团队</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>疑修截止日期到达最后一天</title>
|
||||
<style type="text/css">
|
||||
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;}
|
||||
body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5; background:#eaebec;}
|
||||
div,img,tr,td,table{ border:0;}
|
||||
table,tr,td{border:0;}
|
||||
ol,ul,li{ list-style-type:none}
|
||||
.new_content{ background:#fff; width: 100%;}
|
||||
.email-page-link{ }
|
||||
.email-link-top{ }
|
||||
.c_white{ color:#fff;}
|
||||
.email-link-con{ }
|
||||
.email-link-line{ }
|
||||
.email-link-footer{ padding:15px; color:#333; line-height: 1.9; }
|
||||
.c_grey02{ color: #888;}
|
||||
.fb{ font-weight: normal;}
|
||||
.f14{ }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="background:#fff;">
|
||||
<div class="new_content">
|
||||
<div style="width: 598px; background:#fff; margin:20px auto;">
|
||||
<div style="height:50px; width: 578px; background:#3b94d6; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
|
||||
<a href="{baseurl}"><img src="{baseurl}/images/email_logo.svg" height="45" ></a>
|
||||
<p style="color:#fff; float:right; margin-top:15px;">确实开源,协同创新</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
<div style="width: 558px; border-left:1px solid #ddd;border-right:1px solid #ddd; background:#fff; padding:20px; color:#333; line-height: 1.9;">
|
||||
<p style="font-size: 14px; color:#333;">
|
||||
{receiver},您好!<br/>
|
||||
疑修 <a href="{baseurl}/{login}/{identifier}/issues/{id}" style="font-weight:bold;color:#3b94d6;">{title}</a> 已临近截止日期,请尽快处理<br/>
|
||||
</p>
|
||||
<div style="width: 100%; border-top: 1px solid #ddd; margin:10px 0;"></div>
|
||||
</div>
|
||||
<div style="padding:20px; color:#333; line-height: 1.9;background: #eee;border:1px solid #ddd; border-top:none; width: 558px;">
|
||||
<p style="color:#888; float:left;">如果您在使用中有任何的疑问和建议,欢迎您给我们反馈意见<br/>
|
||||
QQ群:1071514693</p>
|
||||
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">{platform}团队</p>
|
||||
<div style="clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue