set userid regardless of signin

This commit is contained in:
jessop 2020-10-20 18:20:11 -04:00 committed by Sean Yesmunt
parent fab03d337e
commit 51c94d334a
2 changed files with 6 additions and 3 deletions

View file

@ -130,6 +130,7 @@ function App(props: Props) {
const rawReferrerParam = urlParams.get('r');
const sanitizedReferrerParam = rawReferrerParam && rawReferrerParam.replace(':', '#');
const shouldHideNag = pathname.startsWith(`/$/${PAGES.EMBED}`) || pathname.startsWith(`/$/${PAGES.AUTH_VERIFY}`);
const userId = user && user.id;
let uri;
try {
@ -142,6 +143,11 @@ function App(props: Props) {
setShowAnalyticsNag(false);
}
// @endif
useEffect(() => {
if (userId) {
analytics.setUser(userId);
}
}, [userId]);
useEffect(() => {
if (!uploadCount) return;

View file

@ -529,11 +529,8 @@ export function doSignIn() {
return (dispatch, getState) => {
const state = getState();
const user = selectUser(state);
const userId = user.id;
const notificationsEnabled = user.experimental_ui;
analytics.setUser(userId);
if (notificationsEnabled) {
dispatch(doSocketConnect());
dispatch(doNotificationList());