Skip to content

Commit

Permalink
Remove clear cache button from admin
Browse files Browse the repository at this point in the history
Our existing "General Settings" page has a "Clear cache" button.

On stores I've worked on I wouldn't want this exposed to admins. We
should (and afaik we do) expire caches every time the underlying DB
object is changed.

This is motivated partly because I want to replace the
GeneralSettingsController with a StoreController, and this is the only
thing on that page that doesn't directly relate to a store.
  • Loading branch information
jhawthorn committed Jun 30, 2016
1 parent 19b8bf8 commit 9ead23f
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 93 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

* Remove unused `user_id` column from PromotionRule. [#1259](https://github.com/solidusio/solidus/pull/1259)

* Removed "Clear cache" button from the admin [#1275](https://github.com/solidusio/solidus/pull/1275)

## Solidus 1.3.0 (unreleased)

* Order now requires a `store_id` in validations
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion backend/app/assets/javascripts/spree/backend/routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Spree.routes.checkouts_api = Spree.pathFor('api/checkouts')
Spree.routes.classifications_api = Spree.pathFor('api/classifications')
Spree.routes.clear_cache = Spree.pathFor('admin/general_settings/clear_cache')
Spree.routes.option_value_search = Spree.pathFor('api/option_values')
Spree.routes.option_type_search = Spree.pathFor('api/option_types')
Spree.routes.orders_api = Spree.pathFor('api/orders')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ def update
end
end

def clear_cache
Rails.cache.clear
invoke_callbacks(:clear_cache, :after)
head :no_content
end

private

def store_params
Expand Down
16 changes: 0 additions & 16 deletions backend/app/views/spree/admin/general_settings/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,6 @@
</div>
<% end %>

<% if can? :clear_cache, :general_settings %>
<div class="row">
<div class="alpha six columns">
<fieldset class="no-border-bottom">
<legend align="center"><%= Spree.t(:clear_cache)%></legend>
<div>
<%= Spree.t(:clear_cache_warning) %>
</div>
<div class="field" data-hook="general_settings_clear_cache">
<%= button Spree.t(:clear_cache), '', 'button', id: "clear_cache" %>
</div>
</fieldset>
</div>
</div>
<% end %>

<% if can? :update, :general_settings %>
<div class="form-buttons filter-actions actions" data-hook="buttons">
<%= button Spree.t('actions.update'), 'refresh' %>
Expand Down
6 changes: 1 addition & 5 deletions backend/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@
end
end

resource :general_settings, only: [:edit, :update] do
collection do
post :clear_cache
end
end
resource :general_settings, only: [:edit, :update]

resources :return_items, only: [:update]

Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions backend/spec/features/admin/configuration/general_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,4 @@
expect(page).to have_field("Site Name", with: "")
end
end

context "clearing the cache" do
it "should clear the cache" do
expect(page).to_not have_content(Spree.t(:clear_cache_ok))
expect(page).to have_content(Spree.t(:clear_cache_warning))

click_button "Clear Cache"

expect(page).to have_content(Spree.t(:clear_cache_ok))
end
end
end

0 comments on commit 9ead23f

Please sign in to comment.