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

Function updateSubscription

source/features/status-subscription.tsx:126–145  ·  view source on GitHub ↗
(targetStatus: SubscriptionStatus, id: string)

Source from the content-addressed store, hash-verified

124}
125
126async function updateSubscription(targetStatus: SubscriptionStatus, id: string): Promise<void> {
127 const response = await fetch('/_graphql', {
128 headers: githubApiBaseHeaders,
129 method: 'POST',
130 body: JSON.stringify({
131 // `updateIssueSubscriptionMutation`
132 query: 'd0752b2e49295017f67c84f21bfe41a3',
133 variables: {
134 input: {
135 events: targetStatus === 'status' ? ['CLOSED', 'REOPENED'] : [],
136 state: targetStatus === 'status' ? 'CUSTOM' : targetStatus === 'all' ? 'SUBSCRIBED' : 'UNSUBSCRIBED',
137 subscribableId: id,
138 },
139 },
140 }),
141 });
142 if (!response.ok) {
143 throw new Error('Failed to update the issue subscription status');
144 }
145}
146
147async function addButton(subscriptionButton: HTMLButtonElement): Promise<void> {
148 const previousRghButton = $optional('.rgh-status-subscription', subscriptionButton.parentElement!);

Callers 1

getOnClickFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected