Caller can set scope for Notice::saveNew()

This commit is contained in:
Evan Prodromou 2011-03-26 15:49:46 -04:00
parent cd8717ca09
commit c7f866b032
3 changed files with 12 additions and 1 deletions

2
README
View File

@ -1472,6 +1472,8 @@ Configuration options specific to notices.
contentlimit: max length of the plain-text content of a notice. contentlimit: max length of the plain-text content of a notice.
Default is null, meaning to use the site-wide text limit. Default is null, meaning to use the site-wide text limit.
0 means no 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 message
------- -------

View File

@ -249,6 +249,7 @@ class Notice extends Memcached_DataObject
* notice in place of extracting links from content * notice in place of extracting links from content
* boolean 'distribute' whether to distribute the notice, default true * boolean 'distribute' whether to distribute the notice, default true
* string 'object_type' URL of the associated object type (default ActivityObject::NOTE) * 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 * @fixme tag override
* *
@ -260,6 +261,7 @@ class Notice extends Memcached_DataObject
'url' => null, 'url' => null,
'reply_to' => null, 'reply_to' => null,
'repeat_of' => null, 'repeat_of' => null,
'scope' => null,
'distribute' => true); 'distribute' => true);
if (!empty($options)) { if (!empty($options)) {
@ -374,6 +376,12 @@ class Notice extends Memcached_DataObject
$notice->object_type = $object_type; $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))) { if (Event::handle('StartNoticeSave', array(&$notice))) {
// XXX: some of these functions write to the DB // XXX: some of these functions write to the DB

View File

@ -288,7 +288,8 @@ $default =
array('enabled' => true, array('enabled' => true,
'css' => ''), 'css' => ''),
'notice' => 'notice' =>
array('contentlimit' => null), array('contentlimit' => null,
'defaultscope' => 0), // set to 0 for default open
'message' => 'message' =>
array('contentlimit' => null), array('contentlimit' => null),
'location' => 'location' =>