]> git.openstreetmap.org Git - rails.git/commitdiff
Change abilities based on upstream renamings
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 10 Oct 2018 09:40:41 +0000 (11:40 +0200)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 10 Oct 2018 09:41:16 +0000 (11:41 +0200)
app/controllers/diary_entry_controller.rb
app/models/ability.rb
test/models/abilities_test.rb

index d3d7f6a7cee9d7fbbe4836d4fd3e17d05813c108..cff57920b10cdc7e1c0a4335b0004f5ab4c40496 100644 (file)
@@ -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])
   # 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
     else
       super
     end
index 5be0b37e561068e3aaf0f05b26f0c54475590c38..3919bde921f728a4d66b229978b3dc85724796c1 100644 (file)
@@ -7,7 +7,7 @@ class Ability
     can :index, :site
     can [:permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id, :welcome], :site
 
     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
 
     can [:search, :search_latlon, :search_ca_postcode, :search_osm_nominatim,
          :search_geonames, :search_osm_nominatim_reverse, :search_geonames_reverse], :geocoder
index 28a5c7fd9f30496227994463e41102f605e1aa39..be659af4a45c3baaad3a054f2bfeee02669e13b3 100644 (file)
@@ -17,7 +17,7 @@ class GuestAbilityTest < AbilityTest
 
   test "diary permissions for a guest" do
     ability = Ability.new nil
 
   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
 
       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)
 
   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
 
       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)
 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
 
       assert ability.can?(action, DiaryEntry), "should be able to #{action} DiaryEntries"
     end