fix detecting e2e message in timeline

This commit is contained in:
Bruno Windels 2019-04-02 15:12:51 +02:00
parent 9ab1692544
commit 28bba4952b

View file

@ -117,11 +117,13 @@ function getLastEventTile(session) {
} }
function getAllEventTiles(session) { function getAllEventTiles(session) {
return session.queryAll(".mx_RoomView_MessageList > *"); return session.queryAll(".mx_RoomView_MessageList .mx_EventTile");
} }
async function getMessageFromEventTile(eventTile) { async function getMessageFromEventTile(eventTile) {
const senderElement = await eventTile.$(".mx_SenderProfile_name"); const senderElement = await eventTile.$(".mx_SenderProfile_name");
const className = await (await eventTile.getProperty("className")).jsonValue();
const classNames = className.split(" ");
const bodyElement = await eventTile.$(".mx_EventTile_body"); const bodyElement = await eventTile.$(".mx_EventTile_body");
let sender = null; let sender = null;
if (senderElement) { if (senderElement) {
@ -131,11 +133,10 @@ async function getMessageFromEventTile(eventTile) {
return null; return null;
} }
const body = await(await bodyElement.getProperty("innerText")).jsonValue(); const body = await(await bodyElement.getProperty("innerText")).jsonValue();
const e2eIcon = await eventTile.$(".mx_EventTile_e2eIcon");
return { return {
sender, sender,
body, body,
encrypted: !!e2eIcon encrypted: classNames.includes("mx_EventTile_verified")
}; };
} }