-
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: read from content_preference source member #2451
base: main
Are you sure you want to change the base?
Conversation
'hide', | ||
) | ||
.from(ContentPreference, 't') | ||
.innerJoin( |
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.
anyway we can get rid of this join? i also think that somewhere we already do this join so we can reuse it
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 issue as #2451 (comment)
} else if ( | ||
typeof graphorm.mappings?.SourceMember.fields?.roleRank.select === | ||
'string' | ||
) { | ||
queryBuilder = queryBuilder.andWhere( | ||
`${graphorm.mappings.SourceMember.fields.roleRank.select} >= 0`, | ||
); | ||
} else if ( | ||
typeof graphorm.mappings!.SourceMember!.fields!.roleRank.select === |
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.
What is this addition?
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.
Field is now a function in graphorm/index
, before it was a string so I had to adjust it. See https://github.com/dailydotdev/daily-api/pull/2451/files#diff-928042d056cac827c70794ef59920facfe32f158ebf447ff7d2826fcad5195aeR541-R542
src/workers/cdc/primary.ts
Outdated
const sourceId = | ||
data.payload.after!.sourceId || data.payload.before!.sourceId; | ||
|
||
const source = await con |
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 we should consider storing a flag that says on content preference that this is a squad? It will make fetching the source redundant and the content preference object will be complete
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 thought about that, initially ContentPreference had a different type for squad all together but I opted to make it source because in more places we use them interchangeably.
Adding another flag for this differentiation would solve it, but then its another field that has to be synced and set here and on source.type itself if type of source changes (it does not happen often I think, or never).
You think this would be expensive if we don't add the flag? I added additional check so its only queried for source type.
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 it's a downgrade from what we had and might make it unclear for other devs that it needs to be queried
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.
Thinking, should we have gone with a route to have different type for squad content_preference
then.
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.
Since it's water under the bridge now, let's proceed as is then. We should just be clear about it and pay attention
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.
Massive work @capJavert, way to go!!!
feat: do not show status blocked in member lists feat: do not send notifications for status blocked members feat: still show member is part of source if status was blocked (since new UI is missing this is temp nuances)
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 added some missed stuff to not show blocked squads i member lists and sidebar and also to avoid sending them notifications.
src/workers/cdc/primary.ts
Outdated
const sourceId = | ||
data.payload.after!.sourceId || data.payload.before!.sourceId; | ||
|
||
const source = await con |
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 thought about that, initially ContentPreference had a different type for squad all together but I opted to make it source because in more places we use them interchangeably.
Adding another flag for this differentiation would solve it, but then its another field that has to be synced and set here and on source.type itself if type of source changes (it does not happen often I think, or never).
You think this would be expensive if we don't add the flag? I added additional check so its only queried for source type.
} else if ( | ||
typeof graphorm.mappings?.SourceMember.fields?.roleRank.select === | ||
'string' | ||
) { | ||
queryBuilder = queryBuilder.andWhere( | ||
`${graphorm.mappings.SourceMember.fields.roleRank.select} >= 0`, | ||
); | ||
} else if ( | ||
typeof graphorm.mappings!.SourceMember!.fields!.roleRank.select === |
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.
Field is now a function in graphorm/index
, before it was a string so I had to adjust it. See https://github.com/dailydotdev/daily-api/pull/2451/files#diff-928042d056cac827c70794ef59920facfe32f158ebf447ff7d2826fcad5195aeR541-R542
'hide', | ||
) | ||
.from(ContentPreference, 't') | ||
.innerJoin( |
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 issue as #2451 (comment)
const sourceMember = await con | ||
.getRepository(ContentPreferenceSource) | ||
.findOneBy({ | ||
referenceId: PLUS_MEMBER_SQUAD_ID, | ||
userId: newBase.id, | ||
status: Not(ContentPreferenceStatus.Blocked), | ||
}); |
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.
@rebelchris if you can sanity check test changes for plus in this 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.
AS-681