Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Use 2545's terminology instead of ponies.im's
Browse files Browse the repository at this point in the history
  • Loading branch information
ckiee committed Jun 26, 2022
1 parent 4226b8e commit 6c07ae5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/views/rooms/MSC2545StickerPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import ScrollPanel from '../../structures/ScrollPanel';
import GenericElementContextMenu from '../context_menus/GenericElementContextMenu';
import Search from '../emojipicker/Search';

const EMOTE_ROOMS_EVENT_TYPE = "im.ponies.emote_rooms";
const ROOM_EMOTES_EVENT_TYPE = "im.ponies.room_emotes";
// TODO: support more image sources:
// /~https://github.com/Sorunome/matrix-doc/blob/soru/emotes/proposals/2545-emotes.md#image-sources
const USER_PACK_ROOMS_EVENT_TYPE = "im.ponies.emote_rooms";
const PACK_ROOM_EVENT_TYPE = "im.ponies.room_emotes";

// Css Class; it's a short name for easy usage.
const cc = (thing: string) => "mx_2545Stickers_" + thing;
Expand Down Expand Up @@ -88,15 +90,15 @@ export const MSC2545StickerPicker: React.FC<{
const [searchFilter, setSearchFilter] = useState("");
if (!isStickerPickerOpen) return null;

const evt = cli.getAccountData(EMOTE_ROOMS_EVENT_TYPE);
const evt = cli.getAccountData(USER_PACK_ROOMS_EVENT_TYPE);
const evtContent = evt.event.content as { rooms: { [roomId: string]: { [packName: string]: {} } } };

const packs = Object.keys(evtContent.rooms)
.map(roomId => {
const room = cli.getRoom(roomId);
return Object.keys(evtContent.rooms[roomId])
.map(name => {
const pack = room.currentState.getStateEvents(ROOM_EMOTES_EVENT_TYPE, name)
const pack = room.currentState.getStateEvents(PACK_ROOM_EVENT_TYPE, name)
.event.content as I2545Pack;
return { room, pack, packName: name };
});
Expand Down

0 comments on commit 6c07ae5

Please sign in to comment.