Browse Source

修改branch

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
d17d3dd84c
4 changed files with 20 additions and 1 deletions
  1. +18
    -0
      app/controllers/repositories_controller.rb
  2. +1
    -1
      app/interactors/gitea/create_file_interactor.rb
  3. +1
    -0
      app/views/projects/_project_detail.json.jbuilder
  4. BIN
      dump.rdb

+ 18
- 0
app/controllers/repositories_controller.rb View File

@@ -92,6 +92,24 @@ class RepositoriesController < ApplicationController
end
end
def upload_file
file_ids = params[:attachment_ids]
if file_ids.present?
file_ids.each do |id|
attachment = Attachment.select(:id, :filename, :disk_directory, :disk_filename).find_by(id)
file_path = attachemnt&.diskfile.to_s
unless File.exists?(file_path)
file_content = File.open(file_path)
end
end
else
render_error("请上传文件")
end
files.each do
end
def repo_hook
hook_type = request.headers["X-Gitea-Event"].to_s # 获取推送的方式
ownername = @project.owner.try(:login)


+ 1
- 1
app/interactors/gitea/create_file_interactor.rb View File

@@ -53,7 +53,7 @@ module Gitea

def file_params
file_params = {}
file_params = file_params.merge(branch: @params[:branch]) unless @params[:branch].blank?
file_params = file_params.merge(branch: @params[:branch]) unless @params[:branch].blank? || @params[:new_branch].present?
file_params = file_params.merge(new_branch: @params[:new_branch]) unless @params[:new_branch].blank?
file_params = file_params.merge(content: Base64.encode64(@params[:content]))
file_params = file_params.merge(message: @params[:message]) unless @params[:message].blank?


+ 1
- 0
app/views/projects/_project_detail.json.jbuilder View File

@@ -12,6 +12,7 @@ json.praises_count project.praises_count.to_i
json.forked_count project.forked_count.to_i
json.is_public project.is_public
json.mirror_url project.repository&.mirror_url
json.type project.numerical_for_project_type
json.last_update_time render_unix_time(project.updated_on)
json.time_ago time_from_now(project.updated_on)
json.forked_from_project_id project.forked_from_project_id


BIN
dump.rdb View File


Loading…
Cancel
Save