Commit c7f866b0 authored by Evan Prodromou's avatar Evan Prodromou

Caller can set scope for Notice::saveNew()

parent cd8717ca
......@@ -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
-------
......
......@@ -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
......
......@@ -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' =>
......
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