Resolve "BUGFIX: user cannot be admin and subscriber at same time"
Closes #104 (closed) Closes #95 (closed)
Bug description
- SYMPTOM: alice, who is an admin, sends HELLO. subsequently receives 2 copies of all messages. (and still receives messages after sending GOODBYE, but cannot send them)
- CAUSE: we relay messages to all subscribers and admins. after HELLO, alice is both, so receives messages twice. (GOODBYE removes alice as admin, not subscriber)
- FIX: only allow a user to be an admin or a subscriber, never both
Implementation Notes
- create
membershipResposiory
that uses a newmembership
model/table- ensure that
member
model/table hastype
field that may beADMIN
orSUBSCRIBER
- in migration:
- move all existing
publication
andsubscription
rows intomemberships
table (settingtype
appropriately) - dedupe any dual-role admin/subscribers to a single
ADMIN
membership
- move all existing
- ensure that
- if a subscriber is ever made an admin (via ADD command), update their membership type to
ADMIN
, and leave no trace of the former subscriber - for all HELLO messages, if user is already an admin block command and respond with helpful "i can't do that" message
- NOW: admins will not receive dupe messages and GOODBYE will be unambiguous (and only required once)