Fix regression around replying to search results (#8035)
This commit is contained in:
parent
1eb67047c9
commit
ceb2281d36
2 changed files with 10 additions and 25 deletions
|
@ -842,28 +842,13 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
});
|
||||
break;
|
||||
case 'reply_to_event':
|
||||
if (this.state.searchResults
|
||||
&& payload.event.getRoomId() === this.state.roomId
|
||||
&& !this.unmounted
|
||||
&& payload.context === TimelineRenderingType.Room) {
|
||||
if (!this.unmounted &&
|
||||
this.state.searchResults &&
|
||||
payload.event.getRoomId() === this.state.roomId &&
|
||||
payload.context === TimelineRenderingType.Search
|
||||
) {
|
||||
this.onCancelSearchClick();
|
||||
}
|
||||
break;
|
||||
case 'quote':
|
||||
if (this.state.searchResults) {
|
||||
const roomId = payload.event.getRoomId();
|
||||
if (roomId === this.state.roomId) {
|
||||
this.onCancelSearchClick();
|
||||
}
|
||||
|
||||
setImmediate(() => {
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
deferred_action: payload,
|
||||
metricsTrigger: "MessageSearch",
|
||||
});
|
||||
});
|
||||
// we don't need to re-dispatch as RoomViewStore knows to persist with context=Search also
|
||||
}
|
||||
break;
|
||||
case 'MatrixActions.sync':
|
||||
|
|
|
@ -198,10 +198,10 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
break;
|
||||
case 'reply_to_event':
|
||||
// If currently viewed room does not match the room in which we wish to reply then change rooms
|
||||
// this can happen when performing a search across all rooms
|
||||
if (payload.context === TimelineRenderingType.Room) {
|
||||
if (payload.event
|
||||
&& payload.event.getRoomId() !== this.state.roomId) {
|
||||
// this can happen when performing a search across all rooms. Persist the data from this event for
|
||||
// both room and search timeline rendering types, search will get auto-closed by RoomView at this time.
|
||||
if ([TimelineRenderingType.Room, TimelineRenderingType.Search].includes(payload.context)) {
|
||||
if (payload.event?.getRoomId() !== this.state.roomId) {
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: payload.event.getRoomId(),
|
||||
|
|
Loading…
Reference in a new issue