Make suggestor ignore users without valid names

Otherwise it might have undefined issues.
Resolves https://git.pleroma.social/pleroma/pleroma-fe/-/issues/1249
This commit is contained in:
tusooa 2023-03-02 23:47:55 -05:00
parent 830085b3e4
commit 88db557141
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
1 changed files with 3 additions and 2 deletions

View File

@ -94,8 +94,9 @@ export const suggestUsers = ({ dispatch, state }) => {
const newSuggestions = state.users.users.filter(
user =>
user.screen_name.toLowerCase().startsWith(noPrefix) ||
user.name.toLowerCase().startsWith(noPrefix)
user.screen_name && user.name && (
user.screen_name.toLowerCase().startsWith(noPrefix) ||
user.name.toLowerCase().startsWith(noPrefix))
).slice(0, 20).sort((a, b) => {
let aScore = 0
let bScore = 0