make forward_message be friendly with the RVS stuffs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
6a2c2d64fa
commit
7b4cd31124
4 changed files with 53 additions and 35 deletions
|
@ -55,6 +55,8 @@ const INITIAL_STATE = {
|
|||
// pixelOffset: the number of pixels the window is scrolled down
|
||||
// from the focussedEvent.
|
||||
scrollStateMap: {},
|
||||
|
||||
forwardingEvent: null,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -116,6 +118,11 @@ class RoomViewStore extends Store {
|
|||
case 'update_scroll_state':
|
||||
this._updateScrollState(payload);
|
||||
break;
|
||||
case 'forward_event':
|
||||
this._setState({
|
||||
forwardingEvent: payload.event,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +134,7 @@ class RoomViewStore extends Store {
|
|||
initialEventId: payload.event_id,
|
||||
initialEventPixelOffset: undefined,
|
||||
isInitialEventHighlighted: payload.highlighted,
|
||||
forwardingEvent: null,
|
||||
roomLoading: false,
|
||||
roomLoadError: null,
|
||||
};
|
||||
|
@ -141,6 +149,14 @@ class RoomViewStore extends Store {
|
|||
}
|
||||
}
|
||||
|
||||
if (this._state.forwardingEvent) {
|
||||
dis.dispatch({
|
||||
action: 'send_event',
|
||||
room_id: newState.roomId,
|
||||
event: this._state.forwardingEvent,
|
||||
});
|
||||
}
|
||||
|
||||
this._setState(newState);
|
||||
} else if (payload.room_alias) {
|
||||
// Resolve the alias and then do a second dispatch with the room ID acquired
|
||||
|
@ -276,6 +292,11 @@ class RoomViewStore extends Store {
|
|||
getJoinError() {
|
||||
return this._state.joinError;
|
||||
}
|
||||
|
||||
// The mxEvent if one is about to be forwarded
|
||||
getForwardingEvent() {
|
||||
return this._state.forwardingEvent;
|
||||
}
|
||||
}
|
||||
|
||||
let singletonRoomViewStore = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue