Assign frontend duplicates to the duplicating member only

Duplicating a survey in the member area used to copy the source's full
editor-assignment list onto the copy. Because templates are assigned to
every member, every copy showed up in everyone's overview (customer
pretest finding no. 1, reconfirmed by Ms. Sturm on 2026-09-08 with a
template shared between two members).

A duplicate triggered from the member area (actor present) now belongs
exclusively to the member who created it and receives that member's
categories, mirroring createSurvey. Backend duplication (no actor) keeps
producing an exact 1:1 copy including all assigned members.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
admin.juergenandClaude Fable 5 committed 2026-09-08 15:14:08 +02:00
1 parent 965ce47d48
commit c885d2e4c4
1 file changed
+13 -2
+13 -2
View File
@@ -115,12 +115,23 @@ final class SurveyEditorService
{
return $this->connection->transactional(function () use ($survey, $actorMemberId): SurveyModel {
$sourceSurveyId = (int) $survey->id;
$memberIds = $this->surveyEditorRepository->findMemberIdsBySurvey($sourceSurveyId);
// Frontend-Duplikate (Actor gesetzt) gehören ausschließlich dem auslösenden
// Mitglied und erhalten dessen Kategorien – egal ob die Quelle eine Vorlage
// oder eine zugewiesene Umfrage ist (Kundenentscheidung nach Pretest 08/2026).
// Ohne Actor (Backend) bleibt die exakte 1:1-Kopie inkl. aller Zuweisungen.
$isPersonalCopy = null !== $actorMemberId && $actorMemberId > 0;
$memberIds = $isPersonalCopy
? [$actorMemberId]
: $this->surveyEditorRepository->findMemberIdsBySurvey($sourceSurveyId);
$duplicate = $this->surveyRepository->create($actorMemberId ?? (int) ($survey->createdBy ?? 0), [
'title' => $this->buildDuplicateTitle($survey),
'description' => (string) ($survey->description ?? ''),
'internalNote' => (string) ($survey->internalNote ?? ''),
'category' => $survey->category,
'category' => $isPersonalCopy
? $this->surveyCategoryAssignmentService->getMemberCategoryIds($actorMemberId)
: $survey->category,
'isTemplate' => false,
]);