Skip to content

Conversation

@linxiao-li
Copy link
Collaborator

@linxiao-li linxiao-li commented Oct 31, 2022

This pr includes:

  1. Integration of the Leanplum api calls for getting and setting the user, updating community subscriptions
  2. Have updateCommunitySubscription accepting an array as argument to allow bulk subscription subscribe/unsubscribe

Demo:

  1. connect wallet and render settings page with Leanplum data flow
connect.wallet.and.populate.settings.page.mov
  1. subscribe to all email notification flow
subscribe.to.all.email.notifications.mov
  1. change email flow
change.email.flow.mov
  1. subscribe to community from settings page flow
subscribe.to.community.mov
  1. subscribe from community page flow
subscribe.from.community.page.mov

@linear
Copy link

linear bot commented Oct 31, 2022

VSL-236

};

export const startLeanplum = () => {
const getDesiredAttributes = (communitySubIntentions) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to convert the array in line 18 into a format of {community1:'True', community2:'False'}

} catch (e) {
throw new Error(e);
}
return new Promise((resolve, reject) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a promise is necessary for ensuring the sequence of execution, we want start leanplum first then get user settings

email: data.userAttributes.email,
};
let isSubscribedToCommunityUpdates = true;
let isSubscribedFromCommunityUpdates = true;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming correction to align the names with the notion document

count: 100,
initialLoading: false,
});
const displayCommunities = isLoadingUserCommunities
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a list of all communities a user participates, if leanplum userAttributes doesn't have a community, it will render that community still but with notification turned off

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

under Settings it should only display list of communities that user subscribed before, looks like previous code is correct. Any reason we are changing this to be all communities?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I misunderstood the design, will change it back

@amyliu6
Copy link

amyliu6 commented Oct 31, 2022

hi @linxiao-li for subscribe from community page flow, if user subscribed before (provided email before), they should only see a toast message like this figma: https://www.figma.com/file/fMU3bTuuYqGeY9Wg0bK9S8/CAST%3A-User-Experience?node-id=3484%3A57677, From video looks like instead of toast, email form showed up with prefilled email address, could you help take a look?

count: 100,
initialLoading: false,
});
const displayCommunities = isLoadingUserCommunities
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

under Settings it should only display list of communities that user subscribed before, looks like previous code is correct. Any reason we are changing this to be all communities?

@linxiao-li
Copy link
Collaborator Author

@amyliu6 Got it, I misread the design. Just to double check, for the subscription flow I'm under the impression I only need to implement the functions for subscribe all communities and one community api call, the complete flow of subscription is going to be handled by this ticket?

@amyliu6
Copy link

amyliu6 commented Nov 1, 2022

@amyliu6 Got it, I misread the design. Just to double check, for the subscription flow I'm under the impression I only need to implement the functions for subscribe all communities and one community api call, the complete flow of subscription is going to be handled by this ticket?

hi @linxiao-li the plan is to have all API integration in one ticket(236) as discussed during planning, hence we updated 232 to be testing only to verify the E2E flow. Given Manny is on leave this week, could you help with sanity test for subscription flow too so that QA can start testing both subscription flow and settings flow later this sprint?

@linxiao-li
Copy link
Collaborator Author

linxiao-li commented Nov 2, 2022

@amyliu6 Updated the user flows for updating subscriptions

  1. sign up all notifications from community page for the first time
sign.up.all.from.community.page.mov
  1. update subscription from the proposal page
update.subscription.from.proposal.page.mov
  1. update subscription after voting
update.subscription.after.vote.mov
  1. error modal
error.modal.mov

};
});
await updateCommunity(communitySubIntentions);
await new Promise((r) => setTimeout(r, 500));
Copy link
Collaborator Author

@linxiao-li linxiao-li Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to throttle the api calls, allow the data to get registered with leanplum before calling it again to get the updated data

email,
}));
} catch {
throw new Error('cannot get user settings');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case getUserSettings error, will user see error modal when they land on Settings page?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not right now, if for any reason any of the user init functions failed (startLeanplum, setUserId, getUserSetting) we are only console logging the error. However, on the flow of updating subscriptions, getUserSetting error is caught and error modal shows up

Copy link

@amyliu6 amyliu6 Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see, if getUserSettings failed, we won't be able to get user data, how is the current flow look like when user visit Settings page? Is it possible to display the error modal for that case too?


/* @param: communitySubIntentions : [{communityId:"1", subscribeIntention:"subscribe"},{communityId:"2",subscribeIntention:"unsubscribe"}]
* @return: {communityId1:'True', communityId2:'False'}
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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.

3 participants