Mark appeals as sent when successfully submitted and processed, ensuring accurate tracking and status updates.

This commit is contained in:
2025-08-24 02:39:47 +02:00
parent fe545972e3
commit c75f0cdb15
3 changed files with 41 additions and 6 deletions
@@ -48,6 +48,7 @@ public class AppealController implements AppealsApi {
@RateLimit(limit = 3, timeValue = 1, timeUnit = TimeUnit.HOURS, key = "minecraftAppeal")
@Override
public ResponseEntity<AppealResponseDto> submitMinecraftAppeal(MinecraftAppealDto minecraftAppealDto) {
boolean success = true;
CompletableFuture<Appeal> appealCompletableFuture = new CompletableFuture<>();
Connection.getConnection(Databases.DEFAULT)
@@ -72,6 +73,7 @@ public class AppealController implements AppealsApi {
appealDiscord.sendAppealToDiscord(appeal, history);
} catch (Exception e) {
log.error("Failed to send appeal {} to Discord", appeal.id(), e);
success = false;
}
appealMail.sendAppealNotification(appeal, history);
@@ -94,6 +96,15 @@ public class AppealController implements AppealsApi {
if (!emailVerification.verified()) {
return ResponseEntity.badRequest().build();
}
if (!success) {
return ResponseEntity.internalServerError().build();
}
Connection.getConnection(Databases.DEFAULT)
.runQuery(sqlSession -> {
log.debug("Marking appeal {} as sent", appeal.id());
sqlSession.getMapper(AppealMapper.class)
.markAppealAsSent(appeal.id());
});
AppealResponseDto appealResponseDto = new AppealResponseDto(
appeal.id().toString(),
"Your appeal has been submitted. You will be notified when it has been reviewed.",