}
}
- $responses = get_responses($conv_responses, $response_verbs, $this, $item);
+ $responses = get_responses($conv_responses, $response_verbs, $item, $this);
foreach ($response_verbs as $value => $verbs) {
$responses[$verbs]['output'] = !empty($conv_responses[$verbs][$item['uri']]) ? format_like($conv_responses[$verbs][$item['uri']], $conv_responses[$verbs][$item['uri'] . '-l'], $verbs, $item['uri']) : '';
return $this->comment_box_template;
}
+ /**
+ * Get default text for the comment box
+ *
+ * @return string
+ */
+ private function getDefaultText()
+ {
+ if (!local_user()) {
+ return;
+ }
+
+ $a = self::getApp();
+
+ $item = Item::selectFirst(['author-addr'], ['id' => $this->getId()]);
+ if (!DBA::isResult($item) || empty($item['author-addr'])) {
+ // Should not happen
+ return '';
+ }
+
+ if ($item['author-addr'] != $a->profile['addr']) {
+ $text = '@' . $item['author-addr'] . ' ';
+ } else {
+ $text = '';
+ }
+
+ $terms = Term::tagArrayFromItemId($this->getId(), TERM_MENTION);
+
+ foreach ($terms as $term) {
+ $profile = Contact::getDetailsByURL($term['url']);
+ if (!empty($profile['addr']) && ($profile['contact-type'] != Contact::TYPE_COMMUNITY) &&
+ ($profile['addr'] != $a->profile['addr']) && !strstr($text, $profile['addr'])) {
+ $text .= '@' . $profile['addr'] . ' ';
+ }
+ }
+
+ return $text;
+ }
+
/**
* Get the comment box
*
$uid = $conv->getProfileOwner();
$parent_uid = $this->getDataValue('uid');
+ $default_text = $this->getDefaultText();
+
if (!is_null($parent_uid) && ($uid != $parent_uid)) {
$uid = $parent_uid;
}
'$id' => $this->getId(),
'$parent' => $this->getId(),
'$qcomment' => $qcomment,
+ '$default' => $default_text,
'$profile_uid' => $uid,
'$mylink' => $a->removeBaseURL($a->contact['url']),
'$mytitle' => L10n::t('This is you'),