Skip to content

Commit 1f66bc3

Browse files
author
Ives van Hoorne
committed
Use ownerId for finding owner
1 parent 53adb76 commit 1f66bc3

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Live/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Live = ({ signals, store }) => (
1919
removeEditor={signals.live.onRemoveEditorClicked}
2020
isOwner={store.live.isOwner}
2121
roomInfo={store.live.roomInfo}
22-
ownerId={store.editor.currentSandbox.author.id}
22+
ownerId={store.live.roomInfo.ownerId}
2323
currentUserId={store.user.id}
2424
reconnecting={store.live.reconnecting}
2525
/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export function initializeLiveState({ props, state }) {
3434
state.set('live.roomInfo', {
3535
connectionCount: 1,
3636
roomId: props.roomId,
37+
ownerId: props.ownerId,
3738
sandboxId: props.sandboxId,
3839
editorIds: props.editorIds,
3940
mode: props.mode,
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { getParent } from 'mobx-state-tree';
22

33
export function isEditor(userId) {
4-
const sandbox = getParent(this).editor.currentSandbox;
5-
64
return (
75
this.isLive &&
86
(this.roomInfo.mode === 'open' ||
9-
sandbox.author.id === userId ||
7+
this.roomInfo.ownerId === userId ||
108
this.roomInfo.editorIds.indexOf(userId) > 0)
119
);
1210
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default {
2727
types.model({
2828
startTime: types.maybe(types.number),
2929
connectionCount: types.number,
30+
ownerId: types.string,
3031
roomId: types.string,
3132
mode: types.string,
3233
sandboxId: types.string,

packages/app/src/app/store/modules/workspace/items.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export default function getItems(store) {
3434
!(
3535
store.live.isOwner ||
3636
(store.user &&
37-
store.currentSandbox &&
38-
store.currentSandbox.author &&
39-
store.currentSandbox.author.id === store.user.id)
37+
store.live &&
38+
store.live.roomInfo &&
39+
store.live.roomInfo.ownerId === store.user.id)
4040
)
4141
) {
4242
return [FILES, LIVE];

0 commit comments

Comments
 (0)