Skip to content

fix: preserve existing member types when registering as a mentor (#731)#761

Open
yingliu-data wants to merge 1 commit into
mainfrom
fix/731-mentor-membertypes
Open

fix: preserve existing member types when registering as a mentor (#731)#761
yingliu-data wants to merge 1 commit into
mainfrom
fix/731-mentor-membertypes

Conversation

@yingliu-data

Copy link
Copy Markdown

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 and mentor'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):

Member (prior type) After registering as mentor
Before fix MENTOR only (prior type wiped)
After fix prior type + MENTOR preserved

Notes

  • A regression test strengthening MentorshipServiceTest.shouldPreserveAllFieldsWhenMentorReRegistersWithExistingEmail (adding a memberTypes assertion — 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.

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
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
platform-admin Ignored Ignored Jul 4, 2026 11:07am

@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

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.

bug: Existing member's memberTypes wiped when they register as a mentor

1 participant