소스 검색

Bugfix dont highlight wrong user mentions

Carsten Porth 5 년 전
부모
커밋
2f374cfa85
1개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 7
      app/src/components/tweet-body/tweet-body.ts

+ 9 - 7
app/src/components/tweet-body/tweet-body.ts

@@ -132,13 +132,15 @@ export class TweetBodyComponent {
         el =>
           el.screen_name.toLowerCase() === element["screenName"].toLowerCase()
       )[0];
-      res.push({
-        start: element.indices[0],
-        stop: element.indices[1],
-        type: "user_mention",
-        text: "@" + element["screenName"],
-        userId: apiEntity["id_str"] || ""
-      });
+      if (apiEntity) {
+        res.push({
+          start: element.indices[0],
+          stop: element.indices[1],
+          type: "user_mention",
+          text: "@" + element["screenName"],
+          userId: apiEntity["id_str"]
+        });
+      }
     });
     return res;
   }