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:
@@ -55,6 +55,9 @@ export class ApiService {
|
||||
setMailboxActive(id: number, active: boolean): Observable<Mailbox> {
|
||||
return this.http.put<Mailbox>(`/api/admin/mailboxes/${id}/active`, { active });
|
||||
}
|
||||
deleteMailbox(id: number): Observable<void> {
|
||||
return this.http.delete<void>(`/api/admin/mailboxes/${id}`);
|
||||
}
|
||||
|
||||
// folders
|
||||
folders(): Observable<Folder[]> { return this.http.get<Folder[]>('/api/folders'); }
|
||||
|
||||
@@ -91,6 +91,9 @@ import { AuthService } from '../../core/auth.service';
|
||||
<button type="button" class="ghost-btn !py-1" (click)="toggle(m)"
|
||||
[attr.aria-label]="(m.active ? 'Switch off ' : 'Switch on ') + m.email">
|
||||
<mat-icon>{{ m.active ? 'toggle_on' : 'toggle_off' }}</mat-icon></button>
|
||||
<button type="button" class="ghost-btn !py-1 hover:text-rose-400" (click)="remove(m)"
|
||||
[attr.aria-label]="'Delete ' + m.email" title="Delete the mailbox with all its mail">
|
||||
<mat-icon>delete</mat-icon></button>
|
||||
}
|
||||
@if (membersOf() === m.id) {
|
||||
<div class="basis-full mt-1 p-2 rounded-lg border border-cyan-500/20">
|
||||
@@ -227,6 +230,14 @@ export class MailboxesSection {
|
||||
});
|
||||
}
|
||||
|
||||
remove(m: Mailbox): void {
|
||||
if (!confirm('Delete ' + m.email + ' with ALL its mail? This can not be undone.')) return;
|
||||
this.api.deleteMailbox(m.id).subscribe({
|
||||
next: () => { this.toasts.ok(m.email + ' deleted'); this.load(); },
|
||||
error: e => this.toasts.error(errorText(e))
|
||||
});
|
||||
}
|
||||
|
||||
copy(text: string): void {
|
||||
navigator.clipboard?.writeText(text).then(() => this.toasts.ok('Copied'), () => this.toasts.error('Copy it by hand'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user