Skip to content

Commit

Permalink
fix unread message bug
Browse files Browse the repository at this point in the history
  • Loading branch information
g5bot committed Nov 28, 2023
1 parent 90150e5 commit 0a8689d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Module/Message/Lib/PrivateMessageListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function isMarkableAsNew(): bool
}
$this->message->setNew(false);

$this->privateMessageRepository->save($this->message);
$this->privateMessageRepository->save($this->message, true);

return true;
}
Expand Down
6 changes: 5 additions & 1 deletion src/Orm/Repository/PrivateMessageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ public function prototype(): PrivateMessageInterface
return new PrivateMessage();
}

public function save(PrivateMessageInterface $post): void
public function save(PrivateMessageInterface $post, bool $doFlush = false): void
{
$em = $this->getEntityManager();

$em->persist($post);

if ($doFlush) {
$em->flush();
}
}

public function delete(PrivateMessageInterface $post): void
Expand Down
2 changes: 1 addition & 1 deletion src/Orm/Repository/PrivateMessageRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface PrivateMessageRepositoryInterface extends ObjectRepository
{
public function prototype(): PrivateMessageInterface;

public function save(PrivateMessageInterface $post): void;
public function save(PrivateMessageInterface $post, bool $doFlush = false): void;

public function delete(PrivateMessageInterface $post): void;

Expand Down

0 comments on commit 0a8689d

Please sign in to comment.