feat(mobile): highlight and surface current user in suggested reviewers (port #2435)#2449
Open
Gilbert09 wants to merge 2 commits into
Open
feat(mobile): highlight and surface current user in suggested reviewers (port #2435)#2449Gilbert09 wants to merge 2 commits into
Gilbert09 wants to merge 2 commits into
Conversation
…rs (port #2435) Ports desktop PR #2435 to the mobile inbox report detail. - Wire the current user's uuid (via useUserQuery) into SuggestedReviewers so the existing isMe highlight shows. - Move the logged-in user to the front of the suggested-reviewers list when present and not already first, via a pure orderSuggestedReviewers util. - Add unit tests covering reorder, already-first no-op, absent user, and missing uuid. Generated-By: PostHog Code Task-Id: 6570d0da-5363-4355-94b2-4576776d02aa
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/mobile/src/features/inbox/utils.test.ts:33-49
The three no-op cases all assert the same thing — that the original array reference is returned unchanged — across different inputs. Per the team's convention of preferring parameterised tests, they're a natural fit for `it.each`.
```suggestion
it.each([
{
label: "already first",
reviewers: [reviewer("me", "uuid-me"), reviewer("a", "uuid-a")],
meUuid: "uuid-me" as string | null | undefined,
},
{
label: "absent",
reviewers: [reviewer("a", "uuid-a"), reviewer("b", "uuid-b")],
meUuid: "uuid-me" as string | null | undefined,
},
{
label: "null meUuid",
reviewers: [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")],
meUuid: null as string | null | undefined,
},
{
label: "undefined meUuid",
reviewers: [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")],
meUuid: undefined as string | null | undefined,
},
])("is a no-op when $label", ({ reviewers, meUuid }) => {
expect(orderSuggestedReviewers(reviewers, meUuid)).toBe(reviewers);
});
```
Reviews (1): Last reviewed commit: "feat(mobile): highlight and surface curr..." | Re-trigger Greptile |
Comment on lines
+33
to
+49
| it("is a no-op when the current user is already first", () => { | ||
| const reviewers = [reviewer("me", "uuid-me"), reviewer("a", "uuid-a")]; | ||
| const ordered = orderSuggestedReviewers(reviewers, "uuid-me"); | ||
| expect(ordered).toBe(reviewers); | ||
| }); | ||
|
|
||
| it("is a no-op when the current user is absent", () => { | ||
| const reviewers = [reviewer("a", "uuid-a"), reviewer("b", "uuid-b")]; | ||
| const ordered = orderSuggestedReviewers(reviewers, "uuid-me"); | ||
| expect(ordered).toBe(reviewers); | ||
| }); | ||
|
|
||
| it("is a no-op when meUuid is missing", () => { | ||
| const reviewers = [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")]; | ||
| expect(orderSuggestedReviewers(reviewers, null)).toBe(reviewers); | ||
| expect(orderSuggestedReviewers(reviewers, undefined)).toBe(reviewers); | ||
| }); |
Contributor
There was a problem hiding this comment.
The three no-op cases all assert the same thing — that the original array reference is returned unchanged — across different inputs. Per the team's convention of preferring parameterised tests, they're a natural fit for
it.each.
Suggested change
| it("is a no-op when the current user is already first", () => { | |
| const reviewers = [reviewer("me", "uuid-me"), reviewer("a", "uuid-a")]; | |
| const ordered = orderSuggestedReviewers(reviewers, "uuid-me"); | |
| expect(ordered).toBe(reviewers); | |
| }); | |
| it("is a no-op when the current user is absent", () => { | |
| const reviewers = [reviewer("a", "uuid-a"), reviewer("b", "uuid-b")]; | |
| const ordered = orderSuggestedReviewers(reviewers, "uuid-me"); | |
| expect(ordered).toBe(reviewers); | |
| }); | |
| it("is a no-op when meUuid is missing", () => { | |
| const reviewers = [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")]; | |
| expect(orderSuggestedReviewers(reviewers, null)).toBe(reviewers); | |
| expect(orderSuggestedReviewers(reviewers, undefined)).toBe(reviewers); | |
| }); | |
| it.each([ | |
| { | |
| label: "already first", | |
| reviewers: [reviewer("me", "uuid-me"), reviewer("a", "uuid-a")], | |
| meUuid: "uuid-me" as string | null | undefined, | |
| }, | |
| { | |
| label: "absent", | |
| reviewers: [reviewer("a", "uuid-a"), reviewer("b", "uuid-b")], | |
| meUuid: "uuid-me" as string | null | undefined, | |
| }, | |
| { | |
| label: "null meUuid", | |
| reviewers: [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")], | |
| meUuid: null as string | null | undefined, | |
| }, | |
| { | |
| label: "undefined meUuid", | |
| reviewers: [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")], | |
| meUuid: undefined as string | null | undefined, | |
| }, | |
| ])("is a no-op when $label", ({ reviewers, meUuid }) => { | |
| expect(orderSuggestedReviewers(reviewers, meUuid)).toBe(reviewers); | |
| }); |
Context Used: Do not attempt to comment on incorrect alphabetica... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile/src/features/inbox/utils.test.ts
Line: 33-49
Comment:
The three no-op cases all assert the same thing — that the original array reference is returned unchanged — across different inputs. Per the team's convention of preferring parameterised tests, they're a natural fit for `it.each`.
```suggestion
it.each([
{
label: "already first",
reviewers: [reviewer("me", "uuid-me"), reviewer("a", "uuid-a")],
meUuid: "uuid-me" as string | null | undefined,
},
{
label: "absent",
reviewers: [reviewer("a", "uuid-a"), reviewer("b", "uuid-b")],
meUuid: "uuid-me" as string | null | undefined,
},
{
label: "null meUuid",
reviewers: [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")],
meUuid: null as string | null | undefined,
},
{
label: "undefined meUuid",
reviewers: [reviewer("a", "uuid-a"), reviewer("me", "uuid-me")],
meUuid: undefined as string | null | undefined,
},
])("is a no-op when $label", ({ reviewers, meUuid }) => {
expect(orderSuggestedReviewers(reviewers, meUuid)).toBe(reviewers);
});
```
**Context Used:** Do not attempt to comment on incorrect alphabetica... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Generated-By: PostHog Code Task-Id: 6570d0da-5363-4355-94b2-4576776d02aa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports desktop PR #2435 ("Highlight current user in signal suggested reviewers") to the mobile app, bringing the inbox report detail to parity.
Two gaps were closed in the mobile "Suggested reviewers" list:
useUserQueryand passes it asmeUuidto<SuggestedReviewers>, so the component's existingisMehighlight badge actually shows.orderSuggestedReviewersutil alongside the other inbox derivation helpers.The "Why was I assigned?" commit-reason tooltip from desktop is intentionally not ported: mobile's
SuggestedReviewersdoes not renderrelevant_commitsat all, and inventing a new commits UI was out of scope.Changes
apps/mobile/src/features/inbox/utils.ts— addorderSuggestedReviewers(reviewers, meUuid).apps/mobile/src/app/inbox/[id].tsx— calluseUserQuery, reorder in thesuggestedReviewersmemo, passmeUuidto the component.apps/mobile/src/features/inbox/utils.test.ts— unit tests for the reorder (moves to front, no-op when already first / absent / no uuid).Testing
pnpm --filter @posthog/mobile test src/features/inbox/— passing.tsc --noEmitclean for the changed files.apps/codeuntouched.