From 411a63f4a59e982ac2bdb53ceaf4f06327bbfea7 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 10 Jul 2023 15:20:12 +0100 Subject: [PATCH] Avoid trying to set room account data for pinned events as guest (#11216) --- src/components/views/right_panel/PinnedMessagesCard.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/right_panel/PinnedMessagesCard.tsx b/src/components/views/right_panel/PinnedMessagesCard.tsx index 1cd7ff0c4a..5c43d5e225 100644 --- a/src/components/views/right_panel/PinnedMessagesCard.tsx +++ b/src/components/views/right_panel/PinnedMessagesCard.tsx @@ -103,10 +103,11 @@ const PinnedMessagesCard: React.FC = ({ room, onClose, permalinkCreator const readPinnedEvents = useReadPinnedEvents(room); useEffect(() => { + if (!cli || cli.isGuest()) return; // nothing to do const newlyRead = pinnedEventIds.filter((id) => !readPinnedEvents.has(id)); if (newlyRead.length > 0) { // clear out any read pinned events which no longer are pinned - cli?.setRoomAccountData(room.roomId, ReadPinsEventId, { + cli.setRoomAccountData(room.roomId, ReadPinsEventId, { event_ids: pinnedEventIds, }); }