mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
notificaiton: handle remove addressee and reset at the end of registering unread
This commit is contained in:
parent
cb88a37885
commit
a0b112e8db
@ -196,13 +196,27 @@ class Notification
|
||||
$this->addUnreadBy($addressee);
|
||||
}
|
||||
|
||||
foreach ($this->removedAddresses as $addressee) {
|
||||
$this->removeAddressee($addressee);
|
||||
}
|
||||
|
||||
if (null !== $this->addressesOnLoad) {
|
||||
foreach ($this->addressees as $existingAddresse) {
|
||||
if (!$this->addressesOnLoad->contains($existingAddresse)) {
|
||||
$this->addUnreadBy($existingAddresse);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->addressesOnLoad as $onLoadAddressee) {
|
||||
if (!$this->addressees->contains($onLoadAddressee)) {
|
||||
$this->removeUnreadBy($onLoadAddressee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->removedAddresses = [];
|
||||
$this->addedAddresses = [];
|
||||
$this->addressesOnLoad = null;
|
||||
}
|
||||
|
||||
public function removeAddressee(User $addressee): self
|
||||
|
Loading…
x
Reference in New Issue
Block a user