aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-11-17 17:08:33 +0000
committerfrancis <francis>2008-11-17 17:08:33 +0000
commit85b33fcd27fa9fe6f7d94b1974ac4983d7f4d968 (patch)
tree00e531d530882cf6145bd10bfb447e86272139c4
parent888cccd23f968af989954a643230ff10ef6c87cb (diff)
Don't subscribe you to your own requests taht you annotate.
-rw-r--r--app/controllers/comment_controller.rb6
-rw-r--r--app/views/comment/_comment_form.rhtml2
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index d61d91dfe..26c475569 100644
--- a/app/controllers/comment_controller.rb
+++ b/app/controllers/comment_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: comment_controller.rb,v 1.7 2008-11-17 17:01:24 francis Exp $
+# $Id: comment_controller.rb,v 1.8 2008-11-17 17:08:33 francis Exp $
class CommentController < ApplicationController
@@ -54,7 +54,9 @@ class CommentController < ApplicationController
if params[:subscribe_to_request]
@track_thing = TrackThing.create_track_for_request(@info_request)
@existing_track = TrackThing.find_by_existing_track(@user, @track_thing)
- if !@existing_track
+ if @user && @info_request.user == @user
+ # don't subscribe to own request!
+ elsif !@existing_track
@track_thing.track_medium = 'email_daily'
@track_thing.tracking_user_id = @user.id
@track_thing.save!
diff --git a/app/views/comment/_comment_form.rhtml b/app/views/comment/_comment_form.rhtml
index 7ce6ac99a..d7a3e1396 100644
--- a/app/views/comment/_comment_form.rhtml
+++ b/app/views/comment/_comment_form.rhtml
@@ -4,7 +4,7 @@
<br><script type="text/javascript">document.write('<input name="doSpell" type="button" value="Check spelling" onClick="openSpellChecker(document.getElementById(\'comment_form\').body);"/> (optional)')</script>
</p>
- <% if !TrackThing.find_by_existing_track(@user, track_thing) %>
+ <% if !TrackThing.find_by_existing_track(@user, track_thing) && (!@user || @info_request.user != @user) %>
<p>
<%= check_box_tag 'subscribe_to_request', "1", params[:subscribe_to_request] ? true : false %> <label for="subscribe_to_request">Email me future updates to this request</label>
</p>