Wall: Remove sending a notification when a comment is like that breaks the list of notifications

To fix broken notification lists for everyone, run this SQL query in the database with notifications: DELETE FROM `notifications` WHERE `originModelType` = 6;
This commit is contained in:
Maxim Leshchenko 2021-11-29 13:23:17 +02:00
parent 325c4d23a1
commit 5beff8897c
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE

View file

@ -19,7 +19,7 @@ class Post extends Postable
];
if((sizeof(DB::i()->getContext()->table("likes")->where($searchData)) > 0) !== $liked) {
if($this->getOwner(false)->getId() !== $user->getId() && !($this->getOwner() instanceof Club))
if($this->getOwner(false)->getId() !== $user->getId() && !($this->getOwner() instanceof Club) && !$this instanceof Comment)
(new LikeNotification($this->getOwner(false), $this, $user))->emit();
parent::setLike($liked, $user);
@ -148,7 +148,7 @@ class Post extends Postable
{
$liked = parent::toggleLike($user);
if($this->getOwner(false)->getId() !== $user->getId() && !($this->getOwner() instanceof Club))
if($this->getOwner(false)->getId() !== $user->getId() && !($this->getOwner() instanceof Club) && !$this instanceof Comment)
(new LikeNotification($this->getOwner(false), $this, $user))->emit();
foreach($this->getChildren() as $attachment)