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
body :friend => friend
end
+ def bug_comment_notification(bug_comment, recipient)
+ common_headers recipient
+ commenter_name = bug_comment.user.display_name if bug_comment.user
+ commenter_name = bug_comment.commenter_name unless bug_comment.user
+ owner = (recipient == bug_comment.map_bug.map_bug_comment[0].user);
+ subject I18n.t('notifier.map_bug_plain.subject_own', :commenter => commenter_name) if owner
+ subject I18n.t('notifier.map_bug_plain.subject_other', :commenter => commenter_name) unless owner
+
+ body :bugurl => url_for(:host => SERVER_URL,
+ :controller => "browse",
+ :action => "bug",
+ :id => bug_comment.bug_id),
+ :place => bug_comment.map_bug.nearby_place,
+ :comment => bug_comment.comment,
+ :owner => owner,
+ :commenter => commenter_name
+ end
+
private
def common_headers(recipient)
--- /dev/null
+<%= t 'notifier.map_bug_plain.greeting' %>
+
+<% if @owner %>
+<%= t 'notifier.map_bug_plain.your_bug', :commenter => @commenter, :place => @place %>
+<% else %>
+<%= t 'notifier.map_bug_plain.commented_bug', :commenter => @commenter, :place => @place %>
+<% end %>
+
+==
+<%= @comment %>
+==
+
+<%= t 'notifier.map_bug_plain.details', :URL => @bugurl %>
+
+
greeting: "Hi,"
hopefully_you: "Someone (possibly you) has asked for the password to be reset on this email address's openstreetmap.org account."
click_the_link: "If this is you, please click the link below to reset your password."
+ map_bug_plain:
+ subject_own: "[OpenStreetMap bugs] {{commenter}} has commented on one of your bugs"
+ subject_other: "[OpenStreetMap bugs] {{commenter}} has commented on a bug you are interested in"
+ greeting: "Hi,"
+ your_bug: "{{commenter}} has left a comment on one of your map bug reports near {{place}}."
+ commented_bug: "{{commenter}} has left a comment on a map bug report you have commented on. The bug is near {{place}}."
+ details: "More details about the bug report can be found at {{URL}}."
+
message:
inbox:
title: "Inbox"