mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
notification: add test for unread consistency
This commit is contained in:
@@ -92,7 +92,7 @@ class Notification
|
||||
public function addUnreadBy(User $user): self
|
||||
{
|
||||
if (!$this->unreadBy->contains($user)) {
|
||||
$this->unreadBy->add($user);
|
||||
$this->unreadBy[] = $user;
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -136,6 +136,11 @@ class Notification
|
||||
return $this->sender;
|
||||
}
|
||||
|
||||
public function getUnreadBy(): Collection
|
||||
{
|
||||
return $this->unreadBy;
|
||||
}
|
||||
|
||||
public function isReadBy(User $user): bool
|
||||
{
|
||||
return !$this->unreadBy->contains($user);
|
||||
@@ -154,7 +159,7 @@ class Notification
|
||||
public function removeAddressee(User $addressee): self
|
||||
{
|
||||
$this->addressees->removeElement($addressee);
|
||||
$this->unreadBy->removeElement($addressee);
|
||||
$this->removeUnreadBy($addressee);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user