contentlimit: max length of the plain-text content of a notice.
Default is null, meaning to use the site-wide text limit.
0 means no limit.
-defaultscope: default scope for notices. Defaults to 0; set to
- 1 to keep notices private to this site by default.
+defaultscope: default scope for notices. If null, the default
+ scope depends on site/private. It's 1 if the site is private,
+ 0 otherwise. Set this value to override.
message
-------
if (!empty($reply)) {
$notice->scope = $reply->scope;
} else {
- $notice->scope = common_config('notice', 'defaultscope');
+ $notice->scope = self::defaultScope();
}
} else {
$notice->scope = $scope;
$skip = array('_original', '_profile');
return array_diff($vars, $skip);
}
+
+ static function defaultScope()
+ {
+ $scope = common_config('notice', 'defaultscope');
+ if (is_null($scope)) {
+ if (common_config('site', 'private')) {
+ $scope = 1;
+ } else {
+ $scope = 0;
+ }
+ }
+ return $scope;
+ }
}
'gc_limit' => 1000), // max sessions to expire at a time
'notice' =>
array('contentlimit' => null,
- 'defaultscope' => 0), // set to 0 for default open
+ 'defaultscope' => null), // null means 1 if site/private, 0 otherwise
'message' =>
array('contentlimit' => null),
'location' =>
{
global $userprefix;
- $options = array('scope' => common_config('notice', 'defaultscope'));
+ $options = array('scope' => Notice::defaultScope());
$n = rand(0, $i - 1);
$user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n));