diff --git a/src/components/views/rooms/PinnedEventsPanel.js b/src/components/views/rooms/PinnedEventsPanel.js index 5a99d9ab2d..ddadc30258 100644 --- a/src/components/views/rooms/PinnedEventsPanel.js +++ b/src/components/views/rooms/PinnedEventsPanel.js @@ -79,21 +79,22 @@ module.exports = React.createClass({ const pinnedEvents = this.props.room.currentState.getStateEvents("m.room.pinned_events", ""); if (!pinnedEvents) return; // nothing to read - let lastReadEvent = null; + let readStateEvents = null; const readPinsEvent = this.props.room.getAccountData("im.vector.room.read_pins"); - if (readPinsEvent) { - lastReadEvent = readPinsEvent.getContent().last_read_id; + if (readPinsEvent && readPinsEvent.getContent()) { + readStateEvents = readPinsEvent.getContent().event_ids || []; } - if (lastReadEvent !== pinnedEvents.getId()) { + if (!readStateEvents.includes(pinnedEvents.getId())) { + readStateEvents.push(pinnedEvents.getId()); MatrixClientPeg.get().setRoomAccountData(this.props.room.roomId, "im.vector.room.read_pins", { - last_read_id: pinnedEvents.getId(), + event_ids: readStateEvents, }); } }, _getPinnedTiles: function() { - if (this.state.pinned.length == 0) { + if (this.state.pinned.length === 0) { return (
{ _t("No pinned messages.") }
); } diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js index ea5748db60..2a06a90391 100644 --- a/src/components/views/rooms/RoomHeader.js +++ b/src/components/views/rooms/RoomHeader.js @@ -157,9 +157,9 @@ module.exports = React.createClass({ const readPinsEvent = this.props.room.getAccountData("im.vector.room.read_pins"); if (readPinsEvent) { - const lastReadEvent = readPinsEvent.getContent().last_read_id; - if (lastReadEvent) { - return currentPinEvent.getId() !== lastReadEvent; + const readStateEvents = readPinsEvent.getContent().event_ids; + if (readStateEvents) { + return !readStateEvents.includes(currentPinEvent.getId()); } }