]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/diary_entry_controller.rb
No need to restrict friend's diary entries to public users
[rails.git] / app / controllers / diary_entry_controller.rb
index 0444f5a89d7b269299fb2ae9fa51702be052a0e6..2fd239a065369b0d83813baf2262ec40a9b54ed1 100644 (file)
@@ -98,6 +98,34 @@ class DiaryEntryController < ApplicationController
                                         },
                                         :order => 'created_at DESC',
                                         :per_page => 20)
                                         },
                                         :order => 'created_at DESC',
                                         :per_page => 20)
+    elsif params[:friends]
+      if @user
+        @title = t 'diary_entry.list.title_friends'
+        @entry_pages, @entries = paginate(:diary_entries, :include => :user,
+                                          :conditions => {
+                                            :user_id => @user.friend_users,
+                                            :visible => true
+                                          },
+                                          :order => 'created_at DESC',
+                                          :per_page => 20)
+      else
+          require_user
+          return     
+      end
+    elsif params[:nearby]
+      if @user
+        @title = t 'diary_entry.list.title_nearby'
+        @entry_pages, @entries = paginate(:diary_entries, :include => :user,
+                                          :conditions => {
+                                            :user_id => @user.nearby,
+                                            :visible => true
+                                          },
+                                          :order => 'created_at DESC',
+                                          :per_page => 20)                                        
+      else
+          require_user
+          return     
+      end                                  
     else
       @title = t 'diary_entry.list.title'
       @entry_pages, @entries = paginate(:diary_entries, :include => :user,
     else
       @title = t 'diary_entry.list.title'
       @entry_pages, @entries = paginate(:diary_entries, :include => :user,