* Get all notes for an entry
(collectionName: string, slug: string)
| 1856 | * Get all notes for an entry |
| 1857 | */ |
| 1858 | async getEntryNotes(collectionName: string, slug: string): Promise<Note[]> { |
| 1859 | try { |
| 1860 | const issue = await this.findEntryIssue(collectionName, slug); |
| 1861 | if (!issue) { |
| 1862 | return []; // No issue means no notes yet |
| 1863 | } |
| 1864 | const comments = await this.getIssueComments(issue.number); |
| 1865 | const issueUrl = issue.html_url; // Get the issue URL once |
| 1866 | |
| 1867 | // Add issueUrl to each note (this info is picked up by the UI to direct users to the source of the Notes in Github) |
| 1868 | return commentsToNotes(comments, issueUrl, comment => this.parseCommentToNote(comment)); |
| 1869 | } catch (error) { |
| 1870 | console.error('Failed to get entry notes:', error); |
| 1871 | return []; |
| 1872 | } |
| 1873 | } |
| 1874 | |
| 1875 | /** |
| 1876 | * Add a note to any entry |
no test coverage detected