Refactor code that checks for list deletion with form

Move segment deletion to new function doTrash to avoid calling methods twice on individual segment deletion. Refactor acceptance test.

[MAILPOET-3661]
This commit is contained in:
Brezo Cordero
2021-07-30 17:32:41 -05:00
committed by Veljko V
parent 711830d44d
commit b2857cbf40
3 changed files with 21 additions and 27 deletions

View File

@ -209,7 +209,7 @@ class Segments extends APIEndpoint {
$this->subscribersRepository->bulkTrash($subscriberIds);
}
$this->segmentsRepository->bulkTrash([$segment->getId()], $segment->getType());
$this->segmentsRepository->doTrash([$segment->getId()], $segment->getType());
$this->segmentsRepository->refresh($segment);
return $this->successResponse(
$this->segmentsResponseBuilder->build($segment),