diff --git a/README b/README index 74ef138a2a32f6302c50f43ae1b0193e5b703bb3..f5a0e27cc54873e752448a02f22498342ad41160 100644 --- a/README +++ b/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 ------- diff --git a/classes/Notice.php b/classes/Notice.php index 87363158dd7bd9353ed06b07f27f087d1ec84488..29824ab700587eef371e1737d834914c2f332dd3 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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; + } } diff --git a/lib/default.php b/lib/default.php index 938716b3a4361cda496a94946eae67fa8ef444e0..4a7d6110c5c95c5c648becf63e5655e7cdb6c44a 100644 --- a/lib/default.php +++ b/lib/default.php @@ -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' => diff --git a/scripts/createsim.php b/scripts/createsim.php index 14790aa8f39467751de56409c383876cb23652be..e3677e1564bda25293619f7acb4b2299b61aefd7 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -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));