Merge branch 'standalone_develop' into pre_trustie_server

This commit is contained in:
yystopf 2022-08-24 17:56:17 +08:00
commit 0a170b6560
4 changed files with 6 additions and 4 deletions

View File

@ -619,7 +619,7 @@ class ApplicationController < ActionController::Base
def kaminari_paginate(relation)
limit = params[:limit] || params[:per_page]
limit = (limit.to_i.zero? || limit.to_i > 20) ? 20 : limit.to_i
limit = (limit.to_i.zero? || limit.to_i > 25) ? 25 : limit.to_i
page = params[:page].to_i.zero? ? 1 : params[:page].to_i
relation.page(page).per(limit)

View File

@ -32,7 +32,7 @@ class TraceUser < ApplicationRecord
self.username = user.login
self.password = SecureRandom.hex
self.unit = user.custom_department.blank? ? 'GitLink' : user.custom_department
self.telnumber = user.phone
self.telnumber = user.phone || ""
self.email = user.mail
self.name = user.nickname.blank? ? user.login : user.nickname
@ -41,7 +41,7 @@ class TraceUser < ApplicationRecord
def build_token
return if username.blank? || password.blank? || unit.blank? || telnumber.blank? || email.blank? || name.blank?
return if username.blank? || password.blank? || unit.blank? || email.blank? || name.blank?
response = Trace::AddUserService.call(username, password, unit, telnumber, email, name)
self.token = response[1]['token']
@ -49,7 +49,7 @@ class TraceUser < ApplicationRecord
end
def refresh_token
return if username.blank? || password.blank? || unit.blank? || telnumber.blank? || email.blank? || name.blank?
return if username.blank? || password.blank? || unit.blank? || email.blank? || name.blank?
response = Trace::LoginService.call(username, password)
self.token = response[1]['token']

View File

@ -26,6 +26,7 @@ class Api::V1::Projects::Pulls::Versions::GetDiffService < ApplicationService
access_token: token
}
params.merge!(filepath: filepath) if filepath.present?
params
end
def load_gitea_data

View File

@ -16,6 +16,7 @@ json.blame_parts @result_object['blame_parts'] do |part|
json.committed_time render_unix_time(part['commit']['committed_time'])
json.created_time render_unix_time(part['commit']['created_time'])
end
json.previous_number part['previous_number']
json.current_number part['current_number']
json.effect_line part['effect_line']
json.lines part['lines']