summaryrefslogtreecommitdiff
path: root/actions/postnotice.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-29 22:28:56 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-29 22:28:56 -0400
commitd79dc8344b529281dfb8a8383c529720a429472b (patch)
tree33d4914a14e62b657a426520a5844340c187059b /actions/postnotice.php
parent44fb662efb0e664287863dfe106f332a83a2f622 (diff)
refactor notice-adding code to one static method on Notice
darcs-hash:20080730022856-84dde-f19e4ff5d5ae2603b63b8aebd8f878ec90b3ce22.gz
Diffstat (limited to 'actions/postnotice.php')
-rw-r--r--actions/postnotice.php19
1 files changed, 3 insertions, 16 deletions
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;
}