+ $this->actionName = $action->trimmed('action');
+
+ $prefill = array('content', 'inreplyto', 'lat',
+ 'lon', 'location_id', 'location_ns',
+ 'to_group', 'to_profile', 'private');
+
+ foreach ($prefill as $fieldName) {
+ if (array_key_exists($fieldName, $options)) {
+ $this->$fieldName = $options[$fieldName];
+ }
+ }
+
+ // Prefill the profile if we're replying
+
+ if (empty($this->to_profile) &&
+ !empty($this->inreplyto)) {
+ $notice = Notice::staticGet('id', $this->inreplyto);
+ if (!empty($notice)) {
+ $this->to_profile = $notice->getProfile();
+ }
+ }
+
+ if (array_key_exists('user', $options)) {
+ $this->user = $options['user'];