ADD conflicts file for pull api
This commit is contained in:
parent
539b832af6
commit
b7dd12927b
|
@ -0,0 +1,11 @@
|
||||||
|
class Gitea::Pull < Gitea::Base
|
||||||
|
self.inheritance_column = nil # FIX The single-table inheritance mechanism failed
|
||||||
|
# establish_connection :gitea_db
|
||||||
|
|
||||||
|
self.table_name = "pull_request"
|
||||||
|
|
||||||
|
serialize :conflicted_files, Array
|
||||||
|
|
||||||
|
belongs_to :pull_request, class_name: '::PullRequest', foreign_key: :id, primary_key: :gpid, optional: true
|
||||||
|
|
||||||
|
end
|
|
@ -37,6 +37,7 @@ class PullRequest < ApplicationRecord
|
||||||
has_many :pull_request_tags, foreign_key: :pull_request_id
|
has_many :pull_request_tags, foreign_key: :pull_request_id
|
||||||
has_many :project_trends, as: :trend, dependent: :destroy
|
has_many :project_trends, as: :trend, dependent: :destroy
|
||||||
has_many :attachments, as: :container, dependent: :destroy
|
has_many :attachments, as: :container, dependent: :destroy
|
||||||
|
has_one :gitea_pull, foreign_key: :id, primary_key: :gpid, class_name: 'Gitea::Pull'
|
||||||
|
|
||||||
scope :merged_and_closed, ->{where.not(status: 0)}
|
scope :merged_and_closed, ->{where.not(status: 0)}
|
||||||
scope :opening, -> {where(status: 0)}
|
scope :opening, -> {where(status: 0)}
|
||||||
|
@ -82,4 +83,11 @@ class PullRequest < ApplicationRecord
|
||||||
pr.update_column(:commits_count, commits_result.size) unless commits_result.blank?
|
pr.update_column(:commits_count, commits_result.size) unless commits_result.blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def conflict_files
|
||||||
|
file_names = self&.gitea_pull&.conflicted_files
|
||||||
|
return [] if file_names.blank?
|
||||||
|
|
||||||
|
JSON.parse file_names
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,3 +32,5 @@ json.issue do
|
||||||
json.version @issue.version.try(:name)
|
json.version @issue.version.try(:name)
|
||||||
json.issue_tags @issue.get_issue_tags
|
json.issue_tags @issue.get_issue_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
json.conflict_files @pull_request.conflict_files
|
||||||
|
|
|
@ -23,6 +23,14 @@ development:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
database: forge_development
|
database: forge_development
|
||||||
|
|
||||||
|
gitea_db:
|
||||||
|
adapter: mysql2
|
||||||
|
database: gitea_development
|
||||||
|
host: 127.0.0.1
|
||||||
|
username: root
|
||||||
|
password: "123456"
|
||||||
|
encoding: utf8
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
# Warning: The database defined as "test" will be erased and
|
||||||
# re-generated from your development database when you run "rake".
|
# re-generated from your development database when you run "rake".
|
||||||
# Do not set this db to the same as development or production.
|
# Do not set this db to the same as development or production.
|
||||||
|
|
Loading…
Reference in New Issue