-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model for following an account #1599
Comments
Subscriptions have several complications and are best managed as independent records:
|
The list use case is incompatible with our notifications framework, as that requires an explicit User. We can reduce scope to just the follower use case, with optional columns for preferred contacts and optional sharing of contacts with the Account. An Account can still invite someone to be a follower. |
Counterpoint: Lists are still required for change announcements, but can be simplified to a list of accounts, without contact information, but with custom extra fields. This still leaves open questions:
|
Simplified version of a class FollowerMembership(ImmutableUserMembershipMixin, EmailAddressMixin, PhoneNumberMixin, db.Model):
__email_for__ = 'user'
__email_optional__ = True
__email_is_exclusive__ = True
__phone_for__ = 'user'
__phone_optional__ = True
__phone_is_exclusive__ = True
account = relationship(Profile) # Rename model to `Account` soon
@property
def phone_number_reference_is_active(self) -> bool:
return self.is_active
@property
def email_address_reference_is_active(self) -> bool:
return self.is_active In this model, there is no correlation with subscription, and that has been left for the future. Sharing an email or phone is optional, but if shared it must be validated to belong to the user, and will also redirect notifications to the preferred address, thereby solving for the currently-pending When a
|
Implementation is in #1644. |
A User may follow an Account (nee Profile) to be appraised of new activity and receive updates.
At its core, this is an instance of a membership model, subclassing
ImmutableUserMembershipMixin
. However, there are four additional requirements:The User may have preferred contacts (email or phone) for delivery of updates from this Account. These should be included in the record as foreign keys to either UserEmail/UserPhone (ensuring ownership by this user) or EmailAddress/PhoneNumber (see below).
The User may choose to share zero, one or both of these contacts with the Account, with the explicit understanding the Account may export these contacts into an external contact management system that the User no longer has any control over.
The User may have authorised the Account off-platform to add them as a follower, but the Account only has contact details, not a user identifier. In this case, the membership record may have no foreign key reference to the User (and hence cannot depend on
ImmutableUserMembershipMixin
). The email/phone identifiers belong to the Account and not the User.The User may be required to hold a paid subscription to the Account. Is the source of truth for having a subscription in this record itself, or is it external and referenced from here?
In summary, we have three competing paradigms that are very similar in their data structures but are functionally distinct concepts:
Should these be implemented differently, or unified with some compromises? Discussion in comments.
The text was updated successfully, but these errors were encountered: