mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-20 11:45:57 +08:00
Merge remote-tracking branch 'origin/standalone_develop' into standalone_develop
This commit is contained in:
@@ -27,6 +27,7 @@ class Api::V1::Issues::JournalsController < Api::V1::BaseController
|
||||
end
|
||||
|
||||
def destroy
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueComment', @issue&.id, current_user.id, @journal.id, 'deleted', JSON.parse(@journal.to_builder.target!))
|
||||
if @journal.destroy!
|
||||
render_ok
|
||||
else
|
||||
|
||||
@@ -10,7 +10,7 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
||||
@opened_issues_count = @object_result[:opened_issues_count]
|
||||
@closed_issues_count = @object_result[:closed_issues_count]
|
||||
if params[:only_name].present?
|
||||
@issues = kaminary_select_paginate(@object_result[:data])
|
||||
@issues = kaminary_select_paginate(@object_result[:data].select(:id, :subject, :project_issues_index, :updated_on, :created_on))
|
||||
else
|
||||
@issues = kaminari_paginate(@object_result[:data])
|
||||
end
|
||||
|
||||
@@ -31,14 +31,17 @@ class AttachmentsController < ApplicationController
|
||||
|
||||
def get_file
|
||||
normal_status(-1, "参数缺失") if params[:download_url].blank?
|
||||
url = base_url.starts_with?("https:") ? URI.encode(params[:download_url].to_s.gsub("http:", "https:")) : URI.encode(params[:download_url].to_s)
|
||||
url = base_url.starts_with?("https:") ? params[:download_url].to_s.gsub("http:", "https:") : params[:download_url].to_s
|
||||
if url.starts_with?(base_url) && !url.starts_with?("#{base_url}/repo")
|
||||
domain = GiteaService.gitea_config[:domain]
|
||||
api_url = GiteaService.gitea_config[:base_url]
|
||||
url = ("/repos"+url.split(base_url + "/api")[1]).gsub('?filepath=', '/').gsub('&', '?')
|
||||
request_url = [domain, api_url, url, "?ref=#{params[:ref]}&access_token=#{User.where(admin: true).take&.gitea_token}"].join
|
||||
url = ("/repos"+url.split(base_url + "/api")[1])
|
||||
filepath, ref = url.split("/")[-1].split("?")
|
||||
url.gsub!(url.split("/")[-1], '')
|
||||
puts filepath
|
||||
request_url = [domain, api_url, url, CGI.escape(filepath), "?ref=#{CGI.escape(ref.split('ref=')[1])}&access_token=#{User.where(admin: true).take&.gitea_token}"].join
|
||||
response = Faraday.get(request_url)
|
||||
filename = url.to_s.split("/").pop()
|
||||
filename = filepath
|
||||
else
|
||||
response = Faraday.get(url)
|
||||
filename = params[:download_url].to_s.split("/").pop()
|
||||
|
||||
@@ -46,6 +46,7 @@ class JournalsController < ApplicationController
|
||||
end
|
||||
Rails.logger.info "[ATME] maybe to at such users: #{@atme_receivers.pluck(:login)}"
|
||||
AtmeService.call(current_user, @atme_receivers, journal) if @atme_receivers.size > 0
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('PullRequestComment', @issue&.id, current_user.id, journal.id, 'created', {})
|
||||
# @issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "journal")
|
||||
|
||||
# author: zxh
|
||||
@@ -66,6 +67,7 @@ class JournalsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
if @journal.destroy #如果有子评论,子评论删除吗?
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('PullRequestComment', @issue&.id, current_user.id, @journal.id, 'deleted', JSON.parse(@journal.to_builder.target!))
|
||||
Journal.children_journals(@journal.id).destroy_all
|
||||
normal_status(0, "评论删除成功")
|
||||
else
|
||||
|
||||
@@ -42,11 +42,8 @@ class ProjectsController < ApplicationController
|
||||
if category_id.blank? && params[:search].blank? && params[:topic_id].blank?
|
||||
# 默认查询时count性能问题处理
|
||||
ProjectCategory.sum("projects_count") - Project.visible.joins("left join organization_extensions on organization_extensions.organization_id = projects.user_id").where("organization_extensions.visibility =2").count
|
||||
elsif params[:search].present?
|
||||
elsif params[:search].present? || params[:topic_id].present?
|
||||
@projects.total_count
|
||||
elsif params[:topic_id].present?
|
||||
topic = ProjectTopic.find_by(id: params[:topic_id])
|
||||
topic&.projects_count || 0
|
||||
else
|
||||
cate = ProjectCategory.find_by(id: category_id)
|
||||
cate&.projects_count || 0
|
||||
@@ -133,7 +130,7 @@ class ProjectsController < ApplicationController
|
||||
# TODO:
|
||||
# 临时特殊处理修改website、lesson_url操作方法
|
||||
if project_params.has_key?("website")
|
||||
if params[:project_topic_names].present? && params[:project_topic_names].is_a?(Array)
|
||||
if params[:project_topic_names].is_a?(Array)
|
||||
ProjectTopicRalate.where(project: @project).destroy_all
|
||||
params[:project_topic_names].each do |name|
|
||||
project_topic = ProjectTopic.find_or_create_by!(name: name.downcase)
|
||||
|
||||
@@ -318,15 +318,10 @@ class PullRequestsController < ApplicationController
|
||||
body: params[:body], #内容
|
||||
head: params[:head], #源分支
|
||||
base: params[:base], #目标分支
|
||||
milestone: 0, #里程碑,未与本地的里程碑关联
|
||||
# milestone: 0, #里程碑,未与本地的里程碑关联
|
||||
}
|
||||
assignee_login = User.find_by_id(params[:assigned_to_id])&.login
|
||||
@requests_params = @local_params.merge({
|
||||
# assignees: ["#{params[:assigned_login].to_s}"],
|
||||
assignees: ["#{assignee_login.to_s}"],
|
||||
labels: params[:issue_tag_ids]
|
||||
# due_date: Time.now
|
||||
})
|
||||
@requests_params = @local_params.merge({assignees: [assignee_login.to_s].reject!(&:empty?)})
|
||||
@issue_params = {
|
||||
author_id: current_user.id,
|
||||
project_id: @project.id,
|
||||
|
||||
@@ -273,7 +273,7 @@ class RepositoriesController < ApplicationController
|
||||
domain = GiteaService.gitea_config[:domain]
|
||||
api_url = GiteaService.gitea_config[:base_url]
|
||||
|
||||
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{Addressable::URI.escape(params[:filepath])}?ref=#{Addressable::URI.escape(params[:ref])}"
|
||||
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{CGI.escape(params[:filepath])}?ref=#{CGI.escape(params[:ref])}"
|
||||
file_path = [domain, api_url, url].join
|
||||
file_path = [file_path, "access_token=#{@owner&.gitea_token}"].join("&")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user