Fix reply action in message context menu notif & file panels (#9895)
This commit is contained in:
parent
098ba1465a
commit
0c30b577e0
2 changed files with 28 additions and 4 deletions
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
import { sleep } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import { RoomViewStore } from "../../src/stores/RoomViewStore";
|
||||
import { Action } from "../../src/dispatcher/actions";
|
||||
|
@ -245,6 +246,28 @@ describe("RoomViewStore", function () {
|
|||
expect(roomViewStore.getRoomId()).toEqual(roomId2);
|
||||
});
|
||||
|
||||
it("should ignore reply_to_event for Thread panels", async () => {
|
||||
expect(roomViewStore.getQuotingEvent()).toBeFalsy();
|
||||
const replyToEvent = {
|
||||
getRoomId: () => roomId2,
|
||||
};
|
||||
dis.dispatch({ action: "reply_to_event", event: replyToEvent, context: TimelineRenderingType.Thread });
|
||||
await sleep(100);
|
||||
expect(roomViewStore.getQuotingEvent()).toBeFalsy();
|
||||
});
|
||||
|
||||
it.each([TimelineRenderingType.Room, TimelineRenderingType.File, TimelineRenderingType.Notification])(
|
||||
"Should respect reply_to_event for %s rendering context",
|
||||
async (context) => {
|
||||
const replyToEvent = {
|
||||
getRoomId: () => roomId,
|
||||
};
|
||||
dis.dispatch({ action: "reply_to_event", event: replyToEvent, context });
|
||||
await untilDispatch(Action.ViewRoom, dis);
|
||||
expect(roomViewStore.getQuotingEvent()).toEqual(replyToEvent);
|
||||
},
|
||||
);
|
||||
|
||||
it("removes the roomId on ViewHomePage", async () => {
|
||||
dis.dispatch({ action: Action.ViewRoom, room_id: roomId });
|
||||
await untilDispatch(Action.ActiveRoomChanged, dis);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue