Skip to content

Instantly share code, notes, and snippets.

@andybalaam
andybalaam / element-web-my-receipts-thread-accumulator.js
Created July 14, 2023 12:21
Run this in the Element Web console to find all your read receipts in a given thread in a given room, according to the Sync Accumulator (i.e. in indexedDB)
roomId = "!jSkNtsjcsXfCRJwGpp:matrix.org";
threadId = "$SM8GzOBbWkuGBMw1HJvwB61j7iCmrHqaL5Jh914RPyo";
userId = mxMatrixClientPeg.get().getUserId();
dbreq = indexedDB.open("matrix-js-sdk:riot-web-sync");
dbreq.onsuccess = (e1 => {
const getreq = e1.target.result.transaction("sync").objectStore("sync").get(["-"]);
getreq.onsuccess = (e2) => {
const ephemeralEvents = e2.target.result.roomsData.join[roomId].ephemeral.events;
const receiptEvents = ephemeralEvents.filter(entry => entry.type === "m.receipt");
function mineOnly(ev) {
@andybalaam
andybalaam / element-web-my-receipts-accumulator.js
Last active July 14, 2023 12:15
Run this in the Element Web console to find all your read receipts in a given room, according to the Sync Accumulator (i.e. in indexedDB)
roomId = "!jSkNtsjcsXfCRJwGpp:matrix.org";
userId = mxMatrixClientPeg.get().getUserId();
dbreq = indexedDB.open("matrix-js-sdk:riot-web-sync");
dbreq.onsuccess = (e1 => {
const getreq = e1.target.result.transaction("sync").objectStore("sync").get(["-"]);
getreq.onsuccess = (e2) => {
const ephemeralEvents = e2.target.result.roomsData.join[roomId].ephemeral.events;
const receiptEvents = ephemeralEvents.filter(entry => entry.type === "m.receipt");
function mineOnly(ev) {
const ret = {};
@andybalaam
andybalaam / element-web-my-receipts-in-client.js
Last active July 14, 2023 12:15
Run this in the Element Web console to find all your read receipts in a given room, according to the MatrixClient (i.e. in memory)
roomId = "!jSkNtsjcsXfCRJwGpp:matrix.org";
userId = mxMatrixClientPeg.get().getUserId();
room = mxMatrixClientPeg.get().getRoom(roomId);
receipts = Array.from(room.receiptCacheByEventId.entries());
myReceipts = receipts.map(([event_id, value]) => [event_id, value.filter(v => v.userId === userId)]);
nonEmptyReceipts = myReceipts.filter(([_event_id, value]) => value.length > 0);
Object.fromEntries(nonEmptyReceipts);

Keybase proof

I hereby claim:

  • I am andybalaam on github.
  • I am andybalaam (https://keybase.io/andybalaam) on keybase.
  • I have a public key ASAhyjuB8L98ygGDiyQMuqOwAY-cMEeH-2jePJ6lJ0U5Lwo

To claim this, I am signing this object: