Settings → MAILBOXES: удалить ящик вместе с письмами
continuous-integration/drone/pr Build is passing
continuous-integration/drone/pr Build is passing
DELETE /api/admin/mailboxes/{id} (только администратор, не свой ящик):
файлы вложений, затем строка users — папки, письма, исходники, контакты,
участие в рассылках и доступы уходят каскадом. Кнопка с подтверждением.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -401,6 +401,16 @@ public class MailService {
|
||||
.then(messageRepository.delete(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mailbox deleted for good: attachment files first, then the user row — folders, messages, sources, contacts,
|
||||
* list memberships and access rows go with it (ON DELETE CASCADE).
|
||||
*/
|
||||
public Mono<Void> deleteMailbox(User user) {
|
||||
return attachmentRepository.findByMailbox(user.getId())
|
||||
.doOnNext(attachment -> deleteFile(attachment.getFilePath()))
|
||||
.then(userRepository.delete(user));
|
||||
}
|
||||
|
||||
private static void deleteFile(String path) {
|
||||
try {
|
||||
Files.deleteIfExists(Paths.get(path));
|
||||
|
||||
Reference in New Issue
Block a user