diff --git a/webapp/src/Controller/Jury/ImportExportController.php b/webapp/src/Controller/Jury/ImportExportController.php index 357071eccc..b1bea23010 100644 --- a/webapp/src/Controller/Jury/ImportExportController.php +++ b/webapp/src/Controller/Jury/ImportExportController.php @@ -164,7 +164,7 @@ public function indexAction(Request $request): Response $this->dj->auditlog('problem', $newProblem->getProbid(), 'upload zip', $clientName); } else { - $this->addFlash('danger', implode("\n", $allMessages)); + $this->postMessages($allMessages); return $this->redirectToRoute('jury_problems'); } } catch (Exception $e) { @@ -174,12 +174,7 @@ public function indexAction(Request $request): Response $zip->close(); } } - - foreach (['info', 'warning', 'danger'] as $type) { - if (!empty($allMessages[$type])) { - $this->addFlash($type, implode("\n", $allMessages[$type])); - } - } + $this->postMessages($allMessages); if ($newProblem !== null) { return $this->redirectToRoute('jury_problem', ['probId' => $newProblem->getProbid()]); @@ -561,4 +556,16 @@ protected function getClarificationsHtml(): Response 'problems' => $contestProblems, ]); } + + /** + * @param array $allMessages + */ + private function postMessages(array $allMessages): void + { + foreach (['info', 'warning', 'danger'] as $type) { + if (!empty($allMessages[$type])) { + $this->addFlash($type, implode("\n", $allMessages[$type])); + } + } + } } diff --git a/webapp/src/Controller/Jury/ProblemController.php b/webapp/src/Controller/Jury/ProblemController.php index 5c5c61c84f..65f81d7510 100644 --- a/webapp/src/Controller/Jury/ProblemController.php +++ b/webapp/src/Controller/Jury/ProblemController.php @@ -922,12 +922,7 @@ public function editAction(Request $request, int $probId): Response $zip->close(); } } - - foreach (['info', 'warning', 'danger'] as $type) { - if (!empty($messages[$type])) { - $this->addFlash($type, implode("\n", $messages[$type])); - } - } + $this->postMessages($messages); return $this->redirectToRoute('jury_problem', ['probId' => $problem->getProbid()]); } @@ -1102,4 +1097,16 @@ public function requestRemainingRunsWholeProblemAction(string $probId): Redirect $this->judgeRemaining($judgings); return $this->redirectToRoute('jury_problem', ['probId' => $probId]); } + + /** + * @param array $allMessages + */ + private function postMessages(array $allMessages): void + { + foreach (['info', 'warning', 'danger'] as $type) { + if (!empty($allMessages[$type])) { + $this->addFlash($type, implode("\n", $allMessages[$type])); + } + } + } }