diff options
author | Stan Hu <stanhu@gmail.com> | 2019-04-06 15:04:27 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-06 15:16:22 +0300 |
commit | 0d8e9f6ee3a49e00b7831b88486b1cbda83026cb (patch) | |
tree | 66bb68cd80fdca405464f681aa994fe6f979345b /app/controllers/projects | |
parent | 7a7c131f7bb69e398a6e2079c11c55bddd8e2bc8 (diff) |
Expand FindCommit caching to blob and refs
This enables FindCommit caching to the following actions:
* BlobController#show
* RefsController#logs_tree
It also improves caching in CommitsController since some
duplicate requests were occuring inside the before_action
definitions.
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects/commits_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/projects/refs_controller.rb | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 7e072788fc9..b04ffe80db4 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -9,6 +9,8 @@ class Projects::BlobController < Projects::ApplicationController include ActionView::Helpers::SanitizeHelper prepend_before_action :authenticate_user!, only: [:edit] + around_action :allow_gitaly_ref_name_caching, only: [:show] + before_action :require_non_empty_project, except: [:new, :create] before_action :authorize_download_code! diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb index a49ede04de7..f540ccee386 100644 --- a/app/controllers/projects/commits_controller.rb +++ b/app/controllers/projects/commits_controller.rb @@ -7,6 +7,7 @@ class Projects::CommitsController < Projects::ApplicationController include RendersCommits prepend_before_action(only: [:show]) { authenticate_sessionless_user!(:rss) } + around_action :allow_gitaly_ref_name_caching before_action :whitelist_query_limiting, except: :commits_root before_action :require_non_empty_project before_action :assign_ref_vars, except: :commits_root @@ -14,8 +15,6 @@ class Projects::CommitsController < Projects::ApplicationController before_action :validate_ref!, except: :commits_root before_action :set_commits, except: :commits_root - around_action :allow_gitaly_ref_name_caching - def commits_root redirect_to project_commits_path(@project, @project.default_branch) end diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index b97fbe19bbf..b3447812ef2 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -4,6 +4,8 @@ class Projects::RefsController < Projects::ApplicationController include ExtractsPath include TreeHelper + around_action :allow_gitaly_ref_name_caching, only: [:logs_tree] + before_action :require_non_empty_project before_action :validate_ref_id before_action :assign_ref_vars |