]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/map_bugs_controller.rb
Send notification emails when someone comments on a map bug report
[rails.git] / app / controllers / map_bugs_controller.rb
index 41881cfb79577ed0dc1a46b10e95de9bfccc3063..a967384b6ab1da4ef7a1178621178499fcf952c2 100644 (file)
@@ -206,7 +206,7 @@ class MapBugsController < ApplicationController
   def my_bugs
  
     if params[:display_name] 
-      @user2 = User.find_by_display_name(params[:display_name], :conditions => { :visible => true }) 
+      @user2 = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] }) 
  
       if @user2  
         if @user2.data_public? or @user2 == @user 
@@ -311,7 +311,18 @@ private
     end
     bug_comment.save; 
     bug.last_changed = t 
-    bug.save 
+    bug.save
+
+       sent_to = Set.new;
+       bug.map_bug_comment.each do | cmt |
+         if cmt.user
+               unless sent_to.include?(cmt.user)
+          Notifier.deliver_bug_comment_notification(bug_comment, cmt.user) unless cmt.user == @user;
+          sent_to.add(cmt.user);
+        end
+      end
+    end
+       
   end
 
 end