This commit is contained in:
2026-05-24 09:27:01 +02:00
parent e946436a42
commit 14156a23fb
9 changed files with 154 additions and 150 deletions
@@ -39,14 +39,14 @@ export class IssueComments {
});
}
protected addComment(): void {
protected async addComment(): Promise<void> {
const text = this.newCommentText.trim();
if (!text) return;
const issue = this.issuesStore.getById(this.issueId());
if (!issue) return;
const nextId = Math.max(0, ...issue.comments.map((c) => c.id)) + 1;
const comment: IssueComment = { id: nextId, text, createdAt: new Date().toISOString(), updatedAt: null };
this.issuesStore.upsert({ ...issue, comments: [...issue.comments, comment] });
await this.issuesStore.upsert({ ...issue, comments: [...issue.comments, comment] });
this.newCommentText = '';
}
@@ -55,7 +55,7 @@ export class IssueComments {
this.editingCommentText = comment.text;
}
protected saveEditComment(): void {
protected async saveEditComment(): Promise<void> {
const text = this.editingCommentText.trim();
if (!text || this.editingCommentId === null) return;
const issue = this.issuesStore.getById(this.issueId());
@@ -63,7 +63,7 @@ export class IssueComments {
const updatedComments = issue.comments.map((c) =>
c.id === this.editingCommentId ? { ...c, text, updatedAt: new Date().toISOString() } : c,
);
this.issuesStore.upsert({ ...issue, comments: updatedComments });
await this.issuesStore.upsert({ ...issue, comments: updatedComments });
this.editingCommentId = null;
this.editingCommentText = '';
}
@@ -73,9 +73,9 @@ export class IssueComments {
this.editingCommentText = '';
}
protected deleteComment(id: number): void {
protected async deleteComment(id: number): Promise<void> {
const issue = this.issuesStore.getById(this.issueId());
if (!issue) return;
this.issuesStore.upsert({ ...issue, comments: issue.comments.filter((c) => c.id !== id) });
await this.issuesStore.upsert({ ...issue, comments: issue.comments.filter((c) => c.id !== id) });
}
}