From f226464acc17eef89d31c26a3b2226a1c1b7ffa6 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 30 Jan 2019 03:36:24 +0000 Subject: [PATCH] Don't auto mention yourself or forums, don't do it in the firstlevel post --- src/Object/Post.php | 11 +++++++++-- view/templates/comment_item.tpl | 2 +- view/theme/duepuntozero/templates/comment_item.tpl | 2 +- view/theme/quattro/templates/comment_item.tpl | 2 +- view/theme/vier/templates/comment_item.tpl | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Object/Post.php b/src/Object/Post.php index 3ac5c77ee9..bc1123db2b 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -775,19 +775,26 @@ class Post extends BaseObject */ private function getDefaultText() { + $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'] . ' '; } } diff --git a/view/templates/comment_item.tpl b/view/templates/comment_item.tpl index 9412b681eb..352ff417f0 100644 --- a/view/templates/comment_item.tpl +++ b/view/templates/comment_item.tpl @@ -17,7 +17,7 @@ {{$mytitle}}
- + {{if $qcomment}} + {{if $qcomment}} diff --git a/view/theme/vier/templates/comment_item.tpl b/view/theme/vier/templates/comment_item.tpl index 4ef31b7af8..8ccdccb80d 100644 --- a/view/theme/vier/templates/comment_item.tpl +++ b/view/theme/vier/templates/comment_item.tpl @@ -17,7 +17,7 @@ {{$mytitle}}
- + {{if $qcomment}}