From 68936a1311c189bbe5ac41e38986cceee072ddfb Mon Sep 17 00:00:00 2001 From: Christian Paul Date: Thu, 16 Apr 2020 12:10:27 +0200 Subject: [PATCH] Use new String.prototype functions instead of .indexOf() --- src/BridgedRoom.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BridgedRoom.ts b/src/BridgedRoom.ts index 2c64c985b..8366f332d 100644 --- a/src/BridgedRoom.ts +++ b/src/BridgedRoom.ts @@ -400,7 +400,7 @@ export class BridgedRoom { const avatarUrl = user.getAvatarUrlForRoom(message.room_id); - if (avatarUrl && avatarUrl.indexOf("mxc://") === 0) { + if (avatarUrl && avatarUrl.startsWith("mxc://")) { body.icon_url = this.main.getUrlForMxc(avatarUrl); } @@ -866,7 +866,7 @@ export class BridgedRoom { if (event.content.format === "org.matrix.custom.html" && event.content.formatted_body) { const formattedBody = event.content.formatted_body; - if (formattedBody.startsWith("") && formattedBody.indexOf("") !== -1) { + if (formattedBody.startsWith("") && formattedBody.includes("")) { const parts = formattedBody.split(""); realHtml = parts[1]; event.content.formatted_body = realHtml.trim();