Open
Conversation
Deploying finansu with
|
| Latest commit: |
1264d03
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://450e8c0f.finansu.pages.dev |
| Branch Preview URL: | https://feat-add-sangaku-bureau-and.finansu.pages.dev |
There was a problem hiding this comment.
Pull request overview
/users・/yearperiods および協賛関連ページに対して、ユーザー権限(roleID: 2, 3)によるアクセス制御を追加/統一しつつ、ユーザー編集・一覧UI上の表記を「学科」→「局」へ揃えるPRです。
Changes:
/users・/yearperiodsの権限制御を_hasHydrated+useCurrentUserパターンへ統一- 「協賛活動/協賛スタイル/協賛企業」ページに roleID(2,3) のアクセス制御を追加
- ユーザー関連UIの表記を「学科」→「局」へ統一(編集モーダル/一覧)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| view/next-project/src/pages/yearperiods/index.tsx | _hasHydrated を用いた roleID(2,3) ガードとローディング表示を追加 |
| view/next-project/src/pages/users/index.tsx | _hasHydrated を用いた roleID(2,3) ガードへ統一し、表示文言を「局」に変更 |
| view/next-project/src/pages/sponsorstyles/index.tsx | 協賛スタイル一覧に roleID(2,3) のガードとローディング表示を追加 |
| view/next-project/src/pages/sponsors/index.tsx | 協賛企業一覧に roleID(2,3) のガードとローディング表示を追加 |
| view/next-project/src/pages/sponsor-activities/index.tsx | 協賛活動ページに roleID(2,3) のガードとローディング表示を追加 |
| view/next-project/src/components/users/EditModal.tsx | 編集モーダルの表記を「局」に変更し、コンポーネント名を更新 |
Comment on lines
43
to
+49
| useEffect(() => { | ||
| setCurrentUser(user); | ||
| }, [user]); | ||
| if (!_hasHydrated) return; | ||
| if (!user?.roleID) return; | ||
| if (user.roleID !== 2 && user.roleID !== 3) { | ||
| router.push('/my_page'); | ||
| } | ||
| }, [_hasHydrated, user?.roleID, router]); |
Comment on lines
+87
to
+93
| useEffect(() => { | ||
| if (!_hasHydrated) return; | ||
| if (!user?.roleID) return; | ||
| if (user.roleID !== 2 && user.roleID !== 3) { | ||
| router.push('/my_page'); | ||
| } | ||
| }, [_hasHydrated, user?.roleID, router]); |
各ページの useEffect 内で、未認証(user.roleID が falsy)の場合に早期リターンするのではなく、適切に `/` へリダイレクトする処理を追加。
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
対応Issue
概要
/usersページのユーザ編集モーダルで「産学局」を選択できるように対応(DB側に登録済みのためフロント側はラベル修正と既存パターンに準じた実装)/usersページと/yearperiodsページの権限制御を_hasHydrated+useCurrentUserパターンに統一し、コードを簡潔化画面スクリーンショット等
テスト項目
/usersページの編集モーダルで「産学局」が選択肢に表示されること/my_pageにリダイレクトされること(アクセスできないとこにリダイレクトしてたので)/usersページと/yearperiodsページでも同様に権限制御が機能すること備考
EditModal.tsxのコンポーネント名をFundInformationEditModalからUserEditModalに修正