mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Rename RVS state (event -> initialEvent) and redocument
This commit is contained in:
parent
1792fa45f4
commit
000a045e35
2 changed files with 29 additions and 27 deletions
|
@ -165,14 +165,14 @@ module.exports = React.createClass({
|
|||
roomLoading: RoomViewStore.isRoomLoading(),
|
||||
roomLoadError: RoomViewStore.getRoomLoadError(),
|
||||
joining: RoomViewStore.isJoining(),
|
||||
eventId: RoomViewStore.getEventId(),
|
||||
eventPixelOffset: RoomViewStore.getEventPixelOffset(),
|
||||
isEventHighlighted: RoomViewStore.isEventHighlighted(),
|
||||
initialEventId: RoomViewStore.getInitialEventId(),
|
||||
initialEventPixelOffset: RoomViewStore.getInitialEventPixelOffset(),
|
||||
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
|
||||
};
|
||||
|
||||
// Clear the search results when clicking a search result (which changes the
|
||||
// currently scrolled to event, this.state.eventId).
|
||||
if (this.state.eventId !== newState.eventId) {
|
||||
// currently scrolled to event, this.state.initialEventId).
|
||||
if (this.state.initialEventId !== newState.initialEventId) {
|
||||
newState.searchResults = null;
|
||||
}
|
||||
|
||||
|
@ -1665,12 +1665,12 @@ module.exports = React.createClass({
|
|||
hideMessagePanel = true;
|
||||
}
|
||||
|
||||
const shouldHighlight = this.state.isEventHighlighted;
|
||||
const shouldHighlight = this.state.isInitialEventHighlighted;
|
||||
let highlightedEventId = null;
|
||||
if (this.state.forwardingEvent) {
|
||||
highlightedEventId = this.state.forwardingEvent.getId();
|
||||
} else if (shouldHighlight) {
|
||||
highlightedEventId = this.state.eventId;
|
||||
highlightedEventId = this.state.initialEventId;
|
||||
}
|
||||
|
||||
// console.log("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
|
||||
|
@ -1681,8 +1681,8 @@ module.exports = React.createClass({
|
|||
manageReadMarkers={true}
|
||||
hidden={hideMessagePanel}
|
||||
highlightedEventId={highlightedEventId}
|
||||
eventId={this.state.eventId}
|
||||
eventPixelOffset={this.state.eventPixelOffset}
|
||||
eventId={this.state.initialEventId}
|
||||
eventPixelOffset={this.state.initialEventPixelOffset}
|
||||
onScroll={ this.onMessageListScroll }
|
||||
onReadMarkerUpdated={ this._updateTopUnreadMessagesBar }
|
||||
showUrlPreview = { this.state.showUrlPreview }
|
||||
|
|
|
@ -27,12 +27,14 @@ const INITIAL_STATE = {
|
|||
joinError: null,
|
||||
// The room ID of the room
|
||||
roomId: null,
|
||||
// The event being viewed
|
||||
eventId: null,
|
||||
// The offset to display the event at (see scrollStateMap)
|
||||
eventPixelOffset: null,
|
||||
// Whether to highlight the event
|
||||
isEventHighlighted: false,
|
||||
|
||||
// The event to scroll to initially
|
||||
initialEventId: null,
|
||||
// The offset to display the initial event at (see scrollStateMap)
|
||||
initialEventPixelOffset: null,
|
||||
// Whether to highlight the initial event
|
||||
isInitialEventHighlighted: false,
|
||||
|
||||
// The room alias of the room (or null if not originally specified in view_room)
|
||||
roomAlias: null,
|
||||
// Whether the current room is loading
|
||||
|
@ -131,9 +133,9 @@ class RoomViewStore extends Store {
|
|||
|
||||
this._setState({
|
||||
roomId: payload.room_id,
|
||||
eventId: payload.event_id,
|
||||
eventPixelOffset: payload.event_offset,
|
||||
isEventHighlighted: payload.highlighted,
|
||||
initialEventId: payload.event_id,
|
||||
initialEventPixelOffset: payload.event_offset,
|
||||
isInitialEventHighlighted: payload.highlighted,
|
||||
roomLoading: false,
|
||||
roomLoadError: null,
|
||||
});
|
||||
|
@ -141,9 +143,9 @@ class RoomViewStore extends Store {
|
|||
// Resolve the alias and then do a second dispatch with the room ID acquired
|
||||
this._setState({
|
||||
roomId: null,
|
||||
eventId: null,
|
||||
eventPixelOffset: null,
|
||||
isEventHighlighted: null,
|
||||
initialEventId: null,
|
||||
initialEventPixelOffset: null,
|
||||
isInitialEventHighlighted: null,
|
||||
roomAlias: payload.room_alias,
|
||||
roomLoading: true,
|
||||
roomLoadError: null,
|
||||
|
@ -229,16 +231,16 @@ class RoomViewStore extends Store {
|
|||
return this._state.roomId;
|
||||
}
|
||||
|
||||
getEventId() {
|
||||
return this._state.eventId;
|
||||
getInitialEventId() {
|
||||
return this._state.initialEventId;
|
||||
}
|
||||
|
||||
getEventPixelOffset() {
|
||||
return this._state.eventPixelOffset;
|
||||
getInitialEventPixelOffset() {
|
||||
return this._state.initialEventPixelOffset;
|
||||
}
|
||||
|
||||
isEventHighlighted() {
|
||||
return this._state.isEventHighlighted;
|
||||
isInitialEventHighlighted() {
|
||||
return this._state.isInitialEventHighlighted;
|
||||
}
|
||||
|
||||
getRoomAlias() {
|
||||
|
|
Loading…
Reference in a new issue