diff options
author | francis <francis> | 2008-04-04 03:02:02 +0000 |
---|---|---|
committer | francis <francis> | 2008-04-04 03:02:02 +0000 |
commit | e0b7b3a59b0048829f9d2212a07517872ab62dbd (patch) | |
tree | 558b7f5db8d642dc2fc3e63a8880a46957f7c7a6 /app/controllers/track_controller.rb | |
parent | 71f328b5bf24ddaf8b6725001f18d5b62213871d (diff) |
Option to delete tracks.
Diffstat (limited to 'app/controllers/track_controller.rb')
-rw-r--r-- | app/controllers/track_controller.rb | 21 |
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 |