add scope limit flags to some notices in createsim.php

This commit is contained in:
Evan Prodromou 2011-03-26 16:06:17 -04:00
parent c7f866b032
commit 47b3fdf059

View File

@ -71,7 +71,7 @@ function newNotice($i, $tagmax)
{ {
global $userprefix; global $userprefix;
$options = array(); $options = array('scope' => common_config('notice', 'defaultscope'));
$n = rand(0, $i - 1); $n = rand(0, $i - 1);
$user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n)); $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n));
@ -95,6 +95,10 @@ function newNotice($i, $tagmax)
$rprofile = $notices->getProfile(); $rprofile = $notices->getProfile();
$content = "@".$rprofile->nickname." ".$content; $content = "@".$rprofile->nickname." ".$content;
} }
$private_to_addressees = rand(0, 4);
if ($private_to_addressees == 0) {
$options['scope'] |= Notice::ADDRESSEE_SCOPE;
}
} }
} }
@ -120,8 +124,18 @@ function newNotice($i, $tagmax)
} }
$options['groups'] = array($groups->id); $options['groups'] = array($groups->id);
$content = "!".$groups->nickname." ".$content; $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); $notice = Notice::saveNew($user->id, $content, 'system', $options);
} }