(subscriptionButton: HTMLButtonElement)
| 54 | } |
| 55 | |
| 56 | function addLegacyButton(subscriptionButton: HTMLButtonElement): void { |
| 57 | const status = getLegacyStatus(subscriptionButton); |
| 58 | // Save first |
| 59 | const originalId = subscriptionButton.form!.elements.id; |
| 60 | |
| 61 | subscriptionButton.after( |
| 62 | <div className="rgh-status-subscription BtnGroup d-flex width-full"> |
| 63 | {tooltipped( |
| 64 | {label: 'Unsubscribe', direction: 'sw'}, |
| 65 | <Button value="unsubscribe" {...(status === 'none' && disableAttributes)}> |
| 66 | <BellSlashIcon /> None |
| 67 | </Button>, |
| 68 | )} |
| 69 | {tooltipped( |
| 70 | {label: 'Subscribe to all events', direction: 'sw'}, |
| 71 | <Button value="subscribe" {...(status === 'all' && disableAttributes)}> |
| 72 | <BellIcon /> All |
| 73 | </Button>, |
| 74 | )} |
| 75 | {tooltipped( |
| 76 | {label: multilineAriaLabel('Subscribe just to status changes', '(closing, reopening, merging)'), direction: 'sw'}, |
| 77 | <Button value="subscribe_to_custom_notifications" {...(status === 'status' && disableAttributes)}> |
| 78 | <IssueReopenedIcon /> Status |
| 79 | </Button>, |
| 80 | )} |
| 81 | </div>, |
| 82 | // Always submitted, but ignored unless the value is `subscribe_to_custom_notifications` |
| 83 | // Keep outside BtnGroup |
| 84 | <input type="hidden" name="events[]" value="merged" />, |
| 85 | <input type="hidden" name="events[]" value="closed" />, |
| 86 | <input type="hidden" name="events[]" value="reopened" />, |
| 87 | ); |
| 88 | |
| 89 | // Remove it only if the form was successfully added |
| 90 | originalId.remove(); |
| 91 | subscriptionButton.hidden = true; |
| 92 | |
| 93 | // 'all' can have many reasons, but the other two don't add further information #6684 |
| 94 | if (status !== 'all') { |
| 95 | getLegacyReason(subscriptionButton).hidden = true; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | const githubApiBaseHeaders = new Headers({ |
| 100 | accept: 'application/json', |
nothing calls this directly
no test coverage detected