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(),
|
roomLoading: RoomViewStore.isRoomLoading(),
|
||||||
roomLoadError: RoomViewStore.getRoomLoadError(),
|
roomLoadError: RoomViewStore.getRoomLoadError(),
|
||||||
joining: RoomViewStore.isJoining(),
|
joining: RoomViewStore.isJoining(),
|
||||||
eventId: RoomViewStore.getEventId(),
|
initialEventId: RoomViewStore.getInitialEventId(),
|
||||||
eventPixelOffset: RoomViewStore.getEventPixelOffset(),
|
initialEventPixelOffset: RoomViewStore.getInitialEventPixelOffset(),
|
||||||
isEventHighlighted: RoomViewStore.isEventHighlighted(),
|
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Clear the search results when clicking a search result (which changes the
|
// Clear the search results when clicking a search result (which changes the
|
||||||
// currently scrolled to event, this.state.eventId).
|
// currently scrolled to event, this.state.initialEventId).
|
||||||
if (this.state.eventId !== newState.eventId) {
|
if (this.state.initialEventId !== newState.initialEventId) {
|
||||||
newState.searchResults = null;
|
newState.searchResults = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1665,12 +1665,12 @@ module.exports = React.createClass({
|
||||||
hideMessagePanel = true;
|
hideMessagePanel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldHighlight = this.state.isEventHighlighted;
|
const shouldHighlight = this.state.isInitialEventHighlighted;
|
||||||
let highlightedEventId = null;
|
let highlightedEventId = null;
|
||||||
if (this.state.forwardingEvent) {
|
if (this.state.forwardingEvent) {
|
||||||
highlightedEventId = this.state.forwardingEvent.getId();
|
highlightedEventId = this.state.forwardingEvent.getId();
|
||||||
} else if (shouldHighlight) {
|
} 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);
|
// console.log("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
|
||||||
|
@ -1681,8 +1681,8 @@ module.exports = React.createClass({
|
||||||
manageReadMarkers={true}
|
manageReadMarkers={true}
|
||||||
hidden={hideMessagePanel}
|
hidden={hideMessagePanel}
|
||||||
highlightedEventId={highlightedEventId}
|
highlightedEventId={highlightedEventId}
|
||||||
eventId={this.state.eventId}
|
eventId={this.state.initialEventId}
|
||||||
eventPixelOffset={this.state.eventPixelOffset}
|
eventPixelOffset={this.state.initialEventPixelOffset}
|
||||||
onScroll={ this.onMessageListScroll }
|
onScroll={ this.onMessageListScroll }
|
||||||
onReadMarkerUpdated={ this._updateTopUnreadMessagesBar }
|
onReadMarkerUpdated={ this._updateTopUnreadMessagesBar }
|
||||||
showUrlPreview = { this.state.showUrlPreview }
|
showUrlPreview = { this.state.showUrlPreview }
|
||||||
|
|
|
@ -27,12 +27,14 @@ const INITIAL_STATE = {
|
||||||
joinError: null,
|
joinError: null,
|
||||||
// The room ID of the room
|
// The room ID of the room
|
||||||
roomId: null,
|
roomId: null,
|
||||||
// The event being viewed
|
|
||||||
eventId: null,
|
// The event to scroll to initially
|
||||||
// The offset to display the event at (see scrollStateMap)
|
initialEventId: null,
|
||||||
eventPixelOffset: null,
|
// The offset to display the initial event at (see scrollStateMap)
|
||||||
// Whether to highlight the event
|
initialEventPixelOffset: null,
|
||||||
isEventHighlighted: false,
|
// Whether to highlight the initial event
|
||||||
|
isInitialEventHighlighted: false,
|
||||||
|
|
||||||
// The room alias of the room (or null if not originally specified in view_room)
|
// The room alias of the room (or null if not originally specified in view_room)
|
||||||
roomAlias: null,
|
roomAlias: null,
|
||||||
// Whether the current room is loading
|
// Whether the current room is loading
|
||||||
|
@ -131,9 +133,9 @@ class RoomViewStore extends Store {
|
||||||
|
|
||||||
this._setState({
|
this._setState({
|
||||||
roomId: payload.room_id,
|
roomId: payload.room_id,
|
||||||
eventId: payload.event_id,
|
initialEventId: payload.event_id,
|
||||||
eventPixelOffset: payload.event_offset,
|
initialEventPixelOffset: payload.event_offset,
|
||||||
isEventHighlighted: payload.highlighted,
|
isInitialEventHighlighted: payload.highlighted,
|
||||||
roomLoading: false,
|
roomLoading: false,
|
||||||
roomLoadError: null,
|
roomLoadError: null,
|
||||||
});
|
});
|
||||||
|
@ -141,9 +143,9 @@ class RoomViewStore extends Store {
|
||||||
// Resolve the alias and then do a second dispatch with the room ID acquired
|
// Resolve the alias and then do a second dispatch with the room ID acquired
|
||||||
this._setState({
|
this._setState({
|
||||||
roomId: null,
|
roomId: null,
|
||||||
eventId: null,
|
initialEventId: null,
|
||||||
eventPixelOffset: null,
|
initialEventPixelOffset: null,
|
||||||
isEventHighlighted: null,
|
isInitialEventHighlighted: null,
|
||||||
roomAlias: payload.room_alias,
|
roomAlias: payload.room_alias,
|
||||||
roomLoading: true,
|
roomLoading: true,
|
||||||
roomLoadError: null,
|
roomLoadError: null,
|
||||||
|
@ -229,16 +231,16 @@ class RoomViewStore extends Store {
|
||||||
return this._state.roomId;
|
return this._state.roomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventId() {
|
getInitialEventId() {
|
||||||
return this._state.eventId;
|
return this._state.initialEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventPixelOffset() {
|
getInitialEventPixelOffset() {
|
||||||
return this._state.eventPixelOffset;
|
return this._state.initialEventPixelOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
isEventHighlighted() {
|
isInitialEventHighlighted() {
|
||||||
return this._state.isEventHighlighted;
|
return this._state.isInitialEventHighlighted;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRoomAlias() {
|
getRoomAlias() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue