mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
PHRAS-3399 fix feedback right issue
This commit is contained in:
@@ -302,9 +302,12 @@ class PushController extends Controller
|
||||
// we always add the author of the validation request (current user) to the participants
|
||||
//
|
||||
$found = false;
|
||||
foreach ($participants as $participant) {
|
||||
if ($participant['usr_id'] === $this->getAuthenticatedUser()->getId()) {
|
||||
foreach ($participants as $key => $participant) {
|
||||
if ($Validation->isInitiator($this->getAuthenticatedUser()) && $participant['usr_id'] == $this->getAuthenticatedUser()->getId()) {
|
||||
// the initiator always can see others
|
||||
$participants[$key]['see_others'] = 1;
|
||||
$found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -353,9 +356,14 @@ class PushController extends Controller
|
||||
}
|
||||
// end of sanity check
|
||||
|
||||
// if participant already exists, skip insertion
|
||||
// if participant already exists, just update right
|
||||
try {
|
||||
$Validation->getParticipant($participantUser);
|
||||
$validationParticipant = $Validation->getParticipant($participantUser);
|
||||
$validationParticipant->setCanAgree($participant['agree']);
|
||||
$validationParticipant->setCanSeeOthers($participant['see_others']);
|
||||
$manager->persist($validationParticipant);
|
||||
$manager->flush();
|
||||
|
||||
continue;
|
||||
}
|
||||
catch (NotFoundHttpException $e) {
|
||||
@@ -460,10 +468,17 @@ class PushController extends Controller
|
||||
$this->app->trans('Unknown user %usr_id%', ['%usr_id%' => $userIdToRemove])
|
||||
);
|
||||
}
|
||||
|
||||
$validationParticipant = $Validation->getParticipant($participantUser);
|
||||
$Validation->removeParticipant($validationParticipant);
|
||||
$manager->remove($validationParticipant);
|
||||
|
||||
// if initiator is removed from the user selection,
|
||||
// do not remove it to the participant list, just set can_agree to false for it
|
||||
if ($Validation->isInitiator($participantUser)) {
|
||||
$validationParticipant->setCanAgree(false);
|
||||
$manager->persist($validationParticipant);
|
||||
} else {
|
||||
$Validation->removeParticipant($validationParticipant);
|
||||
$manager->remove($validationParticipant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user