]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/diary_entries_controller.rb
Merge remote-tracking branch 'upstream/pull/4155'
[rails.git] / app / controllers / diary_entries_controller.rb
index f464cacd0ab459938fd47e112c26b2bb3e9d00fd..018343d7c457dbc3d0565e106f9e6008a78fd0c9 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
@@ -278,7 +280,7 @@ class DiaryEntriesController < ApplicationController
       @lon = @diary_entry.longitude
       @lat = @diary_entry.latitude
       @zoom = 12
-    elsif current_user.home_lat.nil? || current_user.home_lon.nil?
+    elsif !current_user.has_home?
       @lon = params[:lon] || -0.1
       @lat = params[:lat] || 51.5
       @zoom = params[:zoom] || 4