]> git.openstreetmap.org Git - rails.git/commitdiff
Fixed an error + Added email notifications for moderators
authorShrey <shrey14099@iiitd.ac.in>
Sat, 20 Jun 2015 12:06:56 +0000 (17:36 +0530)
committerMatt Amos <zerebubuth@gmail.com>
Mon, 22 Aug 2016 15:17:54 +0000 (16:17 +0100)
app/controllers/issues_controller.rb
app/views/user/view.html.erb

index 6ef7b04235b4943d6d115f184755a9494dd2335a..49984b804bd50cbcf5caef05caa2153d7670875c 100644 (file)
@@ -68,16 +68,18 @@ class IssuesController < ApplicationController
     if !@issue 
       @issue = Issue.find_or_initialize_by(issue_params)
       @issue.updated_by = nil
-      @admins = UserRole.where(role: "administrator")
-      @admins.each do |admin|
-        Notifier.new_issue_notification(User.find(admin.user_id)).deliver_now
-      end
 
       # Reassign to moderators if it is a moderator issue
       @issue.issue_type = "administrator"
       if moderator_issues.include? @issue.reportable.class.name
         reassign_issue
       end
+
+      @admins_or_mods = UserRole.where(role: @issue.issue_type)
+      @admins_or_mods.each do |user|
+        Notifier.new_issue_notification(User.find(user.user_id)).deliver_now
+      end
+
     end
 
     # Check if details provided are sufficient
index 04329feb7a4f89f2d2df62e34ab742ddc99efdc7..41d7b0064213c819b62fa66486cbed77a4d16767 100644 (file)
@@ -82,7 +82,7 @@
             <% end %>
           </li>
           <li>
-             <%= link_to t('user.view.report'), new_issue_url(reportable_id: @this_user.id, reportable_type: @this_user.class.name) %>
+             <%= link_to t('user.view.report'), new_issue_url(reportable_id: @this_user.id, reportable_type: @this_user.class.name, reported_user_id: @this_user.id) %>
           </li>
           <% if @this_user.blocks.exists? %>
             <li>