-
Notifications
You must be signed in to change notification settings - Fork 96
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: vordr on posts #2108
feat: vordr on posts #2108
Conversation
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.
Looks good, we need to remember the notification as well
Yeah, working on that part |
7539023
to
99e7590
Compare
82ea686
to
83b0df3
Compare
83b0df3
to
6e2d3ff
Compare
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.
Vordr getting more power 💪 Some general comments, also missing few tests here and there.
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.
Minor comments, good work here!
__tests__/comments.ts
Outdated
@@ -978,6 +978,22 @@ describe('mutation commentOnPost', () => { | |||
expect(comment.flags).toEqual({ vordr: false }); | |||
}); | |||
|
|||
it('should set correct vordr flags on good user if vordr filter catches it', async () => { |
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.
Maybe name them explicit for post/comment jest doesn't like same names so much and I actually thought for a second it was duplicated 😅
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.
Renamed tests
createdPost.banned = true; | ||
createdPost.showOnFeed = false; |
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 think @capJavert was right we also need to set it as flags.
Actually Ante, not sure now which one we use, maybe we should only use either raw or the flags?
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 asked Ido, and he said to use column. But I can just set it both places to be sure
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 set both column of flags now
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.
Minor suggestion, but otherwise no blocking issues from my side.
(Just wait for 2 approvals please)
src/common/post.ts
Outdated
createdPost.flags.banned = true; | ||
|
||
createdPost.showOnFeed = false; | ||
createdPost.flags.showOnFeed = false; |
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.
You might want to use updateFlagsStatement
here for safety :)
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 get this TS error then
Type '() => string' has no properties in common with type 'Partial<{ sentAnalyticsReport: boolean; banned: boolean; deleted: boolean; private: boolean; visible: boolean; showOnFeed: boolean; promoteToPublic: number; deletedBy: string; vordr: boolean; }>'.ts(2559)
I think it should be fine to not use it, as it hasn't been saved in the database yet, so it's still a js object.
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.
Can do this instead
createdPost.flags = {
...createdPost.flags,
banned: true,
showOnFeed: false,
};
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.
CC: @capJavert up to you :)
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.
@omBratteng for updateFlagsStatement
you have to use insert or update methods since save does not support sql statements, since we are just creating a post we can probably use insert
here.
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.
But I think we don't have to use updateFlagsStatement
here since as @omBratteng said it has not been saved to DB yet.
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.
@capJavert went with this as it's before insertion to DB.
createdPost.flags = {
...createdPost.flags,
banned: true,
showOnFeed: false,
};
src/entity/posts/utils.ts
Outdated
|
||
if (vordrStatus === true) { | ||
createdPost.banned = true; | ||
createdPost.flags.banned = true; |
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.
Same here updateFlagsStatement
Marking as ready for review, but I'm working on tests for: