diff --git a/webapp/src/Controller/Jury/SubmissionController.php b/webapp/src/Controller/Jury/SubmissionController.php
index 46016b4971..fa7060d618 100644
--- a/webapp/src/Controller/Jury/SubmissionController.php
+++ b/webapp/src/Controller/Jury/SubmissionController.php
@@ -748,6 +748,10 @@ public function teamOutputAction(Submission $submission, Contest $contest, Judgi
return Utils::streamAsBinaryFile($outputRun, $filename);
}
+ private function allowEdit(): bool {
+ return $this->dj->getUser()->getTeam() && $this->dj->checkrole('team');
+ }
+
/**
* @throws NonUniqueResultException
*/
@@ -865,13 +869,14 @@ public function sourceAction(
'originalSubmission' => $originalSubmission,
'originalFiles' => $originalFiles,
'originalFileStats' => $originalFileStats,
+ 'allowEdit' => $this->allowEdit(),
]);
}
#[Route(path: '/{submission}/edit-source', name: 'jury_submission_edit_source')]
public function editSourceAction(Request $request, Submission $submission, #[MapQueryParameter] ?int $rank = null): Response
{
- if (!$this->dj->getUser()->getTeam() || !$this->dj->checkrole('team')) {
+ if (!$this->allowEdit()) {
$this->addFlash('danger', 'You cannot re-submit code without being a team.');
return $this->redirectToLocalReferrer($this->router, $request, $this->generateUrl(
'jury_submission',
diff --git a/webapp/templates/jury/submission_source.html.twig b/webapp/templates/jury/submission_source.html.twig
index 0235a6c41a..a19a083265 100644
--- a/webapp/templates/jury/submission_source.html.twig
+++ b/webapp/templates/jury/submission_source.html.twig
@@ -62,10 +62,12 @@
href="{{ path('jury_submission_source', {submission: submission.submitid, fetch: file.rank}) }}">
Download
-
- Edit
-
+ {% if allowEdit %}
+
+ Edit
+
+ {% endif %}
{{ file.sourcecode | codeEditor(file.rank, submission.language.aceLanguage) }}