From c7f866b03251dfdbab3d932f6d87ae2b349cd1c4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 26 Mar 2011 15:49:46 -0400 Subject: [PATCH] Caller can set scope for Notice::saveNew() --- README | 2 ++ classes/Notice.php | 8 ++++++++ lib/default.php | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README b/README index 0dcbeea239..ef032cad84 100644 --- a/README +++ b/README @@ -1472,6 +1472,8 @@ 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. message ------- diff --git a/classes/Notice.php b/classes/Notice.php index 83507f3bc0..b380f027a2 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -249,6 +249,7 @@ class Notice extends Memcached_DataObject * notice in place of extracting links from content * boolean 'distribute' whether to distribute the notice, default true * string 'object_type' URL of the associated object type (default ActivityObject::NOTE) + * int 'scope' Scope bitmask; default to SITE_SCOPE on private sites, 0 otherwise * * @fixme tag override * @@ -260,6 +261,7 @@ class Notice extends Memcached_DataObject 'url' => null, 'reply_to' => null, 'repeat_of' => null, + 'scope' => null, 'distribute' => true); if (!empty($options)) { @@ -374,6 +376,12 @@ class Notice extends Memcached_DataObject $notice->object_type = $object_type; } + if (is_null($scope)) { // 0 is a valid value + $notice->scope = common_config('notice', 'defaultscope'); + } else { + $notice->scope = $scope; + } + if (Event::handle('StartNoticeSave', array(&$notice))) { // XXX: some of these functions write to the DB diff --git a/lib/default.php b/lib/default.php index e6caf0301a..9872d8ffd3 100644 --- a/lib/default.php +++ b/lib/default.php @@ -288,7 +288,8 @@ $default = array('enabled' => true, 'css' => ''), 'notice' => - array('contentlimit' => null), + array('contentlimit' => null, + 'defaultscope' => 0), // set to 0 for default open 'message' => array('contentlimit' => null), 'location' => -- 2.39.5