feat: a trash for tickets
Deleting a ticket now sends it to the trash, for whoever opened it or an admin: it disappears from boards, searches and statistics, cannot change, and comes back from the ticket page or the trash page for 30 days. After that it is deleted for good with the usual cascade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,20 @@ const MAX_FILE_BYTES = 25 * 1024 * 1024;
|
||||
<a class="ts-back" routerLink="../../board">← Tablero</a>
|
||||
|
||||
@if (facade.issue(); as issue) {
|
||||
@if (issue.trashedAt) {
|
||||
<div class="ts-trashed" role="status">
|
||||
En la papelera desde {{ ago(issue.trashedAt) }}: no aparece en el
|
||||
tablero ni en las búsquedas, y se borrará del todo a los 30 días.
|
||||
@if (canTrash(issue)) {
|
||||
<pi-action-button
|
||||
size="small"
|
||||
color="primary"
|
||||
text="Recuperar"
|
||||
(execute)="facade.setTrashed(false)"
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<div class="ts-issue">
|
||||
<section class="ts-issue__main">
|
||||
<header class="ts-issue__header">
|
||||
@@ -698,6 +712,15 @@ const MAX_FILE_BYTES = 25 * 1024 * 1024;
|
||||
<pi-label>Área</pi-label>
|
||||
</pi-select-field>
|
||||
|
||||
@if (!issue.trashedAt && canTrash(issue)) {
|
||||
<pi-action-button
|
||||
size="small"
|
||||
color="grey"
|
||||
appearance="ghost"
|
||||
text="Mover a la papelera"
|
||||
(execute)="trash()"
|
||||
/>
|
||||
}
|
||||
<dl class="ts-facts">
|
||||
<dt>Reportado por</dt>
|
||||
<dd>{{ issue.reporter.name }}</dd>
|
||||
@@ -1122,6 +1145,23 @@ export class IssuePage {
|
||||
}
|
||||
|
||||
/** A screenshot pasted anywhere on the ticket is attached to it. */
|
||||
/** Whoever opened it, or whoever manages the project. */
|
||||
protected canTrash(issue: { reporter: { id: string } }): boolean {
|
||||
return (
|
||||
this.project.canContribute() &&
|
||||
(issue.reporter.id === this.facade.me() || this.project.canManage())
|
||||
);
|
||||
}
|
||||
|
||||
protected trash(): void {
|
||||
if (
|
||||
confirm(
|
||||
'¿Mover el ticket a la papelera? Podrás recuperarlo durante 30 días.',
|
||||
)
|
||||
)
|
||||
this.facade.setTrashed(true);
|
||||
}
|
||||
|
||||
/** `e`: edit the ticket (not while typing, nor with a drawer open). */
|
||||
@HostListener('document:keydown', ['$event'])
|
||||
protected onKey(event: KeyboardEvent): void {
|
||||
|
||||
Reference in New Issue
Block a user