fix: preserve existing member types when registering as a mentor (#731)#761
Open
yingliu-data wants to merge 1 commit into
Open
fix: preserve existing member types when registering as a mentor (#731)#761yingliu-data wants to merge 1 commit into
yingliu-data wants to merge 1 commit into
Conversation
Remove a duplicate builder call in MentorshipService.create that overwrote the merged member types with [MENTOR] only. When an existing member (e.g. MEMBER, LEADER) registers as a mentor, their other member types are now retained instead of being discarded. Closes #731
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
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
Fixes #731 — when an existing member registered as a mentor, their other member types were silently discarded.
In
MentorshipService.create, the existing-member branch built the mentor with the correctly-merged member types, then a duplicate.memberTypes(mentor.getMemberTypes())builder call overwrote it. Because the builder's last call wins andmentor's types had been forced to[MENTOR]earlier in the method, the merged list was lost. This PR removes the duplicate call (one line), so the merged[existing types + MENTOR]list is retained.Impact
A member with types such as
[MEMBER, LEADER]who registers as a mentor now keeps those types ([MEMBER, LEADER, MENTOR]) instead of being reduced to[MENTOR].Verification
Tested locally end-to-end against a Postgres-backed instance (member types read from
member_member_types):MENTORonly (prior type wiped)MENTORpreservedNotes
MentorshipServiceTest.shouldPreserveAllFieldsWhenMentorReRegistersWithExistingEmail(adding amemberTypesassertion — the field the bug corrupted) exists locally but is not included in this commit; happy to add it to this PR if reviewers prefer. It fails on the un-fixed code and passes with the fix.