make the default scope depend on site/private
This commit is contained in:
parent
eb90389a22
commit
7e9c17bd15
5
README
5
README
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue
Block a user