]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
2) Refactor App->config[] into Core\PConfig
[friendica.git] / src / Object / Post.php
index 3ac5c77ee9545a46674bc4dacd88242688e541ef..847135d3621bf10945d71a652e694c4b9faa4a8f 100644 (file)
@@ -775,19 +775,30 @@ class Post extends BaseObject
         */
        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 '';
                }
 
-               $text = '@' . $item['author-addr'] . ' ';
+               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']) && !strstr($text, $profile['addr'])) {
+                       if (!empty($profile['addr']) && ($profile['contact-type'] != Contact::TYPE_COMMUNITY) &&
+                               ($profile['addr'] != $a->profile['addr']) && !strstr($text, $profile['addr'])) {
                                $text .= '@' . $profile['addr'] . ' ';
                        }
                }