-
Notifications
You must be signed in to change notification settings - Fork 236
imprv: The delete button on the user home page is now hidden for unauthorized users. #9915
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
Conversation
|
apps/app/src/client/components/Common/Dropdown/PageItemControl.tsx
Outdated
Show resolved
Hide resolved
apps/app/src/client/components/Common/Dropdown/PageItemControl.tsx
Outdated
Show resolved
Hide resolved
apps/app/src/client/components/Common/Dropdown/PageItemControl.tsx
Outdated
Show resolved
Hide resolved
This reverts commit a5f6584.
This reverts commit af4c526.
|
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks:
You can check the last failing draft PR here: #9958. You may have to fix your CI before adding the pull request to the queue again. |
miya
left a comment
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.
.
|
This pull request has been removed from the queue for the following reason: Pull request #9915 has been dequeued. The pull request rule doesn't match anymore. The following conditions don't match anymore:
You can check the last failing draft PR here: #9995. You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. |
| } | ||
|
|
||
| return true; | ||
| }, [isGuestUser, isUsersHomepage, isUsersHomepageDeletionEnabled]); |
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.
currentPagePath が取得できていない (null) 場合を考慮してください
以下 AI の説明
currentPagePath が取得できていない場合(=値が undefined や null の場合)、このコードでは以下のように記述されています:
const isUsersHomepage = pagePathUtils.isUsersHomepage(currentPagePath ?? '');ここで currentPagePath ?? '' となっているため、currentPagePath が「null または undefined の場合」は空文字列 '' が pagePathUtils.isUsersHomepage に渡されます。
どうなるか?
pagePathUtils.isUsersHomepage('')の返り値がどうなるか次第です。- 一般的に「ユーザーのホームページかどうか」を判定する関数なら、空文字列は「ユーザーのホームページではない」と判定され、
falseを返す設計が多いです。
結果として
currentPagePathが取得できていない場合、isUsersHomepageはたいていfalseになる。isEnableActionsの値は- ゲストユーザーなら
false - それ以外は
true(isUsersHomepageがfalseなので2番目の if に入らないため)
- ゲストユーザーなら
要約
currentPagePath が取得できていない場合は「ユーザーのホームページではない」とみなされ、isEnableActions の判定にも特に悪影響はありません(通常どおりの権限判定になります)。
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.
currentPagePath はなにか、を本質的に考えないといけない
currentPagePath が取得できないということは、システムグローバルに「今何のページを表示しているのか」を特定できていないということだ。
現状のコードでは、今何のページを表示しているのかを特定できないにも関わらず、isEnableActions は true となり、PageItemControl の各種ドロップダウンアイテムを表示して良い、という挙動になる。
つまり、「何のページかわからんけど削除メニュー表示しとくね」という挙動が有り得ることになる。
修正案
currentPagePath が取得できていない場合は isEnableActions を false にする
| } | ||
|
|
||
| return true; | ||
| }, [isGuestUser, isUsersHomepage, isUsersHomepageDeletionEnabled]); |
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.
currentPagePath はなにか、を本質的に考えないといけない
currentPagePath が取得できないということは、システムグローバルに「今何のページを表示しているのか」を特定できていないということだ。
現状のコードでは、今何のページを表示しているのかを特定できないにも関わらず、isEnableActions は true となり、PageItemControl の各種ドロップダウンアイテムを表示して良い、という挙動になる。
つまり、「何のページかわからんけど削除メニュー表示しとくね」という挙動が有り得ることになる。
修正案
currentPagePath が取得できていない場合は isEnableActions を false にする
|
@mergify queue |
🛑 The pull request has been removed from the queue
|
|
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks:
You can check the last failing draft PR here: #10016. You may have to fix your CI before adding the pull request to the queue again. |
|
@mergify requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
|
@mergify queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at 2d4369b |
修正内容
削除メニューアイテムが表示されないようにした。
task
https://redmine.weseek.co.jp/issues/165282