]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/diary_entries_controller.rb
Merge branch 'master' into feature/add-communities-page
[rails.git] / app / controllers / diary_entries_controller.rb
index 5f53e81b65ca05e89ef89f1319a89e2f85feb653..467c4a38f280db468be0b611d6c336eee83eedd8 100644 (file)
@@ -60,9 +60,8 @@ class DiaryEntriesController < ApplicationController
     @title = t "diary_entries.edit.title"
     @diary_entry = DiaryEntry.find(params[:id])
 
-    if current_user != @diary_entry.user
-      redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
-    elsif params[:diary_entry] && @diary_entry.update(entry_params)
+    if current_user != @diary_entry.user ||
+       (params[:diary_entry] && @diary_entry.update(entry_params))
       redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
     else
       set_map_location
@@ -81,7 +80,7 @@ class DiaryEntriesController < ApplicationController
 
       # Notify current subscribers of the new comment
       @entry.subscribers.visible.each do |user|
-        Notifier.diary_comment_notification(@diary_comment, user).deliver_later if current_user != user
+        UserMailer.diary_comment_notification(@diary_comment, user).deliver_later if current_user != user
       end
 
       # Add the commenter to the subscribers if necessary
@@ -235,6 +234,8 @@ class DiaryEntriesController < ApplicationController
   end
 
   def comments
+    @title = t ".title", :user => @user.display_name
+
     conditions = { :user_id => @user }
 
     conditions[:visible] = true unless can? :unhidecomment, DiaryEntry