(
collection: string,
slug: string,
noteData: Omit<Note, 'id'>,
entryTitle?: string,
)
| 787 | } |
| 788 | |
| 789 | async addNote( |
| 790 | collection: string, |
| 791 | slug: string, |
| 792 | noteData: Omit<Note, 'id'>, |
| 793 | entryTitle?: string, |
| 794 | ): Promise<Note> { |
| 795 | const currentUser = await this.currentUser({ token: this.token! }); |
| 796 | const identity = await this.noteAuthorIdentity(); |
| 797 | |
| 798 | const note: Note = { |
| 799 | ...noteData, |
| 800 | id: 'temp-' + Date.now(), |
| 801 | author: identity.author, |
| 802 | authorId: identity.authorId, |
| 803 | isOwn: true, |
| 804 | avatarUrl: currentUser.avatar_url, |
| 805 | entrySlug: slug, |
| 806 | timestamp: noteData.timestamp || new Date().toISOString(), |
| 807 | resolved: noteData.resolved || false, |
| 808 | issueUrl: undefined, |
| 809 | }; |
| 810 | |
| 811 | const { commentId, issueUrl } = await this.api!.addNoteToEntry( |
| 812 | collection, |
| 813 | slug, |
| 814 | note, |
| 815 | entryTitle, |
| 816 | ); |
| 817 | |
| 818 | return { |
| 819 | ...note, |
| 820 | id: commentId, |
| 821 | issueUrl, |
| 822 | }; |
| 823 | } |
| 824 | |
| 825 | async updateNote( |
| 826 | collection: string, |
no test coverage detected