Skip to content

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 new membership model/table
    • ensure that member model/table has type field that may be ADMIN or SUBSCRIBER
    • in migration:
      • move all existing publication and subscription rows into memberships table (setting type appropriately)
      • dedupe any dual-role admin/subscribers to a single ADMIN membership
  • 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)

Merge request reports