From 590540e88791f1c6acc655fcf3459cd00e3ab455 Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Fri, 7 Oct 2022 07:07:00 -0600 Subject: [PATCH] add setting admin role when add member (#3961) * add setting admin role when add member * change variable name --- .../markdownEditorInput/markdownEditorInput.tsx | 9 +++++---- webapp/src/properties/multiperson/multiperson.tsx | 9 +++++---- webapp/src/properties/person/person.tsx | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/webapp/src/components/markdownEditorInput/markdownEditorInput.tsx b/webapp/src/components/markdownEditorInput/markdownEditorInput.tsx index ad6853162..34a130663 100644 --- a/webapp/src/components/markdownEditorInput/markdownEditorInput.tsx +++ b/webapp/src/components/markdownEditorInput/markdownEditorInput.tsx @@ -120,14 +120,15 @@ const MarkdownEditorInput = (props: Props): ReactElement => { const [editorState, setEditorState] = useState(() => generateEditorState(initialText)) const addUser = useCallback(async (userId: string, role: string) => { - const minimumRole = role || MemberRole.Viewer + const newRole = role || MemberRole.Viewer const newMember = { boardId: board.id, userId, roles: role, - schemeEditor: minimumRole === MemberRole.Editor, - schemeCommenter: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter, - schemeViewer: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter || minimumRole === MemberRole.Viewer, + schemeAdmin: newRole === MemberRole.Admin, + schemeEditor: newRole === MemberRole.Admin || MemberRole.Editor, + schemeCommenter: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter, + schemeViewer: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter || newRole === MemberRole.Viewer, } as BoardMember setConfirmAddUser(null) diff --git a/webapp/src/properties/multiperson/multiperson.tsx b/webapp/src/properties/multiperson/multiperson.tsx index 4534007d7..4f26f92a3 100644 --- a/webapp/src/properties/multiperson/multiperson.tsx +++ b/webapp/src/properties/multiperson/multiperson.tsx @@ -110,14 +110,15 @@ const MultiPerson = (props: PropertyProps): JSX.Element => { } const addUser = useCallback(async (userId: string, role: string) => { - const minimumRole = role || MemberRole.Viewer + const newRole = role || MemberRole.Viewer const newMember = { boardId: board.id, userId, roles: role, - schemeEditor: minimumRole === MemberRole.Editor, - schemeCommenter: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter, - schemeViewer: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter || minimumRole === MemberRole.Viewer, + schemeAdmin: newRole === MemberRole.Admin, + schemeEditor: newRole === MemberRole.Admin || MemberRole.Editor, + schemeCommenter: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter, + schemeViewer: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter || newRole === MemberRole.Viewer, } as BoardMember setConfirmAddUser(null) diff --git a/webapp/src/properties/person/person.tsx b/webapp/src/properties/person/person.tsx index 508a9546f..6638edf8f 100644 --- a/webapp/src/properties/person/person.tsx +++ b/webapp/src/properties/person/person.tsx @@ -94,14 +94,15 @@ const Person = (props: PropertyProps): JSX.Element => { } const addUser = useCallback(async (userId: string, role: string) => { - const minimumRole = role || MemberRole.Viewer + const newRole = role || MemberRole.Viewer const newMember = { boardId: board.id, userId, roles: role, - schemeEditor: minimumRole === MemberRole.Editor, - schemeCommenter: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter, - schemeViewer: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter || minimumRole === MemberRole.Viewer, + schemeAdmin: newRole === MemberRole.Admin, + schemeEditor: newRole === MemberRole.Admin || MemberRole.Editor, + schemeCommenter: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter, + schemeViewer: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter || newRole === MemberRole.Viewer, } as BoardMember setConfirmAddUser(null)