mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Send less useless mention notifications
Users will now receive mention notifs only if they're mentioned outside of their content
This commit is contained in:
parent
8a893daec0
commit
25be996256
2 changed files with 10 additions and 2 deletions
|
@ -106,7 +106,11 @@ final class CommentPresenter extends OpenVKPresenter
|
|||
if(($owner = $entity->getOwner()) instanceof User)
|
||||
(new CommentNotification($owner, $comment, $entity, $this->user->identity))->emit();
|
||||
|
||||
$mentions = iterator_to_array($comment->resolveMentions([$this->user->identity->getId()]));
|
||||
$excludeMentions = [$this->user->identity->getId()];
|
||||
if(($owner = $entity->getOwner()) instanceof User)
|
||||
$excludeMentions[] = $owner->getId();
|
||||
|
||||
$mentions = iterator_to_array($comment->resolveMentions($excludeMentions));
|
||||
foreach($mentions as $mentionee)
|
||||
if($mentionee instanceof User)
|
||||
(new MentionNotification($mentionee, $entity, $comment->getOwner(), strip_tags($comment->getText())))->emit();
|
||||
|
|
|
@ -305,7 +305,11 @@ final class WallPresenter extends OpenVKPresenter
|
|||
if($wall > 0 && $wall !== $this->user->identity->getId())
|
||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
||||
|
||||
$mentions = iterator_to_array($post->resolveMentions([$this->user->identity->getId()]));
|
||||
$excludeMentions = [$this->user->identity->getId()];
|
||||
if($wall > 0)
|
||||
$excludeMentions[] = $wall;
|
||||
|
||||
$mentions = iterator_to_array($post->resolveMentions($excludeMentions));
|
||||
foreach($mentions as $mentionee)
|
||||
if($mentionee instanceof User)
|
||||
(new MentionNotification($mentionee, $post, $post->getOwner(), strip_tags($post->getText())))->emit();
|
||||
|
|
Loading…
Reference in a new issue