-
Notifications
You must be signed in to change notification settings - Fork 0
Add search and pagination to suspended users and mods lists #8
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?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Co-authored-by: gennitdev <114821397+gennitdev@users.noreply.github.com>
gennitdev
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.
There's a problem with the async calls, yielding this backend error. can you fix it?
🚨 GraphQL Error Details: {
errorId: 'err_1752261241569_7cmjlkpyp',
timestamp: '2025-07-11T19:14:01.569Z',
message: 'Variable "$searchInput" is never used in operation "getSuspendedUsersWithSearch".',
code: 'UNKNOWN_ERROR',
path: undefined,
locations: [ { line: 1, column: 64 } ],
operationName: 'getSuspendedUsersWithSearch',
variables: { channelUniqueName: 'cats', limit: 15, offset: 0 },
query: 'query getSuspendedUsersWithSearch($channelUniqueName: String!, $searchInput: String, $limit: Int!, $offset: Int!) {\n' +
' channels(where: {uniqueName: $channelUniqueName}) {\n' +
' uniqueName\n' +
' SuspendedUsersAggregate {\n' +
' count\n' +
' __typename\n' +
' }\n' +
' SuspendedUsers(\n' +
' options: {limit: $limit, offset: $offset, sort: {createdAt: DESC}}\n' +
' ) {\n' +
' id\n' +
' username\n' +
' createdAt\n' +
' suspendedUntil\n' +
' suspendedIndefinitely\n' +
' SuspendedUser {\n' +
' username\n' +
' displayName\n' +
' profilePicURL\n' +
' commentKarma\n' +
' discussionKarma\n' +
' __typename\n' +
' }\n' +
' RelatedIssue {\n' +
' id\n' +
' __typename\n' +
' }\n' +
' __typename\n' +
' }\n' +
' __typename\n' +
' }\n' +
'}',
userAgent: undefined,
ip: undefined,
stack: 'GraphQLError: Variable "$searchInput" is never used in operation "getSuspendedUsersWithSearch".\n' +
' at Object.leave (/Users/catherineluse/gennit/gennit-backend/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js:39:15)\n' +
' at Object.leave (/Users/catherineluse/gennit/gennit-backend/node_modules/graphql/language/visitor.js:324:32)\n' +
' at Object.leave (/Users/catherineluse/gennit/gennit-backend/node_modules/graphql/utilities/TypeInfo.js:411:21)\n' +
' at visit (/Users/catherineluse/gennit/gennit-backend/node_modules/graphql/language/visitor.js:197:21)\n' +
' at validate (/Users/catherineluse/gennit/gennit-backend/node_modules/graphql/validation/validate.js:91:24)\n' +
' at validate (/Users/catherineluse/gennit/gennit-backend/node_modules/apollo-server-core/dist/requestPipeline.js:188:39)\n' +
' at processGraphQLRequest (/Users/catherineluse/gennit/gennit-backend/node_modules/apollo-server-core/dist/requestPipeline.js:99:38)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
' at async processHTTPRequest (/Users/catherineluse/gennit/gennit-backend/node_modules/apollo-server-core/dist/runHttpQuery.js:222:30)',
Co-authored-by: gennitdev <114821397+gennitdev@users.noreply.github.com>
... Fixed the GraphQL error by removing the unused |
gennitdev
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.
I don't want client-side filtering. I want the searchInput passed into the graphql queries on both lists. Here is an example of searchInput being used in a query:
export const GET_CHANNELS = gql`
query getSortedChannels(
$offset: Int
$limit: Int
$tags: [String]
$searchInput: String
$now: DateTime = "${now}"
) {
getSortedChannels(
offset: $offset
limit: $limit
tags: $tags
searchInput: $searchInput
) {
channels {
uniqueName
displayName
channelIconURL
description
Tags {
text
}
EventChannelsAggregate(
where: {
NOT: {
archived: true,
Event: null
}
Event: {
canceled: false,
endTime_GT: $now,
}
}
) {
count
}
DiscussionChannelsAggregate(
where: {
AND: [
{ NOT: { archived: true } }
{ NOT: { Discussion: null } }
{ NOT: { Discussion: { hasDownload: true } } }
]
}
) {
count
}
}
aggregateChannelCount
}
}
`;
gennitdev
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.
Actually a better example would be this query:
import { gql } from "@apollo/client/core";
export const GET_TAGS = gql`
query getTags($where: TagWhere) {
tags(where: $where, options: { limit: 10 }) {
text
}
}
`;
the search input will be needed to be passed into the where object. for the type of the where object, you will need to check the auto-generated type in the generated/graphql.ts.
…iltering
- Add $searchInput parameter back to both GraphQL queries
- Use where clauses for server-side filtering:
- SuspendedUser: { username_CONTAINS: $searchInput }
- SuspendedMod: { displayName_CONTAINS: $searchInput }
- Remove client-side filtering logic from Vue components
- Add watchers to refetch data when search input changes
- Update fetchMore functions to include searchInput parameter
Co-authored-by: gennitdev <114821397+gennitdev@users.noreply.github.com>
... I've updated both GraphQL queries to implement server-side filtering instead of client-side filtering. The queries now use proper where clauses:
The Vue components have been updated to pass the |
Co-authored-by: gennitdev <114821397+gennitdev@users.noreply.github.com>
... I've updated both GraphQL queries to follow the pattern you suggested. The queries now accept a
When there's no search input, |
This PR enhances the suspended users and suspended mods management pages by adding search functionality and pagination, making it easier for moderators to find specific suspended users or mods in large lists.
Changes Made
🔍 Search Functionality
📄 Pagination
LoadMorecomponent to both lists with 15 items per page🛠 Technical Implementation
getSuspendedUserFilterValuesFromParams.tsandgetSuspendedModFilterValuesFromParams.tsGET_SUSPENDED_USERS_WITH_SEARCHandGET_SUSPENDED_MODS_WITH_SEARCH📁 Files Modified
pages/forums/[forumId]/edit/suspended-users.vue- Added search bar and paginationcomponents/channel/form/SuspendedModList.vue- Added search bar and paginationgraphQLData/mod/queries.js- Added new paginated queriesUsage Examples
Before
Lists showed all suspended users/mods without search or pagination, making it difficult to find specific entries in large lists.
After
/forums/example/edit/suspended-users?searchInput=aliceto search for users/forums/example/edit/suspended-mods?searchInput=modto search for modsBenefits
Fixes #7.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.