This commit is contained in:
Ajay Bura 2022-07-31 16:21:10 +05:30
parent 3f7ba56106
commit f99e79236e

View file

@ -143,10 +143,10 @@ class ImagePack {
function getGlobalImagePacks(mx) { function getGlobalImagePacks(mx) {
const globalContent = mx.getAccountData('im.ponies.emote_rooms')?.getContent(); const globalContent = mx.getAccountData('im.ponies.emote_rooms')?.getContent();
if (typeof globalContent !== 'object') return null; if (typeof globalContent !== 'object') return [];
const { rooms } = globalContent; const { rooms } = globalContent;
if (typeof rooms !== 'object') return null; if (typeof rooms !== 'object') return [];
const roomIds = Object.keys(rooms); const roomIds = Object.keys(rooms);
@ -206,7 +206,11 @@ function getRelevantPacks(mx, rooms) {
const globalPackIds = new Set(globalPacks.map((pack) => pack.id)); const globalPackIds = new Set(globalPacks.map((pack) => pack.id));
const roomsPack = rooms?.flatMap(getRoomImagePacks) ?? []; const roomsPack = rooms?.flatMap(getRoomImagePacks) ?? [];
return [].concat(userPack, globalPacks, roomsPack.filter((pack) => !globalPackIds.has(pack.id))); return [].concat(
userPack ?? [],
globalPacks,
roomsPack.filter((pack) => !globalPackIds.has(pack.id)),
);
} }
function getShortcodeToEmoji(room) { function getShortcodeToEmoji(room) {