+ /**
+ * Get default text for the comment box
+ *
+ * @return string
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ private function getDefaultText()
+ {
+ $a = self::getApp();
+
+ if (!local_user()) {
+ return '';
+ }
+
+ $owner = User::getOwnerDataById($a->user['uid']);
+
+ if (!Feature::isEnabled(local_user(), 'explicit_mentions')) {
+ return '';
+ }
+
+ $item = Item::selectFirst(['author-addr'], ['id' => $this->getId()]);
+ if (!DBA::isResult($item) || empty($item['author-addr'])) {
+ // Should not happen
+ return '';
+ }
+
+ if ($item['author-addr'] != $owner['addr']) {
+ $text = '@' . $item['author-addr'] . ' ';
+ } else {
+ $text = '';
+ }
+
+ $terms = Term::tagArrayFromItemId($this->getId(), [Term::MENTION, Term::IMPLICIT_MENTION]);
+ foreach ($terms as $term) {
+ $profile = Contact::getDetailsByURL($term['url']);
+ if (!empty($profile['addr']) && (defaults($profile, 'contact-type', Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
+ ($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) {
+ $text .= '@' . $profile['addr'] . ' ';
+ }
+ }
+
+ return $text;
+ }
+