MCPcopy Index your code
hub / github.com/refined-github/refined-github / addLegacyButton

Function addLegacyButton

source/features/status-subscription.tsx:56–97  ·  view source on GitHub ↗
(subscriptionButton: HTMLButtonElement)

Source from the content-addressed store, hash-verified

54}
55
56function 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
99const githubApiBaseHeaders = new Headers({
100 accept: 'application/json',

Callers

nothing calls this directly

Calls 5

getLegacyStatusFunction · 0.85
tooltippedFunction · 0.85
multilineAriaLabelFunction · 0.85
getLegacyReasonFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected