From 0f8d2e6a5d1c081515cba6d48a47894940d393f7 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 12 Dec 2022 14:25:02 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9Agitea-client=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 009eda921..e37371108 100644 --- a/Gemfile +++ b/Gemfile @@ -139,4 +139,4 @@ gem 'doorkeeper' gem 'doorkeeper-jwt' -gem 'gitea-client', '~> 0.10.6' \ No newline at end of file +gem 'gitea-client', '~> 0.11.1' \ No newline at end of file From cec764127e6779ef93d19404a2cefda69b4dd2e7 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 4 Jan 2023 09:19:42 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=8E=92=E8=A1=8C=E6=A6=9C=E8=A7=84=E5=88=99=E5=8F=8A?= =?UTF-8?q?=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_rank_controller.rb | 2 +- app/models/project.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/project_rank_controller.rb b/app/controllers/project_rank_controller.rb index 7bd62987e..8584d070f 100644 --- a/app/controllers/project_rank_controller.rb +++ b/app/controllers/project_rank_controller.rb @@ -4,7 +4,7 @@ class ProjectRankController < ApplicationController $redis_cache.zunionstore("recent-days-project-rank", get_timeable_key_names) deleted_data = $redis_cache.smembers("v2-project-rank-deleted") $redis_cache.zrem("recent-days-project-rank", deleted_data) unless deleted_data.blank? - @project_rank = $redis_cache.zrevrange("recent-days-project-rank", 0, 4, withscores: true) + @project_rank = $redis_cache.zrevrange("recent-days-project-rank", 0, 9, withscores: true) rescue Exception => e @project_rank = [] end diff --git a/app/models/project.rb b/app/models/project.rb index 31da85252..dbe8469df 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -178,6 +178,9 @@ class Project < ApplicationRecord $redis_cache.srem("v2-project-rank-deleted", self.id) end end + if !self.common? + $redis_cache.srem("v2-project-rank-deleted", self.id) + end end def decre_project_common From 6b9adefde2cefcf40b23d25931acae31618da6d9 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 4 Jan 2023 09:43:18 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Aaction=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index dbe8469df..840661ee7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -179,7 +179,7 @@ class Project < ApplicationRecord end end if !self.common? - $redis_cache.srem("v2-project-rank-deleted", self.id) + CacheAsyncClearJob.perform_later('project_rank_service', self.id) end end From a274fa913d9b93d8af6e70c53410b715410cdb23 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 4 Jan 2023 11:38:07 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=8E=92=E8=A1=8C=E6=A6=9C=E7=BC=93=E5=AD=98=E9=94=AE?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=97=B6=E9=97=B4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_rank_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/project_rank_controller.rb b/app/controllers/project_rank_controller.rb index 8584d070f..5cea074fb 100644 --- a/app/controllers/project_rank_controller.rb +++ b/app/controllers/project_rank_controller.rb @@ -1,10 +1,10 @@ class ProjectRankController < ApplicationController # 根据时间获取热门项目 def index - $redis_cache.zunionstore("recent-days-project-rank", get_timeable_key_names) + $redis_cache.zunionstore("recent-days-project-rank-#{time}", get_timeable_key_names) deleted_data = $redis_cache.smembers("v2-project-rank-deleted") - $redis_cache.zrem("recent-days-project-rank", deleted_data) unless deleted_data.blank? - @project_rank = $redis_cache.zrevrange("recent-days-project-rank", 0, 9, withscores: true) + $redis_cache.zrem("recent-days-project-rank-#{time}", deleted_data) unless deleted_data.blank? + @project_rank = $redis_cache.zrevrange("recent-days-project-rank-#{time}", 0, 9, withscores: true) rescue Exception => e @project_rank = [] end From e1c600a2f518d2edb25663b279db86cd321e2a7b Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 5 Jan 2023 15:40:03 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=A4=A7=E5=B0=8F=E6=9C=80=E9=AB=98=E9=99=90=E5=88=B6?= =?UTF-8?q?=E4=B8=BA50?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b88849f56..7490cb27f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -665,7 +665,7 @@ class ApplicationController < ActionController::Base def kaminari_paginate(relation) limit = params[:limit] || params[:per_page] - limit = (limit.to_i.zero? || limit.to_i > 25) ? 25 : limit.to_i + limit = (limit.to_i.zero? || limit.to_i > 50) ? 50 : limit.to_i page = params[:page].to_i.zero? ? 1 : params[:page].to_i relation.page(page).per(limit) From 56d9a4f46bed5f87a2968025e4571f3829e27271 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 6 Jan 2023 11:16:50 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fixed=20=E4=BB=A3=E7=A0=81=E8=B4=A1?= =?UTF-8?q?=E7=8C=AE=E8=80=85email?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projects/code_stats/index.json.jbuilder | 2 +- .../v1/users/_commit_user_email.json.jbuilder | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/views/api/v1/users/_commit_user_email.json.jbuilder diff --git a/app/views/api/v1/projects/code_stats/index.json.jbuilder b/app/views/api/v1/projects/code_stats/index.json.jbuilder index d438e2624..0b64270f7 100644 --- a/app/views/api/v1/projects/code_stats/index.json.jbuilder +++ b/app/views/api/v1/projects/code_stats/index.json.jbuilder @@ -6,7 +6,7 @@ json.deletions @result_object["deletions"] json.commit_count_in_all_branches @result_object["commit_count_in_all_branches"] json.authors @result_object["authors"].each do |author| json.author do - json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(author), name: author['name'] } + json.partial! 'api/v1/users/commit_user_email', locals: { user: render_cache_commit_author(author), name: author['name'], email: author['email'] } end json.commits author["commits"] json.additions author["additions"] diff --git a/app/views/api/v1/users/_commit_user_email.json.jbuilder b/app/views/api/v1/users/_commit_user_email.json.jbuilder new file mode 100644 index 000000000..c4963628a --- /dev/null +++ b/app/views/api/v1/users/_commit_user_email.json.jbuilder @@ -0,0 +1,22 @@ +if user.present? + if user.is_a?(Hash) + json.id user["id"] + json.login user["login"] + json.name user["name"] + json.type user["type"] + json.image_url user["avatar_url"] + else + json.id user.id + json.login user.login + json.name user.real_name + json.type user&.type + json.image_url url_to_avatar(user) + end +else + json.id nil + json.login name + json.name name + json.email email + json.type nil + json.image_url User::Avatar.get_letter_avatar_url(name) +end