updated validation for

Push notification delete

User can not delete a push notification
already sent

Change-Id: Idb6e1fb851ee9ae1692f79f292a6b06b888566e9
This commit is contained in:
Sebastian Marcet 2018-04-21 10:24:15 -03:00
parent feb0d479f1
commit 143a1b6b73
2 changed files with 16 additions and 1 deletions

View File

@ -244,7 +244,7 @@ final class SummitPushNotificationService
(
"not_found_errors.SummitPushNotificationService.deleteNotification.NotificationNotFound",
[
'summit_id' => $summit->getId(),
'summit_id' => $summit->getId(),
'notification_id' => $notification_id
]
)
@ -252,6 +252,20 @@ final class SummitPushNotificationService
);
}
if($notification->isSent()){
throw new ValidationException
(
trans
(
'validation_errors.SummitPushNotificationService.deleteNotification.NotificationAlreadySent',
[
'summit_id' => $summit->getId(),
'notification_id' => $notification_id
]
)
);
}
$summit->removeNotification($notification);
});
}

View File

@ -72,4 +72,5 @@ return [
'SummitTrackService.copyTracks.SameSummit' => 'from summit is equal a to summit.',
// SummitPushNotificationService
'SummitPushNotificationService.addPushNotification.MemberNotActive' => 'member :member_id is not active',
'SummitPushNotificationService.deleteNotification.NotificationAlreadySent' => 'notification :notification_id is already sent.',
];