Browse Source

修改project的查询方式

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
71ad6083dd
5 changed files with 5 additions and 11 deletions
  1. +1
    -7
      app/controllers/issues_controller.rb
  2. +1
    -1
      app/controllers/project_trends_controller.rb
  3. +1
    -1
      app/controllers/pull_requests_controller.rb
  4. +1
    -1
      app/controllers/version_releases_controller.rb
  5. +1
    -1
      app/controllers/versions_controller.rb

+ 1
- 7
app/controllers/issues_controller.rb View File

@@ -1,6 +1,6 @@
class IssuesController < ApplicationController class IssuesController < ApplicationController
before_action :require_login, except: [:index, :show] before_action :require_login, except: [:index, :show]
before_action :find_project_issue
before_action :find_project_with_id
before_action :set_project_and_user before_action :set_project_and_user
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue] 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 :check_issue_permission, except: [:index, :show, :index_chosen]
@@ -430,10 +430,4 @@ class IssuesController < ApplicationController
end end
all_branches all_branches
end end

def find_project_issue
project_id = params[:id]
@project = Project.find_by(id: project_id)
render_not_found("未找到’#{project}’相关的项目") unless @project
end
end end

+ 1
- 1
app/controllers/project_trends_controller.rb View File

@@ -1,5 +1,5 @@
class ProjectTrendsController < ApplicationController class ProjectTrendsController < ApplicationController
before_action :find_project
before_action :find_project_with_id
before_action :check_project_public before_action :check_project_public


def index def index


+ 1
- 1
app/controllers/pull_requests_controller.rb View File

@@ -1,6 +1,6 @@
class PullRequestsController < ApplicationController class PullRequestsController < ApplicationController
before_action :require_login before_action :require_login
before_action :find_project
before_action :find_project_with_id
before_action :set_repository before_action :set_repository
before_action :find_pull_request, except: [:index, :new, :create, :check_can_merge] before_action :find_pull_request, except: [:index, :new, :create, :check_can_merge]
include TagChosenHelper include TagChosenHelper


+ 1
- 1
app/controllers/version_releases_controller.rb View File

@@ -1,5 +1,5 @@
class VersionReleasesController < ApplicationController class VersionReleasesController < ApplicationController
before_action :find_project
before_action :find_project_with_id
before_action :set_user_and_project before_action :set_user_and_project
before_action :require_login, except: [:index] before_action :require_login, except: [:index]
before_action :find_version , only: [:edit, :update, :destroy] before_action :find_version , only: [:edit, :update, :destroy]


+ 1
- 1
app/controllers/versions_controller.rb View File

@@ -1,6 +1,6 @@
class VersionsController < ApplicationController class VersionsController < ApplicationController
before_action :require_login before_action :require_login
before_action :find_project
before_action :find_project_with_id
before_action :check_issue_permission, except: [:show, :index] before_action :check_issue_permission, except: [:show, :index]
before_action :set_version, only: [:edit, :update, :destroy, :show,:update_status] before_action :set_version, only: [:edit, :update, :destroy, :show,:update_status]




Loading…
Cancel
Save