diff --git a/app/controllers/issue_tags_controller.rb b/app/controllers/issue_tags_controller.rb
index 82bcc2c20..3cb22b074 100644
--- a/app/controllers/issue_tags_controller.rb
+++ b/app/controllers/issue_tags_controller.rb
@@ -121,7 +121,7 @@ class IssueTagsController < ApplicationController
private
def set_project
- @project = Project.find_by_id(params[:project_id])
+ @project = Project.find_by_identifier! params[:id]
@repository = @project.repository
@user = @project.owner
normal_status(-1, "项目不存在") unless @project.present?
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 33235b2ce..b0aeb9c63 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -1,9 +1,10 @@
class IssuesController < ApplicationController
before_action :require_login, except: [:index, :show]
- before_action :set_project
+ before_action :find_project
+ before_action :set_user
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue]
before_action :check_issue_permission, except: [:index, :show, :index_chosen]
- before_action :set_issue, only: [:edit, :update, :destroy, :show, :copy, :index_chosen, :close_issue, :lock_issue]
+ before_action :set_issue, only: [:edit, :update, :destroy, :show, :copy, :close_issue, :lock_issue]
include ApplicationHelper
include TagChosenHelper
@@ -341,10 +342,8 @@ class IssuesController < ApplicationController
end
private
- def set_project
- @project = Project.find_by_id(params[:project_id])
+ def set_user
@user = @project.owner
- normal_status(-1, "项目不存在") unless @project.present?
normal_status(-1, "用户不存在") unless @user.present?
end
diff --git a/app/controllers/project_trends_controller.rb b/app/controllers/project_trends_controller.rb
index 84821ba65..dcd2d4706 100644
--- a/app/controllers/project_trends_controller.rb
+++ b/app/controllers/project_trends_controller.rb
@@ -1,5 +1,5 @@
class ProjectTrendsController < ApplicationController
- before_action :set_project
+ before_action :find_project
before_action :check_project_public
def index
@@ -34,13 +34,6 @@ class ProjectTrendsController < ApplicationController
private
- def set_project
- @project = Project.find_by_id(params[:project_id])
- unless @project.present?
- normal_status(-1, "项目不存在")
- end
- end
-
def check_project_public
unless @project.is_public || @project.member?(current_user) || current_user.admin?
normal_status(-1, "您没有权限")
diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb
index 655a8cdfc..83b52c8d7 100644
--- a/app/controllers/pull_requests_controller.rb
+++ b/app/controllers/pull_requests_controller.rb
@@ -343,7 +343,7 @@ class PullRequestsController < ApplicationController
private
def set_project
- @project = Project.find_by_id(params[:project_id])
+ @project = Project.find_by_identifier! params[:id]
@repository = @project.repository
@user = @project.owner
normal_status(-1, "项目不存在") unless @project.present?
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index 2ea398f60..ffedc0aa3 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -1,6 +1,6 @@
class VersionsController < ApplicationController
before_action :require_login
- before_action :set_project
+ before_action :find_project
before_action :check_issue_permission, except: [:show, :index]
before_action :set_version, only: [:edit, :update, :destroy, :show,:update_status]
@@ -129,13 +129,6 @@ class VersionsController < ApplicationController
private
- def set_project
- @project = Project.find_by_id(params[:project_id])
- unless @project.present?
- normal_status(-1, "项目不存在")
- end
- end
-
def check_issue_permission
unless @project.member?(current_user) || current_user.admin?
normal_status(-1, "您没有权限")
diff --git a/app/helpers/tag_chosen_helper.rb b/app/helpers/tag_chosen_helper.rb
index 32401f91c..4b0341a4e 100644
--- a/app/helpers/tag_chosen_helper.rb
+++ b/app/helpers/tag_chosen_helper.rb
@@ -88,7 +88,7 @@ module TagChosenHelper
if issue_done_ratio.size > 0
issue_done_ratio.each do |t|
is_chosen = (t == issue_info[8].to_s) ? "1" : "0"
- new_issue = {id:t.to_i, ratio: (t.to_s + "%"), is_chosen: is_chosen}
+ new_issue = {id:t.to_i, name: (t.to_s + "%"), is_chosen: is_chosen}
new_done_info.push(new_issue)
end
end
diff --git a/config/routes.rb b/config/routes.rb
index 1671f9005..38d59cb90 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
-
+
require 'sidekiq/web'
require 'admin_constraint'
mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new
@@ -51,12 +51,12 @@ Rails.application.routes.draw do
resources :issues do
collection do
get :commit_issues
+ get :index_chosen
end
member do
post :copy
- get :index_chosen
- post :close_issue
- post :lock_issue
+ post :close_issue
+ post :lock_issue
end
end
resources :issue_tags, only: [:create, :edit, :update, :destroy, :index]
diff --git a/public/react/build/asset-manifest.json b/public/react/build/asset-manifest.json
index ae7436829..19d317a25 100644
--- a/public/react/build/asset-manifest.json
+++ b/public/react/build/asset-manifest.json
@@ -22,7 +22,7 @@
"./static/js/116.46fa8276.chunk.js": "./static/js/116.46fa8276.chunk.js",
"./static/js/117.55b8beae.chunk.js": "./static/js/117.55b8beae.chunk.js",
"./static/js/118.856e6bf9.chunk.js": "./static/js/118.856e6bf9.chunk.js",
- "./static/js/119.0fa0c738.chunk.js": "./static/js/119.0fa0c738.chunk.js",
+ "./static/js/119.c3b690b7.chunk.js": "./static/js/119.c3b690b7.chunk.js",
"./static/js/12.6509ed4d.chunk.js": "./static/js/12.6509ed4d.chunk.js",
"./static/js/120.68ad4d6c.chunk.js": "./static/js/120.68ad4d6c.chunk.js",
"./static/js/121.db7cc71b.chunk.js": "./static/js/121.db7cc71b.chunk.js",
@@ -50,7 +50,7 @@
"./static/js/141.284d9bfe.chunk.js": "./static/js/141.284d9bfe.chunk.js",
"./static/js/142.f3715fcd.chunk.js": "./static/js/142.f3715fcd.chunk.js",
"./static/js/143.09415fe5.chunk.js": "./static/js/143.09415fe5.chunk.js",
- "./static/js/144.ea33eeca.chunk.js": "./static/js/144.ea33eeca.chunk.js",
+ "./static/js/144.3a5e2d3a.chunk.js": "./static/js/144.3a5e2d3a.chunk.js",
"./static/js/145.78c86248.chunk.js": "./static/js/145.78c86248.chunk.js",
"./static/js/146.28d5e184.chunk.js": "./static/js/146.28d5e184.chunk.js",
"./static/js/147.d218efb2.chunk.js": "./static/js/147.d218efb2.chunk.js",
@@ -66,7 +66,7 @@
"./static/js/156.38f11f3a.chunk.js": "./static/js/156.38f11f3a.chunk.js",
"./static/js/157.9477972f.chunk.js": "./static/js/157.9477972f.chunk.js",
"./static/js/158.cbb28a62.chunk.js": "./static/js/158.cbb28a62.chunk.js",
- "./static/js/159.99b4d99d.chunk.js": "./static/js/159.99b4d99d.chunk.js",
+ "./static/js/159.776c3fb9.chunk.js": "./static/js/159.776c3fb9.chunk.js",
"./static/js/16.2de041d9.chunk.js": "./static/js/16.2de041d9.chunk.js",
"./static/js/160.1d01deb6.chunk.js": "./static/js/160.1d01deb6.chunk.js",
"./static/js/161.823c1dc2.chunk.js": "./static/js/161.823c1dc2.chunk.js",
@@ -250,7 +250,7 @@
"./static/js/98.d0f20225.chunk.js": "./static/js/98.d0f20225.chunk.js",
"./static/js/99.cb16e98d.chunk.js": "./static/js/99.cb16e98d.chunk.js",
"main.css": "./static/css/main.3b8b9b10.css",
- "main.js": "./static/js/main.5baa785f.js",
+ "main.js": "./static/js/main.e8470489.js",
"static/media/KaTeX_AMS-Regular.ttf": "static/media/KaTeX_AMS-Regular.aaf4eee9.ttf",
"static/media/KaTeX_AMS-Regular.woff": "static/media/KaTeX_AMS-Regular.7f06b4e3.woff",
"static/media/KaTeX_AMS-Regular.woff2": "static/media/KaTeX_AMS-Regular.e78e28b4.woff2",
diff --git a/public/react/build/index.html b/public/react/build/index.html
index 193568918..95404cb61 100644
--- a/public/react/build/index.html
+++ b/public/react/build/index.html
@@ -24,7 +24,7 @@
_host = 'https://ali-cdn.educoder.net/react/build/'
}
document.write('