+ /**
+ * Get default text for the comment box
+ *
+ * @param integer $parent_id ID of the parent item
+ *
+ * @return string
+ */
+ private function getDefaultText($parent_id)
+ {
+ $item = Item::selectFirst(['author-addr'], ['id' => $parent_id]);
+ if (!DBA::isResult($item) || empty($item['author-addr'])) {
+ // Should not happen
+ return '';
+ }
+
+ $text = '@'.$item['author-addr'].' ';
+
+ $terms = Term::tagArrayFromItemId($parent_id, TERM_MENTION);
+
+ foreach ($terms as $term) {
+ $profile = Contact::getDetailsByURL($term['url']);
+ if (!empty($profile['addr']) && !strstr($text, $profile['addr'])) {
+ $text .= '@' . $profile['addr'] . ' ';
+ }
+ }
+
+ return $text;
+ }
+