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