Open EGreg opened 10 years ago
Also have scripts/Streams/0.8.1-Users.mysql
insert another users_label
named "Streams/invitedBy", with the title "Invited By".
When accepting an invitation from a user, the Streams plugin will add this user as contact under this label. Also insert a label with name "Streams/invited\t$streamType" for the invited user, and title = "Invited to $Title" (where $Title is obtained from the stream's template, if any, or is otherwise Foo where streamType is "$Module/$foo"). Add a contact under this label for the inviting user.
Right now,
displayName
in invites refers to the display name of the inviting user. Let's change this and improve invites.First of all, have
scripts/Streams/0.8.1-Users.mysql
insert ausers_label
called "Streams/invited", with the title "Invited". Also whenever the "Streams/user/firstName" and "Streams/user/lastName" streams are created, createstreams_access
rows for them to grant read access to all contacts with label "Streams/invited". This will replacedisplayName
as the way that the inviting user's name will be displayed to users who were invited.When sending a POST request to
Streams/invite
, add contacts with "Streams/invited" label for all the invited users, including the futureUsers. Check for streams_access rows with label "Streams/invited" for "firstName" and "lastName" and use those to calculate the displayName for each user being invited. (Later, we might make the label customizable in the options toStreams::invite
.) This displayName will be sent to Node as it currently is being sent. Make sure that the Node code uses this and notdisplayName
from any database fields.Also while handling the above POST, insert a label with name "Streams/invited\t$streamType" for the inviting user, and title = "Invited to $Title" (where $Title is obtained from the stream's template, if any, or is otherwise Foo where streamType is "$Module/$foo"). Add contacts with this label for all the invited users, including the futureUsers.
Now, update the version of the Streams plugin to 0.8.1 . Have the
scripts/Streams/0.8.1-Streams.mysql
ALTER TABLE to renamestreams_invite.displayName
tostreams_invite.fullName
. This field will not be used anymore to record the displayName for invites. Instead, it will be used for zero-step invites, i.e. when the fullName of the invited user has already been set by the inviting user. Here is how:When a user accepts an invite that has a fullName set, and the user's displayName is empty, then that fullName will be set similar to how
Streams_basic_post
does it, in the app. (In the future, the app may choose some external Personal Server app, such as Invites, for handling sending the invites and managing the invited user's account. It will use OAuth to get a user xid from that server and use that.)The
Streams_after_Q_objects
hook will now seefollowedInvite
but won't ask to show a dialog because the user'sdisplayName
would have already been set. Which implements the zero-step invites.