-
-
Notifications
You must be signed in to change notification settings - Fork 811
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
Bugfix #1979 Add more options to UserOrderByInput #1980
Bugfix #1979 Add more options to UserOrderByInput #1980
Conversation
Our Pull Request Approval ProcessWe have these basic policies to make the approval process smoother for our volunteer team. Testing Your CodePlease make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:
The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
@rahulch07 Please fix the failing tests. |
WalkthroughThe changes involve updating the Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant UsersScreen
participant GraphQLServer
User->>UsersScreen: Perform Search/Sort
UsersScreen->>GraphQLServer: Query Users with $order parameter
GraphQLServer-->>UsersScreen: Return Ordered User List
UsersScreen-->>User: Display Ordered User List
Assessment against linked issues
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- schema.graphql (1 hunks)
- src/GraphQl/Queries/Queries.ts (2 hunks)
- src/screens/Users/Users.tsx (11 hunks)
Additional comments not posted (14)
src/screens/Users/Users.tsx (12)
21-21
: Added import forApolloError
type.This ensures proper typing for error handling in Apollo client queries.
45-55
: Refactored destructuring ofuseQuery
to includeerror
and renamedata
tousersData
andrefetch
torefetchUsers
.This change improves readability and makes the code more descriptive, aligning with the new functionalities.
61-61
: Addedorder
variable to theuseQuery
options to support dynamic sorting.This is a necessary addition to implement the sorting functionality as per the PR objectives.
67-67
: Initialization ofdisplayedUsers
now directly usesusersData?.users
.This change simplifies the initialization and ensures that
displayedUsers
is always up to date with the fetched data.
104-104
: Redirect non-SUPERADMIN users to the organization list page.This is a security feature ensuring that only SUPERADMIN users have access to certain functionalities.
124-124
: UpdatedrefetchUsers
call inhandleSearch
to include dynamic search parameters.Enhances the search functionality by allowing dynamic queries based on user input.
Also applies to: 129-129
148-153
: UpdatedrefetchUsers
inresetAndRefetch
to reset search parameters and maintain the current sorting order.This ensures that the user list is correctly refreshed while maintaining the selected sort order.
162-165
: UpdatedfetchMore
to includeuserType
andorder
, supporting filtered and sorted pagination.This addition is crucial for maintaining consistency in the list when loading more users under specific filters and sort orders.
188-189
: Added reset ofdisplayedUsers
inhandleSorting
andhandleFiltering
.Clearing the displayed users list before applying new filters or sort orders prevents display issues and ensures that users see the correct data.
Also applies to: 217-217
266-266
: Conditional rendering based onuserType
.This ensures that certain UI elements are only displayed to SUPERADMIN users, adhering to the specified role-based access control.
359-369
: Enhanced conditional rendering for displaying no results or user not found messages.Improves user experience by providing clear feedback when no users match the search criteria or when no users are available.
412-412
: Ensured thatUsersTableItem
is only rendered when there are users to display.This prevents unnecessary rendering calls and potential errors when the
usersData
is undefined.src/GraphQl/Queries/Queries.ts (1)
111-111
: Addedorder
parameter to theUSER_LIST
query to support dynamic sorting of users.This change aligns with the frontend modifications and enables sorting functionality at the data fetching level.
Also applies to: 120-120
schema.graphql (1)
1443-1444
: The addition ofcreatedAt_ASC
andcreatedAt_DESC
toUserOrderByInput
enables sorting by creation date, which aligns with the PR objectives.Verification successful
The addition of
createdAt_ASC
andcreatedAt_DESC
toUserOrderByInput
has been successfully integrated into the codebase. The search results show multiple instances where these sorting options are used in TypeScript files, confirming their implementation.
- Instances of
createdAt_ASC
andcreatedAt_DESC
were found in various TypeScript files, indicating that the new sorting options are being utilized.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of the new sorting options in backend and frontend. # Test: Search for the usage of `UserOrderByInput` in backend and frontend files. fd 'schema.graphql' --exec rg 'UserOrderByInput' fd '.tsx$|.ts$' --exec rg 'UserOrderByInput'Length of output: 234
Script:
#!/bin/bash # Description: Verify the integration of the new sorting options `createdAt_ASC` and `createdAt_DESC` in backend and frontend files. # Test: Search for the usage of `createdAt_ASC` and `createdAt_DESC` in TypeScript files. fd '.tsx$|.ts$' --exec rg 'createdAt_ASC' fd '.tsx$|.ts$' --exec rg 'createdAt_DESC'Length of output: 1708
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1980 +/- ##
===========================================
+ Coverage 98.26% 98.39% +0.13%
===========================================
Files 210 210
Lines 5712 5810 +98
Branches 1705 1719 +14
===========================================
+ Hits 5613 5717 +104
+ Misses 93 87 -6
Partials 6 6 ☔ View full report in Codecov by Sentry. |
Please get the test code coverage of the patch higher |
Yes, making test cases. |
This pull request did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work. |
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/screens/Users/Users.test.tsx (5 hunks)
Additional context used
GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/screens/Users/Users.test.tsx
[failure] 15-15:
'"./UsersMocks"' has no exported member named 'MOCKS4'. Did you mean 'MOCKS'?
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/screens/Users/Users.test.tsx (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/screens/Users/Users.test.tsx
This pull request did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work. |
What kind of change does this PR introduce?
BugFix
Issue Number:
Fixes #1979
Did you add tests for your changes?
Yes
Snapshots/Videos:
Summary
This PR is for changes in talawa-admin for issuse #1979 and #2298 are the changes in talawa-api
Does this PR introduce a breaking change?
Other information
Have you read the contributing guide?
Yes
Summary by CodeRabbit
New Features
Bug Fixes
Tests