Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
2023-04-07 17:23:17 +08:00
37 changed files with 340 additions and 68 deletions

View File

@@ -0,0 +1,4 @@
json.total_count @project_topics.total_count
json.project_topics @project_topics.each do |topic|
json.(topic, :id, :name, :projects_count)
end

View File

@@ -3,7 +3,12 @@ json.type webhook["type"]
json.content_type webhook['config']['content_type']
json.http_method webhook['config']['http_method']
json.url webhook['config']['url']
json.events webhook['events']
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.active webhook['active']
json.branch_filter webhook['branch_filter']
json.created_at format_time(webhook['created_at'].to_time)

View File

@@ -2,10 +2,15 @@ json.status 0
json.message "success"
json.data do
json.array! @install_bots do |install_bot|
json.installation_id install_bot.id
json.extract! install_bot.bot, :id, :name
json.bot_id install_bot.bot.id
json.bot_name install_bot.bot.name
json.extract! install_bot, :id, :bot_id, :installer_id, :create_time, :update_time
json.bot_name install_bot&.bot&.name
json.account do
user = User.find_by(id: install_bot.installer_id)
if user.present?
json.partial! "api/v1/users/simple_user", locals: {user: user}
else
json.nil!
end
end
end
end

View File

@@ -1,5 +1,13 @@
json.partial! "commons/success"
json.extract! @install_bot, :id, :bot_id, :installer_id, :state, :create_time, :update_time
json.bot_name @install_bot.bot.name
json.extract! @install_bot, :id, :bot_id, :installer_id, :create_time, :update_time
json.bot_name @install_bot&.bot&.name
json.account do
user = User.find_by(id: @install_bot.installer_id)
if user.present?
json.partial! "api/v1/users/simple_user", locals: { user: user }
else
json.nil!
end
end

View File

@@ -50,3 +50,6 @@ json.language do
json.name project.project_language.name
end
end
json.topics project.project_topics.each do |topic|
json.(topic, :id, :name)
end

View File

@@ -48,4 +48,7 @@ json.projects @projects do |project|
json.name project.project_language.name
end
end
json.topics project.project_topics.each do |topic|
json.(topic, :id, :name)
end
end

View File

@@ -6,4 +6,7 @@ json.project_category_id @project.project_category_id
json.project_language_id @project.project_language_id
json.is_public @project.is_public
json.website @project.website
json.lesson_url @project.lesson_url
json.lesson_url @project.lesson_url
json.topics @project.project_topics.each do |topic|
json.(topic, :id, :name)
end

View File

@@ -5,7 +5,7 @@ json.create_time Time.at(@webhook.created_unix).strftime("%Y-%m-%d %H:%M:%S")
event = @webhook.events
json.branch_filter event["branch_filter"]
if event["send_everything"]
json.events event["events"].keys.collect{|i| i == "pull_request" ? i + "_only" : i}
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| i == "pull_request" ? i + "_only" : i}
json.events event["events"].select{|k, v| v}.keys.collect{|i| %w(pull_request issues).include?(i) ? i + "_only" : i}
end

View File

@@ -21,6 +21,9 @@ json.mirror_url @project&.repository.remote_mirror_url
json.mirror @project&.repository.mirror_url.present?
json.type @project.numerical_for_project_type
json.open_devops @project.open_devops?
json.topics @project.project_topics.each do |topic|
json.(topic, :id, :name)
end
unless @project.common?
json.mirror_status @repository.mirror_status