1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-08 15:06:08 +02:00

add setting admin role when add member (#3961)

* add setting admin role when add member

* change variable name
This commit is contained in:
Scott Bishel 2022-10-07 07:07:00 -06:00 committed by GitHub
parent 3025690b08
commit 590540e887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)