From f8f7ab15685403a2b440723f83fdd8451488c908 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 10 Oct 2018 11:40:41 +0200 Subject: [PATCH] Change abilities based on upstream renamings --- app/controllers/diary_entry_controller.rb | 4 ++-- app/models/ability.rb | 2 +- test/models/abilities_test.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb index d3d7f6a7c..cff57920b 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@ -225,8 +225,8 @@ class DiaryEntryController < ApplicationController # a helpful error message and return them to the user page. def deny_access(exception) if current_user && exception.action.in?([:hide, :hidecomment]) - flash[:error] = t("user.filter.not_an_administrator") - redirect_to :action => "view" + flash[:error] = t("users.filter.not_an_administrator") + redirect_to :action => "show" else super end diff --git a/app/models/ability.rb b/app/models/ability.rb index 5be0b37e5..3919bde92 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -7,7 +7,7 @@ class Ability can :index, :site can [:permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id, :welcome], :site - can [:list, :rss, :view, :comments], DiaryEntry + can [:index, :rss, :show, :comments], DiaryEntry can [:search, :search_latlon, :search_ca_postcode, :search_osm_nominatim, :search_geonames, :search_osm_nominatim_reverse, :search_geonames_reverse], :geocoder diff --git a/test/models/abilities_test.rb b/test/models/abilities_test.rb index 28a5c7fd9..be659af4a 100644 --- a/test/models/abilities_test.rb +++ b/test/models/abilities_test.rb @@ -17,7 +17,7 @@ class GuestAbilityTest < AbilityTest test "diary permissions for a guest" do ability = Ability.new nil - [:list, :rss, :view, :comments].each do |action| + [:index, :rss, :show, :comments].each do |action| assert ability.can?(action, DiaryEntry), "should be able to #{action} DiaryEntries" end @@ -32,7 +32,7 @@ class UserAbilityTest < AbilityTest test "Diary permissions" do ability = Ability.new create(:user) - [:list, :rss, :view, :comments, :create, :edit, :comment, :subscribe, :unsubscribe].each do |action| + [:index, :rss, :show, :comments, :create, :edit, :comment, :subscribe, :unsubscribe].each do |action| assert ability.can?(action, DiaryEntry), "should be able to #{action} DiaryEntries" end @@ -46,7 +46,7 @@ end class AdministratorAbilityTest < AbilityTest test "Diary for an administrator" do ability = Ability.new create(:administrator_user) - [:list, :rss, :view, :comments, :create, :edit, :comment, :subscribe, :unsubscribe, :hide, :hidecomment].each do |action| + [:index, :rss, :show, :comments, :create, :edit, :comment, :subscribe, :unsubscribe, :hide, :hidecomment].each do |action| assert ability.can?(action, DiaryEntry), "should be able to #{action} DiaryEntries" end -- 2.43.2