-
Notifications
You must be signed in to change notification settings - Fork 253
feat(billing): ask for a GitHub reconnect when program membership cannot be verified #3185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lohanidamodar
wants to merge
5
commits into
main
Choose a base branch
from
feat-program-membership-reconnect-github
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9eca606
feat(billing): ask for a GitHub reconnect when membership cannot be v…
lohanidamodar fef0e24
fix(billing): keep the program membership alerts in sync both ways
lohanidamodar 393f8de
fix(billing): sync the membership banners outside the organization-id…
lohanidamodar 124d5eb
fix(billing): raise readOnly when the membership restriction is detected
lohanidamodar 733ecc4
fix(billing): re-run the usage check when membership state changes
lohanidamodar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/routes/(console)/organization-[organization]/programMembershipAlert.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| <script lang="ts"> | ||
| import { page } from '$app/state'; | ||
| import { Click, trackEvent } from '$lib/actions/analytics'; | ||
| import { Button } from '$lib/elements/forms'; | ||
| import { reconnectGithubIdentity } from '$lib/helpers/github'; | ||
| import { HeaderAlert } from '$lib/layout'; | ||
| import { | ||
| getChangePlanUrl, | ||
| getProgramMembershipUnverifiedSince, | ||
| hideBillingHeaderRoutes, | ||
| programMembershipInvalid, | ||
| programMembershipUnverified, | ||
| teamStatusReadonly | ||
| } from '$lib/stores/billing'; | ||
| import { organization } from '$lib/stores/organization'; | ||
|
|
||
| const isRestricted = $derived($organization?.status === teamStatusReadonly); | ||
|
|
||
| // GitHub confirmed the account is no longer a student, so reconnecting can't help. | ||
| const isInvalid = $derived(isRestricted && $organization?.remarks === programMembershipInvalid); | ||
| const isUnverified = $derived( | ||
| isRestricted && $organization?.remarks === programMembershipUnverified | ||
| ); | ||
| const isWarning = $derived( | ||
| !isRestricted && !!getProgramMembershipUnverifiedSince($organization) | ||
| ); | ||
|
|
||
| const show = $derived( | ||
| !!$organization?.$id && | ||
| !hideBillingHeaderRoutes.includes(page.url.pathname) && | ||
| (isInvalid || isUnverified || isWarning) | ||
| ); | ||
|
|
||
| function onReconnect() { | ||
| trackEvent(Click.OrganizationProgramMembershipReconnect, { | ||
| source: isWarning ? 'program_membership_warning' : 'program_membership_restricted' | ||
| }); | ||
| reconnectGithubIdentity(); | ||
| } | ||
| </script> | ||
|
|
||
| {#if show} | ||
| {#if isInvalid} | ||
| <HeaderAlert type="error" title="Access restricted"> | ||
| GitHub is no longer confirming student status for <b>{$organization.name}</b>, so this | ||
| organization is no longer eligible for the Appwrite Education Program and its access to | ||
| resources has been restricted. Choose a plan to restore access. | ||
| <svelte:fragment slot="buttons"> | ||
| <Button secondary fullWidthMobile href={getChangePlanUrl($organization.$id)}> | ||
| <span class="text">View plans</span> | ||
| </Button> | ||
| </svelte:fragment> | ||
| </HeaderAlert> | ||
| {:else if isUnverified} | ||
| <HeaderAlert type="error" title="Access restricted"> | ||
| We couldn’t verify the Appwrite Education Program membership for <b | ||
| >{$organization.name}</b> | ||
| because its GitHub connection expired or was disconnected, so access to resources has been | ||
| restricted. Reconnect GitHub to restore access. | ||
| <svelte:fragment slot="buttons"> | ||
| <Button secondary fullWidthMobile on:click={onReconnect}> | ||
| <span class="text">Reconnect GitHub</span> | ||
| </Button> | ||
| </svelte:fragment> | ||
| </HeaderAlert> | ||
| {:else} | ||
| <HeaderAlert type="warning" title="Reconnect GitHub to keep your education plan"> | ||
| We can’t verify the Appwrite Education Program membership for <b | ||
| >{$organization.name}</b> | ||
| because its GitHub connection expired or was disconnected. Reconnect GitHub to keep this organization | ||
| on its current plan — if the connection isn’t restored, access to resources will be restricted. | ||
| <svelte:fragment slot="buttons"> | ||
| <Button secondary fullWidthMobile on:click={onReconnect}> | ||
| <span class="text">Reconnect GitHub</span> | ||
| </Button> | ||
| </svelte:fragment> | ||
| </HeaderAlert> | ||
| {/if} | ||
| {/if} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the selected organization is reverified or transitions between warning and restricted states without changing its ID, the layout skips
checkForUsageLimit, so theseupdateShowcalls never receive the new state. The obsolete entry remains active in the priority store, suppressing lower-priority banners or continuing to show the warning instead of the access-restricted banner.Knowledge Base Used: Console application shell
Prompt To Fix With AI