- if (!in_array($note->type, array(ActivityObject::NOTE,
- ActivityObject::BLOGENTRY,
- ActivityObject::STATUS))) {
- $this->clientError(sprintf(_('Cannot handle activity object type "%s"',
- $note->type)));
- return;
+ if ($activity->verb != ActivityVerb::POST) {
+ // TRANS: Client error displayed when not using the POST verb.
+ // TRANS: Do not translate POST.
+ $this->clientError(_('Can only handle POST activities.'));
+ return;
+ }
+
+ $note = $activity->objects[0];
+
+ if (!in_array($note->type, array(ActivityObject::NOTE,
+ ActivityObject::BLOGENTRY,
+ ActivityObject::STATUS))) {
+ // TRANS: Client error displayed when using an unsupported activity object type.
+ // TRANS: %s is the unsupported activity object type.
+ $this->clientError(sprintf(_('Cannot handle activity object type "%s".'),
+ $note->type));
+ return;
+ }
+
+ $saved = $this->postNote($activity);
+
+ Event::handle('EndAtomPubNewActivity', array($activity, $this->user, $saved));
+ }
+
+ if (!empty($saved)) {
+ header('HTTP/1.1 201 Created');
+ header("Location: " . common_local_url('ApiStatusesShow', array('id' => $saved->id,
+ 'format' => 'atom')));
+ $this->showSingleAtomStatus($saved);