]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/diary_entries_controller.rb
Merge pull request #4106 from tomhughes/diary-paging
[rails.git] / app / controllers / diary_entries_controller.rb
index f464cacd0ab459938fd47e112c26b2bb3e9d00fd..ea9aacb21d97f5e72b18e95fc3e28635cf89d903 100644 (file)
@@ -70,7 +70,9 @@ class DiaryEntriesController < ApplicationController
   end
 
   def show
-    @entry = @user.diary_entries.visible.where(:id => params[:id]).first
+    entries = @user.diary_entries
+    entries = entries.visible unless can? :unhide, DiaryEntry
+    @entry = entries.where(:id => params[:id]).first
     if @entry
       @title = t ".title", :user => params[:display_name], :title => @entry.title
       @comments = can?(:unhidecomment, DiaryEntry) ? @entry.comments : @entry.visible_comments