From 1d0bb50fd3dac805456083e9f8fc0adf93bebf16 Mon Sep 17 00:00:00 2001 From: francis Date: Thu, 5 Mar 2009 19:09:46 +0000 Subject: Button to delete all tracks of a particular type. --- app/controllers/track_controller.rb | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 229229fff..635f9401a 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.27 2008-09-11 09:36:10 francis Exp $ +# $Id: track_controller.rb,v 1.28 2009-03-05 19:09:47 francis Exp $ class TrackController < ApplicationController @@ -146,5 +146,31 @@ class TrackController < ApplicationController end end + # Remove all tracks of a certain type (e.g. requests / users / bodies) + def delete_all_type + user_id = User.find(params[:user].to_i) + + if not authenticated_as_user?(user_id, + :web => "To cancel these alerts", + :email => "Then you can cancel the alerts.", + :email_subject => "Cancel some WhatDoTheyKnow alerts" + ) + # do nothing - as "authenticated?" has done the redirect to signin page for us + return + end + + track_type = params[:track_type] + + flash[:notice] = "

You will no longer be emailed updates about:

" + + redirect_to params[:r] + end + + end -- cgit v1.2.3