Skip to content
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

Discord Id Check #69

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Conversation

ntxnick
Copy link
Contributor

@ntxnick ntxnick commented Nov 9, 2021

Pre-Requisites

  • Yes, I updated Authors.md OR this is not my first contribution
  • Yes, I included and/or modified tests to cover relevant code OR my change is non-technical
  • Yes, I wrote this code entirely myself OR I properly attributed these changes in Third Party Notices

Description of Changes

Check the database to see if the current user has a discordId attached to their profile. If they are registered display the "Go to Discord" button. If not registered display the "Join Discord" button.

Related Issues

Closes #52
Relies on #74

@ntxnick ntxnick marked this pull request as ready for review November 12, 2021 06:49
Copy link
Contributor

@dre8597 dre8597 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small change and it should be good to ship 👍🏾

packages/web/src/pages/app/community.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@dre8597 dre8597 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more small thing 🤏🏾

Copy link
Contributor

@SpencerKaiser SpencerKaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few quick things and then we can merge

Comment on lines 5 to 7
interface User {
discordId?: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is User not defined anywhere else in the front end?

packages/web/src/components/DiscordCheck/DiscordButton.tsx Outdated Show resolved Hide resolved
packages/web/src/components/DiscordCheck/DiscordButton.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,61 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this, but this directory should have the same name as the file; can you rename the parent DiscordÇheck to match DiscordButton?

@@ -29,7 +29,7 @@ export const UserProfile: React.FC<UserProfileProps> = ({ user, setUser }: UserP
'content-type': 'application/json',
},
body: JSON.stringify({
discordId: undefined,
discordId: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change made? null doesn't match the type above (string in conjunction with ? becomes string | undefined which is not the same as string | null)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was made because I don't think the database knows what undefined was. Unless we change it to null the discord ID is not actually removed from the profile. it just selects the profile but doesn't actually remove the Discord ID.

Comment on lines 6 to 8
interface User {
discordId?: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be using the same type the front end uses; adding our own interface adds no value because if the front end's interface changes, the type safety here won't catch it

@@ -0,0 +1,61 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file name here should match the component exactly; make sure to rename this file and the parent directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add discord Id check to community page
3 participants