Browse Source

Merge branch 'standalone_develop' into pre_trustie_server

tags/v4.0.0^2
yystopf 4 years ago
parent
commit
b9e2a6edf1
6 changed files with 18 additions and 9 deletions
  1. +2
    -2
      app/controllers/issues_controller.rb
  2. +4
    -1
      app/controllers/repositories_controller.rb
  3. +2
    -4
      app/forms/register/form.rb
  4. +1
    -1
      app/models/concerns/matchable.rb
  5. +1
    -1
      app/models/team_user.rb
  6. +8
    -0
      app/views/repositories/detail.json.jbuilder

+ 2
- 2
app/controllers/issues_controller.rb View File

@@ -27,11 +27,11 @@ class IssuesController < ApplicationController
@filter_issues = @filter_issues.where("subject LIKE ? OR description LIKE ? ", "%#{params[:search]}%", "%#{params[:search]}%") if params[:search].present?
@open_issues = @all_issues.where.not(status_id: IssueStatus::CLOSED)
@close_issues = @all_issues.where(status_id: IssueStatus::CLOSED)
@assign_to_me = @filter_issues.where(assigned_to_id: current_user&.id)
@my_published = @filter_issues.where(author_id: current_user&.id)
scopes = Issues::ListQueryService.call(issues,params.delete_if{|k,v| v.blank?}, "Issue")
@issues_size = scopes.size
@issues = paginate(scopes)
@assign_to_me = @issues.where(assigned_to_id: current_user&.id)
@my_published = @issues.where(author_id: current_user&.id)

respond_to do |format|
format.json


+ 4
- 1
app/controllers/repositories_controller.rb View File

@@ -150,8 +150,11 @@ class RepositoriesController < ApplicationController
if params[:filepath].present? || @project.educoder?
@contributors = []
else
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
result = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
@contributors = result.is_a?(Hash) && result.key?(:status) ? [] : result
end
rescue
@contributors = []
end
def edit


+ 2
- 4
app/forms/register/form.rb View File

@@ -9,11 +9,9 @@ module Register
validate :check!
def check!
Rails.logger.info "Register::Form params: code: #{code}; login: #{login};
namespace: #{namespace}; password: #{password}; password_confirmation: #{password_confirmation}"
Rails.logger.info "Register::Form params: code: #{code}; login: #{login}; namespace: #{namespace}; password: #{password}; type: #{type}"
type = phone_mail_type(strip(login))
db_verifi_code =
db_verifi_code =
if type == 1
check_phone(login)
VerificationCode.where(phone: login, code: code, code_type: 1).last


+ 1
- 1
app/models/concerns/matchable.rb View File

@@ -5,7 +5,7 @@ module Matchable
scope :with_project_category, ->(category_id) { where(project_category_id: category_id) unless category_id.blank? }
scope :with_project_language, ->(language_id) { where(project_language_id: language_id) unless language_id.blank? }
scope :with_project_type, ->(project_type) { where(project_type: project_type) if Project.project_types.include?(project_type) }
scope :by_name_or_identifier, ->(search) { where("name like :search or identifier LIKE :search", :search => "#{search.split(" ").join('|')}%") unless search.blank? }
scope :by_name_or_identifier, ->(search) { where("name like :search or identifier LIKE :search", :search => "%#{search.split(" ").join('|')}%") unless search.blank? }
end

end

+ 1
- 1
app/models/team_user.rb View File

@@ -29,7 +29,7 @@ class TeamUser < ApplicationRecord
before_destroy :remove_project_member

def self.build(organization_id, user_id, team_id)
self.create!(organization_id: organization_id, user_id: user_id, team_id: team_id)
self.find_or_create_by!(organization_id: organization_id, user_id: user_id, team_id: team_id)
end

def remove_project_member


+ 8
- 0
app/views/repositories/detail.json.jbuilder View File

@@ -49,6 +49,14 @@ if @result[:repo]
json.empty @result[:repo]['empty']
json.full_name @result[:repo]['full_name']
json.private @result[:repo]['private']
else
json.size 0
json.ssh_url nil
json.clone_url nil
json.default_branch 'master'
json.empty nil
json.full_name nil
json.private !@project.is_public
end
json.license_name @project.license_name
json.branches_count @result[:branch_tag_total_count].present? ? (@result[:branch_tag_total_count]['branch_count'] || 0) : 0


Loading…
Cancel
Save