1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-21 13:38:56 +02:00

fix: don't search users for @-mentions as a guest

This commit is contained in:
Paul Esch-Laurent 2022-08-30 11:55:46 -05:00
parent b7ead8a7e0
commit 448df85ed8

View File

@ -16,7 +16,7 @@ import {debounce} from "lodash"
import {useAppSelector} from '../../store/hooks' import {useAppSelector} from '../../store/hooks'
import {IUser} from '../../user' import {IUser} from '../../user'
import {getBoardUsersList} from '../../store/users' import {getBoardUsersList, getMe} from '../../store/users'
import createLiveMarkdownPlugin from '../live-markdown-plugin/liveMarkdownPlugin' import createLiveMarkdownPlugin from '../live-markdown-plugin/liveMarkdownPlugin'
import './markdownEditorInput.scss' import './markdownEditorInput.scss'
@ -56,13 +56,14 @@ const MarkdownEditorInput = (props: Props): ReactElement => {
const board = useAppSelector(getCurrentBoard) const board = useAppSelector(getCurrentBoard)
const clientConfig = useAppSelector<ClientConfig>(getClientConfig) const clientConfig = useAppSelector<ClientConfig>(getClientConfig)
const ref = useRef<Editor>(null) const ref = useRef<Editor>(null)
const me = useAppSelector<IUser|null>(getMe)
const [suggestions, setSuggestions] = useState<Array<MentionUser>>([]) const [suggestions, setSuggestions] = useState<Array<MentionUser>>([])
const loadSuggestions = async (term: string) => { const loadSuggestions = async (term: string) => {
let users: Array<IUser> let users: Array<IUser>
if (board && board.type === BoardTypeOpen) { if (!me?.is_guest && (board && board.type === BoardTypeOpen)) {
users = await octoClient.searchTeamUsers(term) users = await octoClient.searchTeamUsers(term)
} else { } else {
users = boardUsers users = boardUsers