From 43da2c622a6b95e39b197c93fc1456961ea74369 Mon Sep 17 00:00:00 2001 From: louise Date: Tue, 13 Oct 2009 09:25:56 +0000 Subject: Add some functions for figuring out if a user has accepted new T&Cs --- perllib/Problems.pm | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'perllib/Problems.pm') diff --git a/perllib/Problems.pm b/perllib/Problems.pm index 7eef93b76..2539a97cd 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -6,7 +6,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Problems.pm,v 1.20 2009-09-14 15:09:32 louise Exp $ +# $Id: Problems.pm,v 1.21 2009-10-13 09:25:56 louise Exp $ # package Problems; @@ -257,4 +257,49 @@ sub created_in_interval { date_trunc('day',created)<='$end_date'"; return problems_matching_criteria($criteria); } + +=item data_sharing_notification_start + +Returns the unix datetime when the T&Cs that explicitly allow for users' data to be displayed +on other sites. + +=cut + +sub data_sharing_notification_start { + return 1256947200; +} + +=item user_notified_data_sharing + +Accepts a hash reference of problem data and returns a boolean indicating whether the user who +submitted the problem has accepted T&Cs that explicitly allow for their data to be displayed +on other sites. + +=cut + +sub user_notified_data_sharing { + my ($problem, $notification_start) = @_; + if ($problem->{time} > $notification_start){ + return 1; + } else { + return 0; + } +} + +=item update_user_notified_data_sharing + +Accepts a hash reference of update data and returns a boolean indicating whether the user who submitted +the update has accepted the T&Cs that explicitly allow for their data to be displayed on other sites. + +=cut + +sub update_user_notified_data_sharing { + my ($update, $notification_start) = @_; + if ($update->{created} > $notification_start){ + return 1; + } else { + return 0; + } +} + 1; -- cgit v1.2.3