-
Notifications
You must be signed in to change notification settings - Fork 10
feat(client): User permission set correctly also if user is not present on the 1st page of pagination in app/engine settings #1205
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
feat(client): User permission set correctly also if user is not present on the 1st page of pagination in app/engine settings #1205
Conversation
… page of pagination
@CodiumAI-Agent /describe |
Titlefeat(client): User permission set correctly also if user is not present on the 1st page of pagination in app/engine settings User descriptionDescriptionThe logged-in user's permission is determined by a dedicated API call, ensuring correct access rights are set even if the user does not appear on the first page of the members list. This guarantees accurate UI controls regardless of pagination. Changes Made
How to Test
PR TypeBug fix, Enhancement Description
Changes walkthrough 📝
|
@CodiumAI-Agent /review |
@CodiumAI-Agent /improve |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to d90be3d
Previous suggestionsSuggestions up to commit ba4f454
|
// return; | ||
// } | ||
setUserDetails(); | ||
}, [userDetails.status, userDetails.data]); |
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.
Let's try to remove the dependencies and check it once. We don't need to call setUserDetails again and again on pagination as it wouldn't change
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.
Yes , I have removed userDetails.data dependency as it wouldn't affect the behavior, so that setUserDetails wouldn't be called again and again.
@@ -295,65 +295,69 @@ export const MembersTable = (props: MembersTableProps) => { | |||
setPage(0); | |||
}, [debouncedSearch]); | |||
|
|||
const getUserDataApi: Parameters<typeof useAPI>[0] = |
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 double ternary seems worse than just a if else, and it is harder to read.
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.
Now I've changed the double ternary to simple if-else statements.
] | ||
: type === 'APP' | ||
? [ | ||
'getProjectUsers', | ||
adminMode, | ||
id, | ||
debouncedSearch ? debouncedSearch : undefined, |
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.
why did we get rid of this?
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.
Fixed it @AAfghahi and consolidated 2 if conditions into 1.
May be a separate issue. Should i be able to demote authors, or should i only be able to demote users of the same status as me along with myself: I can push this, but yeah still think there's issues. Lmk what you think @AAfghahi |
Yes, the issue has been resolved. Editors no longer have the ability to demote Authors. |
Looks good ty |
Description
The logged-in user's permission is determined by a dedicated API call, ensuring correct access rights are set even if the user does not appear on the first page of the members list. This guarantees accurate UI controls regardless of pagination.
Changes Made
Added a dedicated API call to fetch the logged-in user's member record directly, using their user ID and a limit of 1.
Implemented the setUserDetails function to set the logged-in user's data and permission based on the result of this
dedicated API call, ensuring correct permission assignment even if the user is not present in the paginated members list.
How to Test