@@ -790,9 +790,6 @@ public class FileEntityHandler implements RequestHandler {
|
||||
fileMap.put("fileName", file.getOriginalFileName());
|
||||
fileMap.put("userId", file.getUserId());
|
||||
fileMap.put("status", file.getStatus() != null ? file.getStatus().name() : null);
|
||||
fileMap.put("createdAt", file.getCreatedAt());
|
||||
fileMap.put("fileSize", file.getFileSize());
|
||||
fileMap.put("formattedSize", fileEntityService.formatFileSize(file.getFileSize()));
|
||||
|
||||
Map<String, Object> moderationInfoMap = new HashMap<>();
|
||||
moderationInfoMap.put("hasActiveAppeal", info != null && info.getHasActiveAppeal());
|
||||
|
||||
@@ -60,6 +60,7 @@ public class ModerationService {
|
||||
.moderationReasonId(request.getModerationReasonId())
|
||||
.comment(request.getComment())
|
||||
.build();
|
||||
|
||||
moderationLogRepository.save(log);
|
||||
|
||||
file.setStatus(request.getNewStatus());
|
||||
@@ -91,7 +92,7 @@ public class ModerationService {
|
||||
throw new SecurityException("User is not the owner of this file");
|
||||
}
|
||||
|
||||
if (!canAppeal(file)) {
|
||||
if (canAppeal(file)) {
|
||||
throw new InvalidAppealException("Cannot appeal this file. Current status: " + file.getStatus());
|
||||
}
|
||||
|
||||
@@ -156,11 +157,7 @@ public class ModerationService {
|
||||
* Проверка, можно ли подать апелляцию на файл
|
||||
*/
|
||||
public boolean canAppeal(FileEntity file) {
|
||||
if (file.getStatus() != FileStatus.BLOCKED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return file.getStatus() == FileStatus.BLOCKED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user