From e707eb5e2b5e9a29147658b3afea11d4227c5e83 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Thu, 16 Jul 2020 12:11:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?FIX=20=E5=8E=BB=E6=8E=89=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E4=B8=8D=E8=83=BD=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=88=AB=E4=BA=BA=E7=A7=81=E6=9C=89=E9=A1=B9=E7=9B=AE=E7=9A=84?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 1c426af1a..6b689ac39 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -123,6 +123,7 @@ class RepositoriesController < ApplicationController end def authorizate! + return if current_user && current_user.admin? if @project.repository.hidden? && !@project.member?(current_user) render_forbidden end @@ -143,7 +144,7 @@ class RepositoriesController < ApplicationController @ref = params[:ref] || "master" end - def get_latest_commit + def get_latest_commit latest_commit = project_commits @latest_commit = latest_commit[:body][0] if latest_commit.present? @commits_count = latest_commit[:total_count] if latest_commit.present? From de1e748e25bb4f81d1244929cfa36475e95e8e5f Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Thu, 16 Jul 2020 13:55:25 +0800 Subject: [PATCH 2/2] reset issues_count --- db/migrate/20200716055018_reset_project_issues_counte.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20200716055018_reset_project_issues_counte.rb diff --git a/db/migrate/20200716055018_reset_project_issues_counte.rb b/db/migrate/20200716055018_reset_project_issues_counte.rb new file mode 100644 index 000000000..15af620c4 --- /dev/null +++ b/db/migrate/20200716055018_reset_project_issues_counte.rb @@ -0,0 +1,9 @@ +class ResetProjectIssuesCounte < ActiveRecord::Migration[5.2] + def change + projects = Project.select(:id, :issues_count).all + projects.each do |p| + puts p.id + Project.reset_counters( p.id, :issues_count, touch: false ) + end + end +end