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:
parent
3025690b08
commit
590540e887
@ -120,14 +120,15 @@ const MarkdownEditorInput = (props: Props): ReactElement => {
|
|||||||
const [editorState, setEditorState] = useState(() => generateEditorState(initialText))
|
const [editorState, setEditorState] = useState(() => generateEditorState(initialText))
|
||||||
|
|
||||||
const addUser = useCallback(async (userId: string, role: string) => {
|
const addUser = useCallback(async (userId: string, role: string) => {
|
||||||
const minimumRole = role || MemberRole.Viewer
|
const newRole = role || MemberRole.Viewer
|
||||||
const newMember = {
|
const newMember = {
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
userId,
|
userId,
|
||||||
roles: role,
|
roles: role,
|
||||||
schemeEditor: minimumRole === MemberRole.Editor,
|
schemeAdmin: newRole === MemberRole.Admin,
|
||||||
schemeCommenter: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter,
|
schemeEditor: newRole === MemberRole.Admin || MemberRole.Editor,
|
||||||
schemeViewer: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter || minimumRole === MemberRole.Viewer,
|
schemeCommenter: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter,
|
||||||
|
schemeViewer: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter || newRole === MemberRole.Viewer,
|
||||||
} as BoardMember
|
} as BoardMember
|
||||||
|
|
||||||
setConfirmAddUser(null)
|
setConfirmAddUser(null)
|
||||||
|
@ -110,14 +110,15 @@ const MultiPerson = (props: PropertyProps): JSX.Element => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addUser = useCallback(async (userId: string, role: string) => {
|
const addUser = useCallback(async (userId: string, role: string) => {
|
||||||
const minimumRole = role || MemberRole.Viewer
|
const newRole = role || MemberRole.Viewer
|
||||||
const newMember = {
|
const newMember = {
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
userId,
|
userId,
|
||||||
roles: role,
|
roles: role,
|
||||||
schemeEditor: minimumRole === MemberRole.Editor,
|
schemeAdmin: newRole === MemberRole.Admin,
|
||||||
schemeCommenter: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter,
|
schemeEditor: newRole === MemberRole.Admin || MemberRole.Editor,
|
||||||
schemeViewer: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter || minimumRole === MemberRole.Viewer,
|
schemeCommenter: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter,
|
||||||
|
schemeViewer: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter || newRole === MemberRole.Viewer,
|
||||||
} as BoardMember
|
} as BoardMember
|
||||||
|
|
||||||
setConfirmAddUser(null)
|
setConfirmAddUser(null)
|
||||||
|
@ -94,14 +94,15 @@ const Person = (props: PropertyProps): JSX.Element => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addUser = useCallback(async (userId: string, role: string) => {
|
const addUser = useCallback(async (userId: string, role: string) => {
|
||||||
const minimumRole = role || MemberRole.Viewer
|
const newRole = role || MemberRole.Viewer
|
||||||
const newMember = {
|
const newMember = {
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
userId,
|
userId,
|
||||||
roles: role,
|
roles: role,
|
||||||
schemeEditor: minimumRole === MemberRole.Editor,
|
schemeAdmin: newRole === MemberRole.Admin,
|
||||||
schemeCommenter: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter,
|
schemeEditor: newRole === MemberRole.Admin || MemberRole.Editor,
|
||||||
schemeViewer: minimumRole === MemberRole.Editor || minimumRole === MemberRole.Commenter || minimumRole === MemberRole.Viewer,
|
schemeCommenter: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter,
|
||||||
|
schemeViewer: newRole === MemberRole.Admin || MemberRole.Editor || newRole === MemberRole.Commenter || newRole === MemberRole.Viewer,
|
||||||
} as BoardMember
|
} as BoardMember
|
||||||
|
|
||||||
setConfirmAddUser(null)
|
setConfirmAddUser(null)
|
||||||
|
Loading…
Reference in New Issue
Block a user