-
Notifications
You must be signed in to change notification settings - Fork 186
fix-1392-Inconsistency-in-User-Verification-Status #2112
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
base: main
Are you sure you want to change the base?
Changes from all commits
6da4bf8
4afc0e0
10b60f1
daa59f1
07632bd
3f73161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,12 @@ | |
.forProject(page.params.region, page.params.project) | ||
.users.updateEmailVerification($user.$id, !$user.emailVerification); | ||
await invalidate(Dependencies.USER); | ||
|
||
addNotification({ | ||
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${ | ||
!$user.emailVerification ? 'unverified' : 'verified' | ||
message: `${ | ||
$user.name && $user.name.trim() !== '' | ||
? `The email for ${$user.name} ${!$user.emailVerification ? 'is no longer verified' : 'has been verified'}` | ||
: `The email ${!$user.emailVerification ? 'is no longer verified' : 'has been verified'}` | ||
}`, | ||
type: 'success' | ||
}); | ||
|
@@ -44,9 +47,12 @@ | |
.forProject(page.params.region, page.params.project) | ||
.users.updatePhoneVerification($user.$id, !$user.phoneVerification); | ||
await invalidate(Dependencies.USER); | ||
|
||
addNotification({ | ||
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${ | ||
$user.phoneVerification ? 'unverified' : 'verified' | ||
message: `${ | ||
$user.name && $user.name.trim() !== '' | ||
? `The phone for ${$user.name} ${!$user.phoneVerification ? 'is no longer verified' : 'has been verified'}` | ||
: `The phone ${!$user.phoneVerification ? 'is no longer verified' : 'has been verified'}` | ||
}`, | ||
Comment on lines
+52
to
56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainMirror the same robustness for phone verification messages. Use a stable Apply this diff: - message: `${
- $user.name && $user.name.trim() !== ''
- ? `The phone for ${$user.name} ${!$user.phoneVerification ? 'is no longer verified' : 'has been verified'}`
- : `The phone ${!$user.phoneVerification ? 'is no longer verified' : 'has been verified'}`
- }`,
+ message: `${displayName ? `The phone for ${displayName}` : 'The phone'} ${nextPhone ? 'has been verified' : 'is no longer verified'}`, Add these lines inside const nextPhone = !$user.phoneVerification;
const displayName = $user.name?.trim() || '';
await sdk.forProject(page.params.region, page.params.project).users.updatePhoneVerification($user.$id, nextPhone); 🏁 Script executed: #!/bin/bash
# Locate updateStatus.svelte
file=$(fd updateStatus.svelte -t f)
echo "File found: $file"
# Show context around the message snippet
rg -nC3 'message:' "$file"
# Search for updateVerificationPhone usage
rg -nC2 'updateVerificationPhone' "$file"
# Search for displayName and nextPhone declarations
rg -nE 'displayName|nextPhone' -nC2 "$file" Length of output: 3264 🏁 Script executed: #!/bin/bash
# Target the auth user updateStatus.svelte file
file=$(fd -e svelte updateStatus.svelte | grep 'auth/user' | head -n1)
echo "Using file: $file"
# Show the message block context
rg -nC3 'message:' "$file"
# Locate updateVerificationPhone function definition and calls
rg -nC3 'updateVerificationPhone' "$file"
# Check for existing displayName or nextPhone variables
rg -nC3 'displayName' "$file"
rg -nC3 'nextPhone' "$file" Length of output: 4017 🏁 Script executed: #!/bin/bash
# Find the auth user updateStatus.svelte file
file=$(fd -e svelte updateStatus.svelte | grep 'auth/user' | head -n1)
echo "Inspecting: $file"
# Print the first 200 lines to view updateVerificationPhone and related context
sed -n '1,200p' "$file" Length of output: 8576 Use local const nextPhone = !$user.phoneVerification;
const displayName = $user.name?.trim() || ''; – Replace the SDK call to use - await sdk
- .forProject(page.params.region, page.params.project)
- .users.updatePhoneVerification($user.$id, !$user.phoneVerification);
+ await sdk
+ .forProject(page.params.region, page.params.project)
+ .users.updatePhoneVerification($user.$id, nextPhone); – Update the success notification to: addNotification({
message: `${displayName ? `The phone for ${displayName}` : 'The phone'} ${nextPhone ? 'has been verified' : 'is no longer verified'}`,
type: 'success'
}); This ensures the message and API call consistently use the intended new verification state. 🤖 Prompt for AI Agents
|
||
type: 'success' | ||
}); | ||
|
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.
💡 Verification agent
🧩 Analysis chain
Stabilize message against timing/race; base it on the intended new state, not the reactive store.
Right after invalidate(),
$user
may still momentarily reflect the previous value. Build the message from a localnextEmail
computed before/with the API call to avoid inverted alerts.Apply this diff to simplify and de-duplicate the string logic:
Add these lines inside
updateVerificationEmail()
(outside the changed hunk) to define and use stable values:Optionally confirm copy choice: do we prefer “is no longer verified” or “has been unverified” for consistency with button text?
🏁 Script executed:
Length of output: 1076
🏁 Script executed:
Length of output: 8976
Stabilize and simplify the success message in updateVerificationEmail by computing
nextEmail
anddisplayName
before the API call and using them inaddNotification
; apply the same pattern toupdateVerificationPhone
.Apply an equivalent change in
updateVerificationPhone()
usingconst nextPhone = !$user.phoneVerification
anddisplayName
before its API call.📝 Committable suggestion
🤖 Prompt for AI Agents