aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/track_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/track_controller.rb')
-rw-r--r--app/controllers/track_controller.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index eda7c60a2..0ea3376f5 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -5,7 +5,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_controller.rb,v 1.3 2008-04-04 01:59:40 francis Exp $
+# $Id: track_controller.rb,v 1.4 2008-04-04 03:02:02 francis Exp $
class TrackController < ApplicationController
@@ -51,5 +51,24 @@ class TrackController < ApplicationController
return "now"
end
+ # Delete a track
+ def delete
+ track_thing = TrackThing.find(params[:track_id].to_i)
+
+ if not authenticated_as_user?(track_thing.tracking_user,
+ :web => "To cancel this alert",
+ :email => "Then you can cancel the alert.",
+ :email_subject => "Cancel a WhatDoTheyKnow alert"
+ )
+ # do nothing - as "authenticated?" has done the redirect to signin page for us
+ return
+ end
+
+ track_thing.destroy
+
+ flash[:notice] = "Your alert has been cancelled."
+ redirect_to user_url(track_thing.tracking_user)
+ end
+
end