]> git.openstreetmap.org Git - rails.git/commitdiff
Don't send a noification email if somebody comments on their own diary
authorTom Hughes <tom@compton.nu>
Sat, 11 Jul 2009 13:24:57 +0000 (13:24 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 11 Jul 2009 13:24:57 +0000 (13:24 +0000)
entry. Fixes #2053.

app/controllers/diary_entry_controller.rb

index 7a442ac58a3744a4656b0d0498d874feb946d838..48cdda8a03df2823b55684ccd63d3265b41496ce 100644 (file)
@@ -54,7 +54,10 @@ class DiaryEntryController < ApplicationController
     @diary_comment = @entry.diary_comments.build(params[:diary_comment])
     @diary_comment.user = @user
     if @diary_comment.save
     @diary_comment = @entry.diary_comments.build(params[:diary_comment])
     @diary_comment.user = @user
     if @diary_comment.save
-      Notifier::deliver_diary_comment_notification(@diary_comment)
+      if @diary_comment.user != @entry.user
+        Notifier::deliver_diary_comment_notification(@diary_comment)
+      end
+
       redirect_to :controller => 'diary_entry', :action => 'view', :display_name => @entry.user.display_name, :id => @entry.id
     else
       render :action => 'view'
       redirect_to :controller => 'diary_entry', :action => 'view', :display_name => @entry.user.display_name, :id => @entry.id
     else
       render :action => 'view'