Skip to content

Commit

Permalink
Merge pull request #144 from osu-tournament-rating/hotfix/me-controll…
Browse files Browse the repository at this point in the history
…er-refactor

Refactor 'roles' to 'scopes'
  • Loading branch information
hburn7 authored Mar 27, 2024
2 parents 36e231a + a8883a6 commit ed4f877
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function getSession(onlyData: boolean = false) {
osuPlayMode: session?.osuPlayMode,
osuPlayModeSelected: session?.osuPlayModeSelected,
username: session?.username,
roles: session?.roles,
scopes: session?.scopes,
accessToken: session?.accessToken,
};

Expand Down Expand Up @@ -81,7 +81,7 @@ export async function login(cookie: {
session.osuPlayMode = loggedUser.osuPlayMode;
session.osuPlayModeSelected = loggedUser.osuPlayMode;
session.username = loggedUser.username;
session.roles = loggedUser.roles;
session.scopes = loggedUser.scopes;
session.isLogged = true;

await session.save();
Expand Down
4 changes: 2 additions & 2 deletions app/submit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export const metadata: Metadata = {
};

export default async function page() {
const { roles } = await getSession(true);
const { scopes } = await getSession(true);

return (
<main className={styles.pageContainer}>
<Guidelines />
<MatchForm userRoles={roles} />
<MatchForm userScopes={scopes} />
</main>
);
}
4 changes: 2 additions & 2 deletions components/SubmitMatches/MatchForm/MatchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function SubmitButton() {
);
}

export default function MatchForm({ userRoles }: { userRoles: Array<string> }) {
export default function MatchForm({ userScopes }: { userScopes: Array<string> }) {
const [state, formAction] = useFormState(saveTournamentMatches, initialState);

const [rulesAccepted, setRulesAccepted] = useState(false);
Expand Down Expand Up @@ -249,7 +249,7 @@ export default function MatchForm({ userRoles }: { userRoles: Array<string> }) {
matches can lead to a restriction
</span>
</div>
{(userRoles.includes('verifier')) && (
{(userScopes.includes('verifier')) && (
<div className={clsx(styles.row, styles.checkbox)}>
<input
type="checkbox"
Expand Down
2 changes: 1 addition & 1 deletion lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface SessionUser {
osuPlayMode?: number;
osuPlayModeSelected?: number;
username?: string;
roles?: [string];
scopes?: [string];
accessToken?: string;
refreshToken?: string;
isLogged: boolean;
Expand Down

0 comments on commit ed4f877

Please sign in to comment.