aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Problems.pm
diff options
context:
space:
mode:
authorlouise <louise>2009-10-13 09:25:56 +0000
committerlouise <louise>2009-10-13 09:25:56 +0000
commit43da2c622a6b95e39b197c93fc1456961ea74369 (patch)
treee971ac7c159a1a467c5bd904e2b0b87fad92f553 /perllib/Problems.pm
parent79584cfa97b6923870415537ecc1b04630670698 (diff)
Add some functions for figuring out if a user has accepted new T&Cs
Diffstat (limited to 'perllib/Problems.pm')
-rw-r--r--perllib/Problems.pm47
1 files changed, 46 insertions, 1 deletions
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;