Commit 7e9c17bd authored by Evan Prodromou's avatar Evan Prodromou

make the default scope depend on site/private

parent eb90389a
......@@ -1496,8 +1496,9 @@ Configuration options specific to notices.
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
-------
......
......@@ -448,7 +448,7 @@ class Notice extends Memcached_DataObject
if (!empty($reply)) {
$notice->scope = $reply->scope;
} else {
$notice->scope = common_config('notice', 'defaultscope');
$notice->scope = self::defaultScope();
}
} else {
$notice->scope = $scope;
......@@ -2469,5 +2469,18 @@ class Notice extends Memcached_DataObject
$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;
}
}
......@@ -288,7 +288,7 @@ $default =
'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' =>
......
......@@ -72,7 +72,7 @@ function newNotice($i, $tagmax)
{
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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment