Merge branch '0.9.x' into forward

This commit is contained in:
Evan Prodromou 2009-12-11 11:38:08 -05:00
commit 60754fc6de
6 changed files with 42 additions and 27 deletions

View File

@ -231,19 +231,22 @@ class ApiStatusesUpdateAction extends ApiAuthAction
} }
} }
$this->notice = Notice::saveNew( $content = html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8');
$this->user->id,
html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'), $options = array('reply_to' => $reply_to);
$this->source,
1, if (!empty($location)) {
$reply_to, $options['lat'] = $location->lat;
null, $options['lon'] = $location->lon;
null, $options['location_id'] = $location->location_id;
empty($location) ? null : $location->lat, $options['location_ns'] = $location->location_ns;
empty($location) ? null : $location->lon, }
empty($location) ? null : $location->location_id,
empty($location) ? null : $location->location_ns $this->notice =
); Notice::saveNew($this->user->id,
$content,
$this->source,
$options);
if (isset($upload)) { if (isset($upload)) {
$upload->attachToNotice($this->notice); $upload->attachToNotice($this->notice);

View File

@ -187,10 +187,12 @@ class NewnoticeAction extends Action
} }
} }
$notice = Notice::saveNew($user->id, $content_shortened, 'web', 1, $notice = Notice::saveNew($user->id, $content_shortened, 'web',
($replyto == 'false') ? null : $replyto, array('reply_to' => ($replyto == 'false') ? null : $replyto,
null, null, 'lat' => $lat,
$lat, $lon, $location_id, $location_ns); 'lon' => $lon,
'location_id' => $location_id,
'location_ns' => $location_ns));
if (isset($upload)) { if (isset($upload)) {
$upload->attachToNotice($notice); $upload->attachToNotice($notice);

View File

@ -169,9 +169,18 @@ class Notice extends Memcached_DataObject
} }
} }
static function saveNew($profile_id, $content, $source=null, static function saveNew($profile_id, $content, $source, $options=null) {
$is_local=Notice::LOCAL_PUBLIC, $reply_to=null, $uri=null, $created=null,
$lat=null, $lon=null, $location_id=null, $location_ns=null) { if (!empty($options)) {
extract($options);
if (!isset($reply_to)) {
$reply_to = NULL;
}
}
if (empty($is_local)) {
$is_local = Notice::LOCAL_PUBLIC;
}
$profile = Profile::staticGet($profile_id); $profile = Profile::staticGet($profile_id);

View File

@ -433,8 +433,9 @@ class ReplyCommand extends Command
return; return;
} }
$notice = Notice::saveNew($this->user->id, $this->text, $channel->source(), 1, $notice = Notice::saveNew($this->user->id, $this->text, $channel->source(),
$notice->id); array('reply_to' => $notice->id));
if ($notice) { if ($notice) {
$channel->output($this->user, sprintf(_('Reply to %s sent'), $recipient->nickname)); $channel->output($this->user, sprintf(_('Reply to %s sent'), $recipient->nickname));
} else { } else {

View File

@ -359,9 +359,8 @@ class StatusNetOAuthDataStore extends OAuthDataStore
$notice = Notice::saveNew($author->id, $notice = Notice::saveNew($author->id,
$omb_notice->getContent(), $omb_notice->getContent(),
'omb', 'omb',
false, array('is_local' => Notice::REMOTE_OMB,
null, 'uri' => $omb_notice->getIdentifierURI()));
$omb_notice->getIdentifierURI());
common_broadcast_notice($notice, true); common_broadcast_notice($notice, true);
} }

View File

@ -445,8 +445,9 @@ class FacebookAction extends Action
$replyto = $this->trimmed('inreplyto'); $replyto = $this->trimmed('inreplyto');
try { try {
$notice = Notice::saveNew($user->id, $content, $notice = Notice::saveNew($user->id, $content, 'web',
'web', 1, ($replyto == 'false') ? null : $replyto); array('reply_to' => ($replyto == 'false') ? null : $replyto));
} catch (Exception $e) { } catch (Exception $e) {
$this->showPage($e->getMessage()); $this->showPage($e->getMessage());
return; return;