mirror of
https://github.com/friendica/friendica
synced 2024-11-13 00:22:59 +00:00
Merge pull request #6557 from annando/auto-mention
Don't auto mention yourself or forums, don't do it in the firstlevel
This commit is contained in:
commit
15a5d689c6
5 changed files with 13 additions and 6 deletions
|
@ -775,19 +775,26 @@ class Post extends BaseObject
|
||||||
*/
|
*/
|
||||||
private function getDefaultText()
|
private function getDefaultText()
|
||||||
{
|
{
|
||||||
|
$a = self::getApp();
|
||||||
|
|
||||||
$item = Item::selectFirst(['author-addr'], ['id' => $this->getId()]);
|
$item = Item::selectFirst(['author-addr'], ['id' => $this->getId()]);
|
||||||
if (!DBA::isResult($item) || empty($item['author-addr'])) {
|
if (!DBA::isResult($item) || empty($item['author-addr'])) {
|
||||||
// Should not happen
|
// Should not happen
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($item['author-addr'] != $a->profile['addr']) {
|
||||||
$text = '@' . $item['author-addr'] . ' ';
|
$text = '@' . $item['author-addr'] . ' ';
|
||||||
|
} else {
|
||||||
|
$text = '';
|
||||||
|
}
|
||||||
|
|
||||||
$terms = Term::tagArrayFromItemId($this->getId(), TERM_MENTION);
|
$terms = Term::tagArrayFromItemId($this->getId(), TERM_MENTION);
|
||||||
|
|
||||||
foreach ($terms as $term) {
|
foreach ($terms as $term) {
|
||||||
$profile = Contact::getDetailsByURL($term['url']);
|
$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'] . ' ';
|
$text .= '@' . $profile['addr'] . ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<a class="comment-edit-photo-link" href="{{$mylink}}" title="{{$mytitle}}"><img class="my-comment-photo" src="{{$myphoto}}" alt="{{$mytitle}}" title="{{$mytitle}}" /></a>
|
<a class="comment-edit-photo-link" href="{{$mylink}}" title="{{$mytitle}}"><img class="my-comment-photo" src="{{$myphoto}}" alt="{{$mytitle}}" title="{{$mytitle}}" /></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="comment-edit-photo-end"></div>
|
<div class="comment-edit-photo-end"></div>
|
||||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});" onBlur="commentClose(this,{{$id}});">{{$default}}</textarea>
|
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});" onBlur="commentClose(this,{{$id}});">{{if $threaded != false}}{{$default}}{{/if}}</textarea>
|
||||||
{{if $qcomment}}
|
{{if $qcomment}}
|
||||||
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
|
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
data-role="insert-formatting" data-bbcode="video" data-id="{{$id}}"></a></li>
|
data-role="insert-formatting" data-bbcode="video" data-id="{{$id}}"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="comment-edit-bb-end"></div>
|
<div class="comment-edit-bb-end"></div>
|
||||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen(this, {{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose(this,{{$id}});">{{$default}}</textarea>
|
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen(this, {{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose(this,{{$id}});">{{if $threaded != false}}{{$default}}{{/if}}</textarea>
|
||||||
{{if $qcomment}}
|
{{if $qcomment}}
|
||||||
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
|
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
class="comment-edit-text-empty"
|
class="comment-edit-text-empty"
|
||||||
name="body"
|
name="body"
|
||||||
placeholder="{{$comment}}"
|
placeholder="{{$comment}}"
|
||||||
onFocus="commentOpen(this,{{$id}}) && cmtBbOpen({{$id}});">{{$default}}</textarea>
|
onFocus="commentOpen(this,{{$id}}) && cmtBbOpen({{$id}});">{{if $threaded != false}}{{$default}}{{/if}}</textarea>
|
||||||
{{if $qcomment}}
|
{{if $qcomment}}
|
||||||
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
|
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<a class="comment-edit-photo-link" href="{{$mylink}}" title="{{$mytitle}}"><img class="my-comment-photo" src="{{$myphoto}}" alt="{{$mytitle}}" title="{{$mytitle}}" /></a>
|
<a class="comment-edit-photo-link" href="{{$mylink}}" title="{{$mytitle}}"><img class="my-comment-photo" src="{{$myphoto}}" alt="{{$mytitle}}" title="{{$mytitle}}" /></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="comment-edit-photo-end"></div>
|
<div class="comment-edit-photo-end"></div>
|
||||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});">{{$default}}</textarea>
|
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});">{{if $threaded != false}}{{$default}}{{/if}}</textarea>
|
||||||
{{if $qcomment}}
|
{{if $qcomment}}
|
||||||
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
|
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
|
Loading…
Reference in a new issue