Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

What's in this PR?

  • Send comment creator details and changes comments structure
  • Comment structure is changed from flat array to deep array, this way its easier in clientside to render them.

Ticket link - https://topcoder.atlassian.net/browse/PM-2177

- pm-1955_2
- re-try-failed-jobs
- pm-2539
- pm-2177_user_detais

Choose a reason for hiding this comment

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

[❗❗ correctness]
There is a typo in the branch name pm-2177_user_detais. It should likely be pm-2177_user_details. This could lead to confusion or errors when triggering workflows based on branch names.

.map((item) => item.createdBy as string);

const members = await this.memberPrisma.member.findMany({
where: { userId: { in: createdByList.map((id) => BigInt(id)) } },

Choose a reason for hiding this comment

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

[❗❗ correctness]
Using BigInt to convert userId might cause issues if createdByList contains non-numeric strings. Consider validating the input before conversion to ensure all entries are valid numeric strings.

});

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
const normalized = members.map((m: any) => ({

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The use of any type for members and commentsById can lead to runtime errors due to lack of type safety. Consider defining a specific type or interface for these objects to improve type safety and maintainability.

for (const item of items) {
for (const comment of item.comments) {
if (comment.parentId) {
const parent = commentsById[comment.parentId];

Choose a reason for hiding this comment

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

[⚠️ performance]
The nested loop structure for reconstructing comments could be optimized. Consider using a single pass to build the commentsById map and nest child comments, which would improve performance by reducing the complexity from O(n^2) to O(n).

@kkartunov kkartunov merged commit eb903fd into develop Nov 22, 2025
7 checks passed
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.

3 participants