bugfix: fix in-reply-to previews not disappearing when swapping rooms (#9278)

* bugfix: fix in-reply-to previews not disappearing when swapping rooms

This was caused by the fix for another issue:
  - https://github.com/vector-im/element-web/issues/21462

Both bugs are now fixed with cypress regression tests.

* Linting

* Ensure the reply-to reappears when you click back

* Add jest test for replyTo in RVS

* Linting
This commit is contained in:
kegsay 2022-09-15 13:09:16 +01:00 committed by GitHub
parent 8d9e5237fd
commit a3133fa907
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 2 deletions

View file

@ -337,8 +337,9 @@ export class RoomViewStore extends Store<ActionPayload> {
// Allow being given an event to be replied to when switching rooms but sanity check its for this room
if (payload.replyingToEvent?.getRoomId() === payload.room_id) {
newState.replyingToEvent = payload.replyingToEvent;
} else if (this.state.roomId === payload.room_id) {
// if the room isn't being changed, e.g visiting a permalink then maintain replyingToEvent
} else if (this.state.replyingToEvent?.getRoomId() === payload.room_id) {
// if the reply-to matches the desired room, e.g visiting a permalink then maintain replyingToEvent
// See https://github.com/vector-im/element-web/issues/21462
newState.replyingToEvent = this.state.replyingToEvent;
}