Avoid trying to set room account data for pinned events as guest (#11216)
parent
05c2ee0767
commit
411a63f4a5
|
@ -103,10 +103,11 @@ const PinnedMessagesCard: React.FC<IProps> = ({ room, onClose, permalinkCreator
|
||||||
const readPinnedEvents = useReadPinnedEvents(room);
|
const readPinnedEvents = useReadPinnedEvents(room);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!cli || cli.isGuest()) return; // nothing to do
|
||||||
const newlyRead = pinnedEventIds.filter((id) => !readPinnedEvents.has(id));
|
const newlyRead = pinnedEventIds.filter((id) => !readPinnedEvents.has(id));
|
||||||
if (newlyRead.length > 0) {
|
if (newlyRead.length > 0) {
|
||||||
// clear out any read pinned events which no longer are pinned
|
// clear out any read pinned events which no longer are pinned
|
||||||
cli?.setRoomAccountData(room.roomId, ReadPinsEventId, {
|
cli.setRoomAccountData(room.roomId, ReadPinsEventId, {
|
||||||
event_ids: pinnedEventIds,
|
event_ids: pinnedEventIds,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue