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