Pārlūkot izejas kodu

[Backend] Tickets : correctif messages non lus

feature/souke
Guillaume Bourgeois pirms 1 gada
vecāks
revīzija
961dc49c87
2 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. +1
    -4
      common/logic/Ticket/Ticket/Repository/TicketRepository.php
  2. +5
    -2
      common/logic/Ticket/Ticket/Service/TicketSolver.php

+ 1
- 4
common/logic/Ticket/Ticket/Repository/TicketRepository.php Parādīt failu

@@ -17,10 +17,7 @@ class TicketRepository extends AbstractRepository
$this->loadQuery(TicketRepositoryQuery::class);
$this->ticketSolver = $this->loadService(TicketSolver::class);
}

/**
* Retourne les options de base nécessaires à la fonction de recherche.
*/
public function getDefaultOptionsSearch(): array
{
return [

+ 5
- 2
common/logic/Ticket/Ticket/Service/TicketSolver.php Parādīt failu

@@ -74,20 +74,23 @@ class TicketSolver extends AbstractSolver
public function isTicketUnread(Ticket $ticket, User $user): int
{
$ticketUser = $this->getTicketUser($ticket, $user);

if($ticketUser) {
foreach($ticket->ticketMessages as $ticketMessage) {
if($this->isTicketMessageUnread($ticketMessage, $ticketUser)) {
return true;
}
}
return false;
}

return false;
return true;
}

public function getFirstTicketMessageUnread(Ticket $ticket, User $user): ?TicketMessage
{
$ticketUser = $this->getTicketUser($ticket, $user);

if($ticketUser) {
foreach($ticket->ticketMessages as $ticketMessage) {
if($this->isTicketMessageUnread($ticketMessage, $ticketUser)) {
@@ -96,7 +99,7 @@ class TicketSolver extends AbstractSolver
}
}

return null;
return $ticket->ticketMessages[0];
}

public function countTicketsUnreadByUserFromArray(array $ticketsArray, User $user): int

Notiek ielāde…
Atcelt
Saglabāt