Skip to content

Commit 37ceb82

Browse files
committed
Fix collaborator permissions
1 parent 00b0dad commit 37ceb82

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

packages/app/src/app/pages/Sandbox/Editor/Header/Collaborators/Collaborator.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import css from '@styled-system/css';
77
import { Authorization } from 'app/graphql/types';
88
import { useOvermind } from 'app/overmind';
99
import { formatDistanceToNow } from 'date-fns';
10-
import React, { ChangeEvent } from 'react';
10+
import React from 'react';
1111

1212
import { Mail, WarningIcon } from './icons';
1313
import { PermissionSelect } from './PermissionSelect';
@@ -21,9 +21,7 @@ interface ICollaboratorItemProps {
2121
subtext?: string;
2222
avatarUrl?: string;
2323
avatarComponent?: JSX.Element | null;
24-
onChange?: (
25-
event: ChangeEvent<HTMLSelectElement> & ChangeEvent<HTMLInputElement>
26-
) => void;
24+
onChange?: (value: string) => void;
2725
fillAvatar?: boolean;
2826
permissionText?: string;
2927
readOnly?: boolean;
@@ -135,8 +133,8 @@ export const Collaborator = ({
135133
}: ICollaboratorProps) => {
136134
const { actions, state } = useOvermind();
137135

138-
const updateAuthorization = (event: React.ChangeEvent<HTMLSelectElement>) => {
139-
if (event.target.value === 'remove') {
136+
const updateAuthorization = (value: string) => {
137+
if (value === 'remove') {
140138
actions.editor.removeCollaborator({
141139
username,
142140
sandboxId: state.editor.currentSandbox.id,
@@ -145,7 +143,7 @@ export const Collaborator = ({
145143
actions.editor.changeCollaboratorAuthorization({
146144
username,
147145
sandboxId: state.editor.currentSandbox.id,
148-
authorization: event.target.value as Authorization,
146+
authorization: value as Authorization,
149147
});
150148
}
151149
};
@@ -181,9 +179,9 @@ interface IInvitationProps {
181179
export const Invitation = ({ id, email, authorization }: IInvitationProps) => {
182180
const { actions, state } = useOvermind();
183181

184-
const updateAuthorization = (event: React.ChangeEvent<HTMLSelectElement>) => {
182+
const updateAuthorization = (value: string) => {
185183
// We have to do something here
186-
if (event.target.value === 'remove') {
184+
if (value === 'remove') {
187185
actions.editor.revokeSandboxInvitation({
188186
invitationId: id,
189187
sandboxId: state.editor.currentSandbox.id,
@@ -192,7 +190,7 @@ export const Invitation = ({ id, email, authorization }: IInvitationProps) => {
192190
actions.editor.changeInvitationAuthorization({
193191
invitationId: id,
194192
sandboxId: state.editor.currentSandbox.id,
195-
authorization: event.target.value as Authorization,
193+
authorization: value as Authorization,
196194
});
197195
}
198196
};

packages/app/src/app/pages/Sandbox/Editor/Header/Collaborators/PermissionSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface IPermissionSelectProps {
1919
permissions?: Authorization[];
2020
pretext?: string;
2121
value: Authorization;
22-
onChange: (Authorization) => void;
22+
onChange: (value: string) => void;
2323
disabled?: boolean;
2424
}
2525

0 commit comments

Comments
 (0)