From 47b3fdf059c5b7a3f4e0b1b892c8b7f6439b4f7d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 26 Mar 2011 16:06:17 -0400 Subject: [PATCH] add scope limit flags to some notices in createsim.php --- scripts/createsim.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/createsim.php b/scripts/createsim.php index 3244cda104..b460be1dd2 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -71,7 +71,7 @@ function newNotice($i, $tagmax) { global $userprefix; - $options = array(); + $options = array('scope' => common_config('notice', 'defaultscope')); $n = rand(0, $i - 1); $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n)); @@ -95,6 +95,10 @@ function newNotice($i, $tagmax) $rprofile = $notices->getProfile(); $content = "@".$rprofile->nickname." ".$content; } + $private_to_addressees = rand(0, 4); + if ($private_to_addressees == 0) { + $options['scope'] |= Notice::ADDRESSEE_SCOPE; + } } } @@ -120,9 +124,19 @@ function newNotice($i, $tagmax) } $options['groups'] = array($groups->id); $content = "!".$groups->nickname." ".$content; + $private_to_group = rand(0, 2); + if ($private_to_group == 0) { + $options['scope'] |= Notice::GROUP_SCOPE; + } } } + $private_to_site = rand(0, 4); + + if ($private_to_site == 0) { + $options['scope'] |= Notice::SITE_SCOPE; + } + $notice = Notice::saveNew($user->id, $content, 'system', $options); }