{
protected $form = 'Notice';
+ protected $inreplyto = null;
+
/**
* Title of the page
*
}
}
+ if ($this->int('inreplyto')) {
+ // Throws exception if the inreplyto Notice is given but not found.
+ $this->inreplyto = Notice::getByID($this->int('inreplyto'));
+ }
+
// Backwards compatibility for "share this" widget things.
// If no 'content', use 'status_textarea'
$this->formOpts['content'] = $this->trimmed('content') ?: $this->trimmed('status_textarea');
return;
}
- if ($this->int('inreplyto')) {
- // Throws exception if the inreplyto Notice is given but not found.
- $parent = Notice::getByID($this->int('inreplyto'));
- } else {
- $parent = null;
- }
-
$act = new Activity();
$act->verb = ActivityVerb::POST;
$act->time = time();
$act->context = new ActivityContext();
- if ($parent instanceof Notice) {
- $act->context->replyToID = $parent->getUri();
- $act->context->replyToUrl = $parent->getUrl(true); // maybe we don't have to send true here to force a URL?
+ if ($this->inreplyto instanceof Notice) {
+ $act->context->replyToID = $this->inreplyto->getUri();
+ $act->context->replyToUrl = $this->inreplyto->getUrl(true); // maybe we don't have to send true here to force a URL?
}
if ($this->scoped->shareLocation()) {
// FIXME: We should be able to get the attentions from common_render_content!
// and maybe even directly save whether they're local or not!
- $act->context->attention = common_get_attentions($content, $this->scoped, $parent);
+ $act->context->attention = common_get_attentions($content, $this->scoped, $this->inreplyto);
// $options gets filled with possible scoping settings
ToSelector::fillActivity($this, $act, $options);
$actobj = new ActivityObject();
$actobj->type = ActivityObject::NOTE;
- $actobj->content = common_render_content($content, $this->scoped, $parent);
+ $actobj->content = common_render_content($content, $this->scoped, $this->inreplyto);
// Finally add the activity object to our activity
$act->objects[] = $actobj;
if ($this->getInfo() && $this->stored instanceof Notice) {
$this->showNotice($this->stored);
} elseif (!$this->getError()) {
+ if (!GNUsocial::isAjax() && $this->inreplyto instanceof Notice) {
+ $this->showNotice($this->inreplyto);
+ }
parent::showContent();
}
}