Merge branch 'pre_trustie_server' into trustie_server
This commit is contained in:
commit
ebab541b29
|
@ -9,6 +9,10 @@ class CompareController < ApplicationController
|
||||||
load_compare_params
|
load_compare_params
|
||||||
compare
|
compare
|
||||||
@merge_status, @merge_message = get_merge_message
|
@merge_status, @merge_message = get_merge_message
|
||||||
|
@page_size = page_size <= 0 ? 1 : page_size
|
||||||
|
@page_limit = page_limit <=0 ? 15 : page_limit
|
||||||
|
@page_offset = (@page_size -1) * @page_limit
|
||||||
|
Rails.logger.info("+========#{@page_size}-#{@page_limit}-#{@page_offset}")
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -53,4 +57,12 @@ class CompareController < ApplicationController
|
||||||
def gitea_compare(base, head)
|
def gitea_compare(base, head)
|
||||||
Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), current_user.gitea_token)
|
Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), current_user.gitea_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def page_size
|
||||||
|
params.fetch(:page, 1).to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_limit
|
||||||
|
params.fetch(:limit, 15).to_i
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,7 +109,7 @@ class IssuesController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
issue_params = issue_send_params(params)
|
issue_params = issue_send_params(params)
|
||||||
Issues::CreateForm.new({subject:issue_params[:subject]}).validate!
|
Issues::CreateForm.new({subject: issue_params[:subject], description: issue_params[:description].b}).validate!
|
||||||
@issue = Issue.new(issue_params)
|
@issue = Issue.new(issue_params)
|
||||||
if @issue.save!
|
if @issue.save!
|
||||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id) if Site.has_notice_menu?
|
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id) if Site.has_notice_menu?
|
||||||
|
@ -223,7 +223,7 @@ class IssuesController < ApplicationController
|
||||||
normal_status(-1, "不允许修改为关闭状态")
|
normal_status(-1, "不允许修改为关闭状态")
|
||||||
else
|
else
|
||||||
issue_params = issue_send_params(params).except(:issue_classify, :author_id, :project_id)
|
issue_params = issue_send_params(params).except(:issue_classify, :author_id, :project_id)
|
||||||
Issues::UpdateForm.new({subject:issue_params[:subject]}).validate!
|
Issues::UpdateForm.new({subject: issue_params[:subject], description: issue_params[:description].b}).validate!
|
||||||
if @issue.update_attributes(issue_params)
|
if @issue.update_attributes(issue_params)
|
||||||
if @issue&.pull_request.present?
|
if @issue&.pull_request.present?
|
||||||
SendTemplateMessageJob.perform_later('PullRequestChanged', current_user.id, @issue&.pull_request&.id, @issue.previous_changes.slice(:assigned_to_id, :priority_id, :fixed_version_id, :issue_tags_value)) if Site.has_notice_menu?
|
SendTemplateMessageJob.perform_later('PullRequestChanged', current_user.id, @issue&.pull_request&.id, @issue.previous_changes.slice(:assigned_to_id, :priority_id, :fixed_version_id, :issue_tags_value)) if Site.has_notice_menu?
|
||||||
|
|
|
@ -23,6 +23,7 @@ class JournalsController < ApplicationController
|
||||||
normal_status(-1, "评论内容不能为空")
|
normal_status(-1, "评论内容不能为空")
|
||||||
else
|
else
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
|
Journals::CreateForm.new({notes: notes.to_s.strip.b}).validate!
|
||||||
journal_params = {
|
journal_params = {
|
||||||
journalized_id: @issue.id ,
|
journalized_id: @issue.id ,
|
||||||
journalized_type: "Issue",
|
journalized_type: "Issue",
|
||||||
|
@ -53,6 +54,9 @@ class JournalsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
rescue Exception => exception
|
||||||
|
puts exception.message
|
||||||
|
normal_status(-1, exception.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -70,7 +74,8 @@ class JournalsController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
content = params[:content]
|
content = params[:content]
|
||||||
if content.present?
|
if content.present?
|
||||||
|
Journals::UpdateForm.new({notes: notes.to_s.strip.b}).validate!
|
||||||
if @journal.update_attribute(:notes, content)
|
if @journal.update_attribute(:notes, content)
|
||||||
normal_status(0, "更新成功")
|
normal_status(0, "更新成功")
|
||||||
else
|
else
|
||||||
|
@ -79,7 +84,9 @@ class JournalsController < ApplicationController
|
||||||
else
|
else
|
||||||
normal_status(-1, "评论的内容不能为空")
|
normal_status(-1, "评论的内容不能为空")
|
||||||
end
|
end
|
||||||
|
rescue Exception => exception
|
||||||
|
puts exception.message
|
||||||
|
normal_status(-1, exception.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_children_journals
|
def get_children_journals
|
||||||
|
|
|
@ -13,6 +13,8 @@ class ProjectsController < ApplicationController
|
||||||
def menu_list
|
def menu_list
|
||||||
menu = []
|
menu = []
|
||||||
|
|
||||||
|
user_is_admin = current_user.admin? || @project.manager?(current_user)
|
||||||
|
|
||||||
menu.append(menu_hash_by_name("home"))
|
menu.append(menu_hash_by_name("home"))
|
||||||
menu.append(menu_hash_by_name("code")) if @project.has_menu_permission("code")
|
menu.append(menu_hash_by_name("code")) if @project.has_menu_permission("code")
|
||||||
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
|
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
|
||||||
|
@ -22,7 +24,8 @@ class ProjectsController < ApplicationController
|
||||||
menu.append(menu_hash_by_name("wiki")) if @project.has_menu_permission("wiki") && @project.forge?
|
menu.append(menu_hash_by_name("wiki")) if @project.has_menu_permission("wiki") && @project.forge?
|
||||||
menu.append(menu_hash_by_name("resources")) if @project.has_menu_permission("resources") && @project.forge?
|
menu.append(menu_hash_by_name("resources")) if @project.has_menu_permission("resources") && @project.forge?
|
||||||
menu.append(menu_hash_by_name("activity"))
|
menu.append(menu_hash_by_name("activity"))
|
||||||
menu.append(menu_hash_by_name("settings")) if (current_user.admin? || @project.manager?(current_user)) && @project.forge?
|
menu.append(menu_hash_by_name("settings")) if user_is_admin && @project.forge?
|
||||||
|
menu.append(menu_hash_by_name("quit")) if !user_is_admin && @project.member(current_user.id) && @project.forge?
|
||||||
|
|
||||||
render json: menu
|
render json: menu
|
||||||
end
|
end
|
||||||
|
@ -88,7 +91,7 @@ class ProjectsController < ApplicationController
|
||||||
return @branches = [] unless @project.forge?
|
return @branches = [] unless @project.forge?
|
||||||
|
|
||||||
# result = Gitea::Repository::Branches::ListService.call(@owner, @project.identifier)
|
# result = Gitea::Repository::Branches::ListService.call(@owner, @project.identifier)
|
||||||
result = Gitea::Repository::Branches::ListNameService.call(@owner, @project.identifier)
|
result = Gitea::Repository::Branches::ListNameService.call(@owner, @project.identifier, params[:name])
|
||||||
@branches = result.is_a?(Hash) ? (result.key?(:status) ? [] : result["branch_name"]) : result
|
@branches = result.is_a?(Hash) ? (result.key?(:status) ? [] : result["branch_name"]) : result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -177,6 +180,22 @@ class ProjectsController < ApplicationController
|
||||||
tip_exception(e.message)
|
tip_exception(e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def quit
|
||||||
|
user_is_admin = current_user.admin? || @project.manager?(current_user)
|
||||||
|
if !user_is_admin && @project.member(current_user.id) && @project.forge?
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
Projects::DeleteMemberInteractor.call(@project.owner, @project, current_user)
|
||||||
|
SendTemplateMessageJob.perform_later('ProjectMemberLeft', current_user.id, current_user.id, @project.id) if Site.has_notice_menu?
|
||||||
|
render_ok
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render_forbidden('你不能退出该仓库')
|
||||||
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
uid_logger_error(e.message)
|
||||||
|
tip_exception(e.message)
|
||||||
|
end
|
||||||
|
|
||||||
def watch_users
|
def watch_users
|
||||||
watchers = @project.watchers.includes(:user).order("watchers.created_at desc").distinct
|
watchers = @project.watchers.includes(:user).order("watchers.created_at desc").distinct
|
||||||
@watchers_count = watchers.size
|
@watchers_count = watchers.size
|
||||||
|
|
|
@ -29,7 +29,7 @@ class PullRequestsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@all_branches = Branches::ListService.call(@owner, @project)
|
@all_branches = Branches::ListService.call(@owner, @project, params[:branch_name])
|
||||||
@is_fork = @project.forked_from_project_id.present?
|
@is_fork = @project.forked_from_project_id.present?
|
||||||
@projects_names = [{
|
@projects_names = [{
|
||||||
project_user_login: @owner.try(:login),
|
project_user_login: @owner.try(:login),
|
||||||
|
@ -50,7 +50,7 @@ class PullRequestsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_branches
|
def get_branches
|
||||||
branch_result = Branches::ListService.call(@owner, @project)
|
branch_result = Branches::ListService.call(@owner, @project, params[:name])
|
||||||
render json: branch_result
|
render json: branch_result
|
||||||
# return json: branch_result
|
# return json: branch_result
|
||||||
end
|
end
|
||||||
|
@ -58,6 +58,7 @@ class PullRequestsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
# return normal_status(-1, "您不是目标分支开发者,没有权限,请联系目标分支作者.") unless @project.operator?(current_user)
|
# return normal_status(-1, "您不是目标分支开发者,没有权限,请联系目标分支作者.") unless @project.operator?(current_user)
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
|
Issues::CreateForm.new({subject: params[:title], description: params[:body].b}).validate!
|
||||||
@pull_request, @gitea_pull_request = PullRequests::CreateService.call(current_user, @owner, @project, params)
|
@pull_request, @gitea_pull_request = PullRequests::CreateService.call(current_user, @owner, @project, params)
|
||||||
if @gitea_pull_request[:status] == :success
|
if @gitea_pull_request[:status] == :success
|
||||||
@pull_request.bind_gitea_pull_request!(@gitea_pull_request[:body]["number"], @gitea_pull_request[:body]["id"])
|
@pull_request.bind_gitea_pull_request!(@gitea_pull_request[:body]["number"], @gitea_pull_request[:body]["id"])
|
||||||
|
@ -89,7 +90,7 @@ class PullRequestsController < ApplicationController
|
||||||
else
|
else
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
begin
|
begin
|
||||||
return normal_status(-1, "title不能超过255个字符") if params[:title].length > 255
|
Issues::UpdateForm.new({subject: params[:title], description: params[:body].b}).validate!
|
||||||
merge_params
|
merge_params
|
||||||
|
|
||||||
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?
|
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?
|
||||||
|
|
|
@ -313,6 +313,7 @@ class UsersController < ApplicationController
|
||||||
:occupation, :technical_title,
|
:occupation, :technical_title,
|
||||||
:school_id, :department_id, :province, :city,
|
:school_id, :department_id, :province, :city,
|
||||||
:custom_department, :identity, :student_id, :description,
|
:custom_department, :identity, :student_id, :description,
|
||||||
|
:show_super_description, :super_description,
|
||||||
:show_email, :show_location, :show_department]
|
:show_email, :show_location, :show_department]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ class VersionReleasesController < ApplicationController
|
||||||
def new
|
def new
|
||||||
#获取所有的分支
|
#获取所有的分支
|
||||||
@all_branches = []
|
@all_branches = []
|
||||||
get_all_branches = Gitea::Repository::Branches::ListService.new(@user, @repository.try(:identifier)).call
|
get_all_branches = Gitea::Repository::Branches::ListService.new(@user, @repository.try(:identifier), params[:branch_name]).call
|
||||||
if get_all_branches && get_all_branches.size > 0
|
if get_all_branches && get_all_branches.size > 0
|
||||||
get_all_branches.each do |b|
|
get_all_branches.each do |b|
|
||||||
@all_branches.push(b["name"])
|
@all_branches.push(b["name"])
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
class Issues::CreateForm
|
class Issues::CreateForm
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :subject
|
attr_accessor :subject, :description
|
||||||
|
|
||||||
validates :subject, presence: { message: "不能为空" }
|
validates :subject, presence: { message: "不能为空" }
|
||||||
|
|
||||||
validates :subject, length: { maximum: 200, too_long: "不能超过200个字符" }
|
validates :subject, length: { maximum: 200, too_long: "不能超过200个字符" }
|
||||||
|
|
||||||
|
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
class Issues::UpdateForm
|
class Issues::UpdateForm
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :subject
|
attr_accessor :subject, :description
|
||||||
|
|
||||||
validates :subject, presence: { message: "不能为空" }
|
validates :subject, presence: { message: "不能为空" }
|
||||||
|
|
||||||
validates :subject, length: { maximum: 200, too_long: "不能超过200个字符" }
|
validates :subject, length: { maximum: 200, too_long: "不能超过200个字符" }
|
||||||
|
|
||||||
|
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}
|
||||||
|
|
||||||
end
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
class Journals::CreateForm
|
||||||
|
include ActiveModel::Model
|
||||||
|
|
||||||
|
attr_accessor :notes
|
||||||
|
|
||||||
|
validates :notes, length: { maximum: 65535, too_long: "不能超过65535个字符"}
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
class Journals::UpdateForm
|
||||||
|
include ActiveModel::Model
|
||||||
|
|
||||||
|
attr_accessor :notes
|
||||||
|
|
||||||
|
validates :notes, length: { maximum: 65535, too_long: "不能超过65535个字符"}
|
||||||
|
|
||||||
|
end
|
|
@ -36,7 +36,6 @@ module RepositoriesHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_cache_commit_author(author_json)
|
def render_cache_commit_author(author_json)
|
||||||
Rails.logger.info author_json['Email']
|
|
||||||
if author_json["name"].present? && author_json["email"].present?
|
if author_json["name"].present? && author_json["email"].present?
|
||||||
return find_user_in_redis_cache(author_json['name'], author_json['email'])
|
return find_user_in_redis_cache(author_json['name'], author_json['email'])
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
class ForkUser < ApplicationRecord
|
class ForkUser < ApplicationRecord
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
belongs_to :user
|
belongs_to :owner
|
||||||
belongs_to :fork_project, class_name: 'Project', foreign_key: :fork_project_id
|
belongs_to :fork_project, class_name: 'Project', foreign_key: :fork_project_id
|
||||||
|
|
||||||
after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic
|
after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# journalized_id :integer default("0"), not null
|
# journalized_id :integer default("0"), not null
|
||||||
# journalized_type :string(30) default(""), not null
|
# journalized_type :string(30) default(""), not null
|
||||||
# user_id :integer default("0"), not null
|
# user_id :integer default("0"), not null
|
||||||
# notes :text(65535)
|
# notes :text(4294967295)
|
||||||
# created_on :datetime not null
|
# created_on :datetime not null
|
||||||
# private_notes :boolean default("0"), not null
|
# private_notes :boolean default("0"), not null
|
||||||
# parent_id :integer
|
# parent_id :integer
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
# Table name: pull_requests
|
# Table name: pull_requests
|
||||||
#
|
#
|
||||||
# id :integer not null, primary key
|
# id :integer not null, primary key
|
||||||
# pull_request_id :integer
|
# gitea_id :integer
|
||||||
# gpid :integer
|
# gitea_number :integer
|
||||||
# user_id :integer
|
# user_id :integer
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
# project_id :integer
|
# project_id :integer
|
||||||
# title :string(255)
|
# title :string(255)
|
||||||
# milestone :integer
|
# milestone :integer
|
||||||
# body :text(65535)
|
# body :text(4294967295)
|
||||||
# head :string(255)
|
# head :string(255)
|
||||||
# base :string(255)
|
# base :string(255)
|
||||||
# issue_id :integer
|
# issue_id :integer
|
||||||
|
|
|
@ -188,7 +188,7 @@ class User < Owner
|
||||||
attr_accessor :password, :password_confirmation
|
attr_accessor :password, :password_confirmation
|
||||||
|
|
||||||
delegate :description, :gender, :department_id, :school_id, :location, :location_city,
|
delegate :description, :gender, :department_id, :school_id, :location, :location_city,
|
||||||
:show_email, :show_location, :show_department,
|
:show_email, :show_location, :show_department, :super_description, :show_super_description,
|
||||||
:technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true
|
:technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true
|
||||||
|
|
||||||
before_save :update_hashed_password, :set_lastname
|
before_save :update_hashed_password, :set_lastname
|
||||||
|
|
|
@ -2,35 +2,34 @@
|
||||||
#
|
#
|
||||||
# Table name: user_extensions
|
# Table name: user_extensions
|
||||||
#
|
#
|
||||||
# id :integer not null, primary key
|
# id :integer not null, primary key
|
||||||
# user_id :integer not null
|
# user_id :integer not null
|
||||||
# birthday :date
|
# birthday :date
|
||||||
# brief_introduction :string(255)
|
# brief_introduction :string(255)
|
||||||
# gender :integer
|
# gender :integer
|
||||||
# location :string(255)
|
# location :string(255)
|
||||||
# occupation :string(255)
|
# occupation :string(255)
|
||||||
# work_experience :integer
|
# work_experience :integer
|
||||||
# zip_code :integer
|
# zip_code :integer
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
# technical_title :string(255)
|
# technical_title :string(255)
|
||||||
# identity :integer
|
# identity :integer
|
||||||
# student_id :string(255)
|
# student_id :string(255)
|
||||||
# teacher_realname :string(255)
|
# teacher_realname :string(255)
|
||||||
# student_realname :string(255)
|
# student_realname :string(255)
|
||||||
# location_city :string(255)
|
# location_city :string(255)
|
||||||
# school_id :integer
|
# school_id :integer
|
||||||
# description :string(255) default("")
|
# description :string(255) default("")
|
||||||
# department_id :integer
|
# department_id :integer
|
||||||
# honor :text(65535)
|
# province :string(255)
|
||||||
# edu_background :integer
|
# city :string(255)
|
||||||
# edu_entry_year :integer
|
# custom_department :string(255)
|
||||||
# province :string(255)
|
# show_email :boolean default("0")
|
||||||
# city :string(255)
|
# show_location :boolean default("0")
|
||||||
# custom_department :string(255)
|
# show_department :boolean default("0")
|
||||||
# show_email :boolean default("0")
|
# super_description :text(4294967295)
|
||||||
# show_location :boolean default("0")
|
# show_super_description :boolean default("0")
|
||||||
# show_department :boolean default("0")
|
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
class Branches::ListService < ApplicationService
|
class Branches::ListService < ApplicationService
|
||||||
|
|
||||||
attr_reader :user, :project
|
attr_reader :user, :project, :name
|
||||||
|
|
||||||
def initialize(user, project)
|
def initialize(user, project, name=nil)
|
||||||
@user = user
|
@user = user
|
||||||
@project = project
|
@project = project
|
||||||
|
@name = name
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
all_branches = []
|
all_branches = []
|
||||||
user_name = user.try(:show_real_name)
|
user_name = user.try(:show_real_name)
|
||||||
identifier = project.repository.try(:identifier)
|
identifier = project.repository.try(:identifier)
|
||||||
get_all_branches = Gitea::Repository::Branches::ListService.new(user, identifier).call
|
get_all_branches = Gitea::Repository::Branches::ListService.new(user, identifier, name).call
|
||||||
all_branches = branch_lists(user_name,user.try(:login), identifier, get_all_branches) if get_all_branches && get_all_branches.size > 0
|
all_branches = branch_lists(user_name,user.try(:login), identifier, get_all_branches) if get_all_branches && get_all_branches.size > 0
|
||||||
return all_branches
|
return all_branches
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
class Gitea::Repository::Branches::ListNameService < Gitea::ClientService
|
class Gitea::Repository::Branches::ListNameService < Gitea::ClientService
|
||||||
attr_reader :user, :repo
|
attr_reader :user, :repo, :name
|
||||||
|
|
||||||
def initialize(user, repo)
|
def initialize(user, repo, name=nil)
|
||||||
@user = user
|
@user = user
|
||||||
@repo = repo
|
@repo = repo
|
||||||
|
@name = name
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
|
@ -13,7 +14,7 @@ class Gitea::Repository::Branches::ListNameService < Gitea::ClientService
|
||||||
|
|
||||||
private
|
private
|
||||||
def params
|
def params
|
||||||
Hash.new.merge(token: user.gitea_token)
|
Hash.new.merge(token: user.gitea_token, name: name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def url
|
def url
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
class Gitea::Repository::Branches::ListService < Gitea::ClientService
|
class Gitea::Repository::Branches::ListService < Gitea::ClientService
|
||||||
attr_reader :user, :repo
|
attr_reader :user, :repo, :name
|
||||||
|
|
||||||
def initialize(user, repo)
|
def initialize(user, repo, name=nil)
|
||||||
@user = user
|
@user = user
|
||||||
@repo = repo
|
@repo = repo
|
||||||
|
@name = name
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
|
@ -13,7 +14,7 @@ class Gitea::Repository::Branches::ListService < Gitea::ClientService
|
||||||
|
|
||||||
private
|
private
|
||||||
def params
|
def params
|
||||||
Hash.new.merge(token: user.gitea_token)
|
Hash.new.merge(token: user.gitea_token, name: name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def url
|
def url
|
||||||
|
|
|
@ -157,7 +157,7 @@ class PullRequests::CreateService < ApplicationService
|
||||||
raise "head参数不能为空" if @params[:head].blank?
|
raise "head参数不能为空" if @params[:head].blank?
|
||||||
raise "base参数不能为空" if @params[:base].blank?
|
raise "base参数不能为空" if @params[:base].blank?
|
||||||
raise "fork_project_id参数错误" if is_original && !@project.forked_projects.pluck(:id).include?(@params[:fork_project_id].to_i)
|
raise "fork_project_id参数错误" if is_original && !@project.forked_projects.pluck(:id).include?(@params[:fork_project_id].to_i)
|
||||||
raise "merge_user_login参数错误" if is_original && @project.fork_users.joins(:user).where(users: {login: @params[:merge_user_login]}).blank?
|
raise "merge_user_login参数错误" if is_original && @project.fork_users.joins(:owner).where(users: {login: @params[:merge_user_login]}).blank?
|
||||||
raise "分支内容相同,无需创建合并请求" if @params[:head] === @params[:base] && !is_original
|
raise "分支内容相同,无需创建合并请求" if @params[:head] === @params[:base] && !is_original
|
||||||
raise "合并请求已存在" if @project&.pull_requests.where(head: @params[:head], base: @params[:base], status: 0, is_original: is_original, fork_project_id: @params[:fork_project_id]).present?
|
raise "合并请求已存在" if @project&.pull_requests.where(head: @params[:head], base: @params[:base], status: 0, is_original: is_original, fork_project_id: @params[:fork_project_id]).present?
|
||||||
raise @pull_issue.errors.full_messages.join(", ") unless pull_issue.valid?
|
raise @pull_issue.errors.full_messages.join(", ") unless pull_issue.valid?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
json.commits_count @compare_result['Commits']&.size
|
json.commits_count @compare_result['CommitsCount']
|
||||||
# json.commits @compare_result['Commits'], partial: 'pull_requests/commit', as: :commit
|
# json.commits @compare_result['Commits'], partial: 'pull_requests/commit', as: :commit
|
||||||
json.commits do
|
json.commits do
|
||||||
json.array! @compare_result['Commits'] do |commit|
|
json.array! @compare_result['Commits'][@page_offset...(@page_offset + @page_limit)] do |commit|
|
||||||
json.author do
|
json.author do
|
||||||
json.partial! 'repositories/commit_author', locals: { user: render_cache_commit_author(commit['Committer']), name: commit['Committer']['Name'] }
|
json.partial! 'repositories/commit_author', locals: { user: render_cache_commit_author(commit['Committer']), name: commit['Committer']['Name'] }
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,5 +22,6 @@ json.province @user.province
|
||||||
json.city @user.city
|
json.city @user.city
|
||||||
json.custom_department @user.custom_department
|
json.custom_department @user.custom_department
|
||||||
json.description @user.description
|
json.description @user.description
|
||||||
json.(@user, :show_email, :show_department, :show_location)
|
json.super_description @user.super_description
|
||||||
|
json.(@user, :show_email, :show_department, :show_location, :show_super_description)
|
||||||
json.message_unread_total @message_unread_total
|
json.message_unread_total @message_unread_total
|
||||||
|
|
|
@ -13,4 +13,6 @@ json.email @user.show_email ? @user.mail : nil
|
||||||
json.province @user.show_location ? @user.province : nil
|
json.province @user.show_location ? @user.province : nil
|
||||||
json.city @user.show_location ? @user.city : nil
|
json.city @user.show_location ? @user.city : nil
|
||||||
json.custom_department @user.show_department ? @user.custom_department : nil
|
json.custom_department @user.show_department ? @user.custom_department : nil
|
||||||
|
json.super_description @user.show_super_description ? @user.super_description : nil
|
||||||
|
json.show_super_description @user.show_super_description
|
||||||
json.description @user.description
|
json.description @user.description
|
|
@ -3,5 +3,11 @@
|
||||||
attributes:
|
attributes:
|
||||||
issues/create_form:
|
issues/create_form:
|
||||||
subject: 标题
|
subject: 标题
|
||||||
|
description: 描述
|
||||||
issues/update_form:
|
issues/update_form:
|
||||||
subject: 标题
|
subject: 标题
|
||||||
|
description: 描述
|
||||||
|
journals/create_form:
|
||||||
|
notes: 评论
|
||||||
|
journals/update_form:
|
||||||
|
notes: 评论
|
|
@ -447,6 +447,7 @@ Rails.application.routes.draw do
|
||||||
get :stargazers, to: 'projects#praise_users'
|
get :stargazers, to: 'projects#praise_users'
|
||||||
get :forks, to: 'projects#fork_users'
|
get :forks, to: 'projects#fork_users'
|
||||||
match :about, :via => [:get, :put, :post]
|
match :about, :via => [:get, :put, :post]
|
||||||
|
post :quit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddSuperDescriptionToUserExtensions < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :user_extensions, :super_description, :text, :limit => 4294967295
|
||||||
|
add_column :user_extensions, :show_super_description, :boolean, default: false
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
class ChangeIssuesDescriptionAndJournalsNotesColumn < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
change_column :issues, :description, :text, :limit => 4294967295
|
||||||
|
change_column :journals, :notes, :text, :limit => 4294967295
|
||||||
|
change_column :pull_requests, :body, :text, :limit => 4294967295
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue