Browse Source

Bugfix dont highlight wrong user mentions

Carsten Porth 5 years ago
parent
commit
2f374cfa85
1 changed files with 9 additions and 7 deletions
  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;
   }