[WEB-2713] fix: guest user intake issue edit validation#5898
[WEB-2713] fix: guest user intake issue edit validation#5898
Conversation
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
web/core/components/inbox/content/root.tsx (1)
67-67: Consider adding null safety checks.The nested property access
inboxIssue?.issue?.created_bycould be made more robust with optional chaining. Also, consider adding null guards for consistent behavior.- inboxIssue?.issue?.created_by === currentUser?.id; + inboxIssue?.issue?.created_by && currentUser?.id && inboxIssue.issue.created_by === currentUser.id; -const isOwner = inboxIssue?.issue.created_by === currentUser?.id; +const isOwner = inboxIssue?.issue?.created_by && currentUser?.id && inboxIssue.issue.created_by === currentUser.id;Also applies to: 71-72
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- web/core/components/inbox/content/root.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
web/core/components/inbox/content/root.tsx (2)
67-67: LGTM! Creator check now references the correct property.The change correctly accesses the creator ID through the nested
issueproperty, fixing the validation for guest users editing their own intake issues.
Line range hint
66-72: Verify the fix resolves all guest user scenarios.The permission logic looks correct, but let's verify that it handles all edge cases for guest users:
- Guest user creating a new intake issue
- Guest user editing their own intake issue
- Guest user attempting to edit others' intake issues
✅ Verification successful
Let me try again with corrected file type flags for ripgrep.
Based on the search results, I can now generate the final response as we have sufficient information about the guest user handling and inbox issue operations.
Guest user permissions are properly implemented for all scenarios
The code correctly handles all guest user scenarios:
- The
readOnlyflag is properly set based on both guest status and ownership (!isOwner && isGuest)- Guest users can create new intake issues through
createInboxIssuewithout restrictions- Guest users can only edit their own issues (where
created_by === currentUser.id)- The permission check is consistently applied across inbox issue operations (status updates, snooze, duplicate, etc.)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for related test cases and guest user handling echo "Searching for guest user test cases..." rg -l "isGuest.*intake" --type ts --type tsx echo "Searching for related permission checks..." rg "projectPermissionsByWorkspaceSlugAndProjectId.*GUEST" --type ts --type tsx -A 3 echo "Searching for intake issue creation/editing flows..." ast-grep --pattern 'const $name = $$$; if ($name === EUserPermissions.GUEST) { $$$ }'Length of output: 573
Script:
#!/bin/bash # Search for guest user related code and tests echo "Searching for guest user test cases..." rg -l "isGuest.*intake" echo "Searching for related permission checks..." rg "projectPermissionsByWorkspaceSlugAndProjectId.*GUEST" -A 3 echo "Searching for guest user handling in components..." rg "isGuest.*=.*projectPermissionsByWorkspaceSlugAndProjectId" -A 3 echo "Searching for intake issue creation/editing flows..." rg "createInboxIssue|updateInboxIssue" -A 5Length of output: 10013
Changes:
This PR addresses the issue where guest users were unable to edit an intake issue immediately after creation.
Reference:
[WEB-2713]
Summary by CodeRabbit
These changes enhance the accuracy of user permissions related to inbox issues.