* Reopen the notes issue when an entry is unpublished
(collectionName: string, slug: string)
| 1831 | * Reopen the notes issue when an entry is unpublished |
| 1832 | */ |
| 1833 | async reopenIssueOnUnpublish(collectionName: string, slug: string): Promise<void> { |
| 1834 | try { |
| 1835 | const issue = await this.findNotesIssue(collectionName, slug, 'all'); |
| 1836 | if (issue) { |
| 1837 | // Remove 'entry-published' or 'entry-deleted' labels and reopen |
| 1838 | const updatedLabels = (issue.labels || []) |
| 1839 | .map((l: { name: string }) => l.name) |
| 1840 | .filter((name: string) => name !== 'entry-published' && name !== 'entry-deleted'); |
| 1841 | |
| 1842 | await this.request(`${this.repoURL}/issues/${issue.number}`, { |
| 1843 | method: 'PATCH', |
| 1844 | body: JSON.stringify({ |
| 1845 | state: 'open', |
| 1846 | labels: updatedLabels, |
| 1847 | }), |
| 1848 | }); |
| 1849 | } |
| 1850 | } catch (error) { |
| 1851 | console.warn('Failed to reopen notes issue on unpublish:', error); |
| 1852 | } |
| 1853 | } |
| 1854 | |
| 1855 | /** |
| 1856 | * Get all notes for an entry |
no test coverage detected