瀏覽代碼

Make suggestor ignore users without valid names

Otherwise it might have undefined issues.
Resolves https://git.pleroma.social/pleroma/pleroma-fe/-/issues/1249
tusooa 1 年之前
父節點
當前提交
88db557141
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/components/emoji_input/suggestor.js

+ 3 - 2
src/components/emoji_input/suggestor.js

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