Skip to content

Commit 88265ed

Browse files
author
Ives van Hoorne
committed
Change current module when you start following
1 parent 0fd53ae commit 88265ed

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/app/src/app/store/modules/live/actions.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,18 @@ export function getModuleIdFromShortid({ props, state }) {
517517

518518
return {};
519519
}
520+
521+
export function getCurrentModuleIdOfUser({ props, state }) {
522+
const userId = props.userId;
523+
const usersMetadata = state.get('live.roomInfo.usersMetadata');
524+
525+
const user = usersMetadata.get(userId);
526+
527+
if (user) {
528+
return {
529+
moduleShortid: user.currentModuleShortid,
530+
};
531+
}
532+
533+
return {};
534+
}

packages/app/src/app/store/modules/live/sequences.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,12 @@ export const setChatEnabled = [
396396
},
397397
];
398398

399-
export const setFollowing = [set(state`live.followingUserId`, props`userId`)];
399+
export const setFollowing = [
400+
set(state`live.followingUserId`, props`userId`),
401+
actions.getCurrentModuleIdOfUser,
402+
when(props`moduleShortid`),
403+
{
404+
true: [actions.getModuleIdFromShortid, changeCurrentModule],
405+
false: [],
406+
},
407+
];

0 commit comments

Comments
 (0)