Add a random string when creating a segment if the name already exists
This ensures that it is possible to create multiple segments from the same template. [MAILPOET-5394]
This commit is contained in:
committed by
Aschepikov
parent
dba4ba4dfc
commit
f806b3362c
@ -38,6 +38,11 @@ class SegmentSaveController {
|
||||
public function save(array $data = []): SegmentEntity {
|
||||
$id = isset($data['id']) ? (int)$data['id'] : null;
|
||||
$name = $data['name'] ?? '';
|
||||
|
||||
if (!$this->segmentsRepository->isNameUnique($name, null) && isset($data['force_creation']) && $data['force_creation'] === 'true') {
|
||||
$name = $name . ' (' . wp_generate_password(12, false) . ')';
|
||||
}
|
||||
|
||||
$description = $data['description'] ?? '';
|
||||
$filtersData = $this->filterDataMapper->map($data);
|
||||
|
||||
|
Reference in New Issue
Block a user