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:
@@ -41,6 +41,7 @@ export const issuePageEvents = eventGroup({
|
||||
files?: File[];
|
||||
}>(),
|
||||
watchRequested: type<{ issueId: string; watching: boolean }>(),
|
||||
trashRequested: type<{ issueId: string; trashed: boolean }>(),
|
||||
/** Place the ticket under another one by its key (e.g. WEB-3); null: out. */
|
||||
parentRequested: type<{ issueId: string; parentKey: string | null }>(),
|
||||
subtaskCreateRequested: type<{
|
||||
|
||||
@@ -99,6 +99,13 @@ export class IssueFacade {
|
||||
);
|
||||
}
|
||||
|
||||
/** To the trash (true) or back from it (false). */
|
||||
setTrashed(trashed: boolean): void {
|
||||
this.withIssue((issueId) =>
|
||||
this.dispatch.trashRequested({ issueId, trashed }),
|
||||
);
|
||||
}
|
||||
|
||||
/** Follow the ticket (or stop): be told when it moves or gets a comment. */
|
||||
setWatching(watching: boolean): void {
|
||||
this.withIssue((issueId) =>
|
||||
|
||||
@@ -280,6 +280,22 @@ export const IssueStore = signalStore(
|
||||
),
|
||||
),
|
||||
),
|
||||
events
|
||||
.on(issuePageEvents.trashRequested)
|
||||
.pipe(
|
||||
mergeMap(({ payload }) =>
|
||||
runCommand(
|
||||
payload.trashed
|
||||
? issues.trash(payload.issueId)
|
||||
: issues.restore(payload.issueId),
|
||||
payload.trashed
|
||||
? 'Ticket en la papelera'
|
||||
: 'Ticket recuperado',
|
||||
done,
|
||||
failed,
|
||||
),
|
||||
),
|
||||
),
|
||||
events
|
||||
.on(issuePageEvents.watchRequested)
|
||||
.pipe(
|
||||
|
||||
Reference in New Issue
Block a user