Merge branch 'pre_trustie_server' into trustie_server
This commit is contained in:
commit
99f7fe6102
|
@ -238,6 +238,13 @@ class ProjectsController < ApplicationController
|
||||||
def simple
|
def simple
|
||||||
# 为了缓存活跃项目的基本信息,后续删除
|
# 为了缓存活跃项目的基本信息,后续删除
|
||||||
Cache::V2::ProjectCommonService.new(@project.id).read
|
Cache::V2::ProjectCommonService.new(@project.id).read
|
||||||
|
# 项目名称,标识,所有者变化时重置缓存
|
||||||
|
project_common = $redis_cache.hgetall("v2-project-common:#{@project.id}")
|
||||||
|
if project_common.present?
|
||||||
|
if project_common["name"] != @project.name || project_common["identifier"] != @project.identifier || project_common["owner_id"] != @project.user_id
|
||||||
|
Cache::V2::ProjectCommonService.new(@project.id).reset
|
||||||
|
end
|
||||||
|
end
|
||||||
json_response(@project, current_user)
|
json_response(@project, current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"] || contributor["login"]}-#{contributor["email"]}")
|
user = render_cache_commit_author(contributor)
|
||||||
if user.blank?
|
if user.present?
|
||||||
json.contributions contributor["commits"] || contributor["contributions"]
|
if user.is_a?(Hash)
|
||||||
json.login nil
|
|
||||||
json.type nil
|
|
||||||
json.name (contributor["name"] || contributor["login"]).to_s.downcase
|
|
||||||
json.email contributor["email"]
|
|
||||||
json.image_url User::Avatar.get_letter_avatar_url(contributor["name"] || contributor["login"])
|
|
||||||
json.contribution_perc User.new(login: (contributor["name"] || contributor["login"]), mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"])
|
|
||||||
else
|
|
||||||
json.contributions contributor["commits"] || contributor["contributions"]
|
json.contributions contributor["commits"] || contributor["contributions"]
|
||||||
json.id user["id"]
|
json.id user["id"]
|
||||||
json.login user["login"]
|
json.login user["login"]
|
||||||
|
@ -17,4 +10,24 @@ else
|
||||||
json.image_url user["avatar_url"]
|
json.image_url user["avatar_url"]
|
||||||
db_user = User.find_by_id(user["id"])
|
db_user = User.find_by_id(user["id"])
|
||||||
json.contribution_perc db_user.simple_contribution_perc(project, contributor["contribution_perc"]) if db_user.present?
|
json.contribution_perc db_user.simple_contribution_perc(project, contributor["contribution_perc"]) if db_user.present?
|
||||||
|
else
|
||||||
|
json.contributions contributor["commits"] || contributor["contributions"]
|
||||||
|
json.id user.id
|
||||||
|
json.login user.login
|
||||||
|
json.email user.mail
|
||||||
|
json.type user.type
|
||||||
|
json.name (user["name"] || contributor["name"] || contributor["login"]).to_s.downcase
|
||||||
|
json.image_url url_to_avatar(user)
|
||||||
|
json.contribution_perc user.simple_contribution_perc(project, contributor["contribution_perc"]) if user.present?
|
||||||
|
end
|
||||||
|
else
|
||||||
|
json.contributions contributor["commits"] || contributor["contributions"]
|
||||||
|
json.id nil
|
||||||
|
json.login nil
|
||||||
|
json.type nil
|
||||||
|
json.name (contributor["name"] || contributor["login"]).to_s.downcase
|
||||||
|
json.email contributor["email"]
|
||||||
|
json.image_url User::Avatar.get_letter_avatar_url(contributor["name"] || contributor["login"])
|
||||||
|
json.contribution_perc User.new(login: (contributor["name"] || contributor["login"]), mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddForgeAppliedMessageUtf8mb4 < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
execute("ALTER TABLE `forge_applied_messages` MODIFY `name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue