Avoid trying to set room account data for pinned events as guest (#11216)

pull/28788/head^2
Michael Telatynski 2023-07-10 15:20:12 +01:00 committed by GitHub
parent 05c2ee0767
commit 411a63f4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -103,10 +103,11 @@ const PinnedMessagesCard: React.FC<IProps> = ({ 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,
});
}