Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
2023-04-14 15:46:53 +08:00
53 changed files with 912 additions and 110 deletions

View File

@@ -3,12 +3,7 @@ json.type webhook["type"]
json.content_type webhook['config']['content_type']
json.http_method webhook['config']['http_method']
json.url webhook['config']['url']
event = webhook.events
if event["send_everything"]
json.events event["events"].keys.collect{|i| %w(pull_request issues).include?(i) ? i + "_only" : i}
else
json.events event["events"].select{|k, v| v}.keys.collect{|i| %w(pull_request issues).include?(i) ? i + "_only" : i}
end
json.events webhook["events"].collect{|i| %w(pull_request issues).include?(i) ? i + "_only" : i}
json.active webhook['active']
json.branch_filter webhook['branch_filter']
json.created_at format_time(webhook['created_at'].to_time)

View File

@@ -1,6 +1,6 @@
json.total_count @hooktasks.total_count
json.hooktasks @hooktasks.each do |task|
json.(task, :id, :event_type, :type, :uuid, :is_succeed, :is_delivered, :payload_content, :request_content)
json.response_content task.response_content_json
json.response_content task.response_content
json.delivered_time Time.at(task.delivered*10**-9).strftime("%Y-%m-%d %H:%M:%S")
end

View File

@@ -0,0 +1,7 @@
json.total_count @is_pinned_projects.total_count
json.projects @is_pinned_projects.each do |project|
json.partial! "projects/project_detail", project: project&.project
json.id project.id
json.position project.position
json.project_id project.project_id
end

View File

@@ -11,4 +11,9 @@ json.num_projects organization.num_projects
json.num_users organization.num_users
json.num_teams organization.num_teams
json.avatar_url url_to_avatar(organization)
json.created_at organization.created_on.strftime("%Y-%m-%d")
json.created_at organization.created_on.strftime("%Y-%m-%d")
json.news_banner_id organization.news_banner_id
json.news_content organization.news_content
json.memo organization.memo
json.news_title organization.news_title
json.news_url organization.news_url

View File

@@ -2,6 +2,6 @@ json.id @webhook["id"]
json.type @webhook["type"]
json.content_type @webhook["config"]["content_type"]
json.url @webhook["config"]["url"]
json.events @webhook["events"]
json.events @webhook["events"].collect{|i| %w(pull_request issues).include?(i) ? i + "_only" : i}
json.active @webhook["active"]
json.create_time @webhook["created_at"].to_time.strftime("%Y-%m-%d %H:%M:%S")

View File

@@ -1,6 +1,6 @@
json.total_count @tasks.total_count
json.tasks @tasks.each do |task|
json.(task, :id, :event_type, :type, :uuid, :is_succeed, :is_delivered, :payload_content, :request_content)
json.response_content task.response_content_json
json.delivered_time Time.at(task.delivered*10**-9).strftime("%Y-%m-%d %H:%M:%S")
json.(task, :id, :event_type, :uuid, :is_succeed, :is_delivered, :payload_content, :request_content)
json.response_content task.response_content
json.delivered_time task.delivered.present? ? Time.at(task.delivered*10**-9).strftime("%Y-%m-%d %H:%M:%S") : nil
end

View File

@@ -17,14 +17,15 @@ if @project.forge?
json.content (direct_download || image_type || is_dir) ? nil : decode64_content(entry, @owner, @repository, @ref, @path)
json.target entry['target']
download_url =
if image_type
dir_path = [@owner.login, @repository.identifier, "raw/branch", @ref].join('/')
is_dir ? "" : render_download_image_url(dir_path, entry['path'], decode64_content(entry, @owner, @repository, @ref))
else
# entry['download_url']
is_dir ? "" : render_download_file_url(@owner, @repository, entry['path'].to_s, @ref)
end
download_url = is_dir ? "" : render_download_file_url(@owner, @repository, entry['path'].to_s, @ref)
# if image_type
# # dir_path = [@owner.login, @repository.identifier, "raw/branch", @ref].join('/')
# # is_dir ? "" : render_download_image_url(dir_path, entry['path'], decode64_content(entry, @owner, @repository, @ref))
# is_dir ? "" : render_gitea_raw_url(entry['download_url'])
# else
# # entry['download_url']
# is_dir ? "" : render_download_file_url(@owner, @repository, entry['path'].to_s, @ref)
# end
json.download_url download_url
json.direct_download direct_download