From d79dc8344b529281dfb8a8383c529720a429472b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 29 Jul 2008 22:28:56 -0400 Subject: refactor notice-adding code to one static method on Notice darcs-hash:20080730022856-84dde-f19e4ff5d5ae2603b63b8aebd8f878ec90b3ce22.gz --- actions/postnotice.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'actions/postnotice.php') diff --git a/actions/postnotice.php b/actions/postnotice.php index b08f27ac4..9540d5536 100644 --- a/actions/postnotice.php +++ b/actions/postnotice.php @@ -74,24 +74,11 @@ class PostnoticeAction extends Action { } $notice = Notice::staticGet('uri', $notice_uri); if (!$notice) { - $notice = new Notice(); - $notice->is_local = 0; - $notice->profile_id = $remote_profile->id; - $notice->uri = $notice_uri; - $notice->content = $content; - $notice->rendered = common_render_content($notice->content, $notice); - if ($notice_url) { - $notice->url = $notice_url; - } - $notice->created = DB_DataObject_Cast::dateTime(); # current time - $id = $notice->insert(); - if (!$id) { - common_server_error(_('Error inserting notice'), 500); + $notice = Notice::saveNew($remote_profile->id, $content, 'omb', 0); + if (is_string($notice)) { + common_server_serror($notice, 500); return false; } - common_save_replies($notice); - $notice->saveTags(); - common_broadcast_notice($notice, true); } return true; } -- cgit v1.2.3-54-g00ecf