mirror of
https://github.com/friendica/friendica
synced 2025-04-27 11:10:12 +00:00
Don't auto mention yourself or forums, don't do it in the firstlevel post
This commit is contained in:
parent
3a27d66b8a
commit
f226464acc
5 changed files with 13 additions and 6 deletions
|
@ -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'] . ' ';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue