Skip to content
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: multi squad moderation #2617

Merged
merged 13 commits into from
Feb 6, 2025
Merged

feat: multi squad moderation #2617

merged 13 commits into from
Feb 6, 2025

Conversation

AmarTrebinjac
Copy link
Contributor

Enables a moderator to view moderation items from multiple squads at once, as well as bulk approve for multiple squads at once.

Copy link
Contributor

@rebelchris rebelchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor questions

@@ -819,7 +821,7 @@ export const typeDefs = /* GraphQL */ `
"""
Id of the source
"""
sourceId: ID!
sourceId: ID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what case do you not send it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I answered it here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess when you want to ask for all moderations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I'd also go for a separate query if it would make things much simpler.

if (args?.sourceId) {
const isModerator = await isPrivilegedMember(ctx, args.sourceId);
if (isModerator) {
return graphorm.queryPaginated(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is this for?
Not full following this addition here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If sourceId is provided, we continue as before. If not, we fetch all the items the current user is allowed to moderate for the shared moderation page

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking maybe we want a new mutation for multi moderation, its a bit hard to follow what is going on and I would bet we again missed some branch of the logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all made from the same page on the frontend. Rather than creating multiple endpoints and having to deal with that on the frontend as well, how about maybe abstracting the logic instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think main issue is 3 big queries with queryPaginated, they share some params but its hard to see what and where so if those can be extracted it would help.

@@ -1351,7 +1351,7 @@ describe('storeNotificationBundle', () => {
);
expect(actual.notification.description).toEqual('Lacks value.');
expect(actual.notification.targetUrl).toEqual(
'http://localhost:5002/squads/a/moderate',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we add a redirect on frontend for this since some old notifications might be wrong?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we might have to add it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AmarTrebinjac just a reminder if you did not add it already 🙏 if yes ignore

src/schema/sources.ts Outdated Show resolved Hide resolved
src/schema/posts.ts Outdated Show resolved Hide resolved
@AmarTrebinjac
Copy link
Contributor Author

@capJavert I've made some changes, take a look.

I managed to solve the count stuff on the frontend without needing to update boot :)

Comment on lines 1247 to 1250
Source to moderate the post in
"""
sourceId: ID!
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is breaking change so we can't really merge before frontend?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please check extension is not using this query since for it we have to keep backward compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@capJavert This is not an extension page, so should be fine

The plan is to merge both frontend and backend at the same time

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

The plan is to merge both frontend and backend at the same time

Yeah this is not ideal because if we have to revert it will take more time, but let's keep it in mind for the next time, we should always be backward compatible, thats why sometimes its better to add separate query.

All in all, I recommend we merge API first and then frontend (since that one is faster to deploy).

@AmarTrebinjac AmarTrebinjac merged commit b646d99 into main Feb 6, 2025
8 checks passed
@AmarTrebinjac AmarTrebinjac deleted the MI-635 branch February 6, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants