Properly generate mentions when editing a reply with MSC3952 (#10486)

* remove redundant feature_intentional_mentions settings check

* tests

* pass replytoevent to attachmmentions in editmessagecomposer

* lint

* strict fix
This commit is contained in:
Kerry 2023-04-03 09:32:12 +12:00 committed by GitHub
parent d3da171765
commit 6f1a3af895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 409 additions and 11 deletions

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import { MockedObject } from "jest-mock";
import { MatrixClient, MatrixEvent, EventType, Room } from "matrix-js-sdk/src/matrix";
import { MatrixClient, MatrixEvent, EventType, Room, EventTimeline } from "matrix-js-sdk/src/matrix";
import { IRoomState } from "../../src/components/structures/RoomView";
import { TimelineRenderingType } from "../../src/contexts/RoomContext";
@ -91,3 +91,12 @@ export function getRoomContext(room: Room, override: Partial<IRoomState>): IRoom
...override,
};
}
export const setupRoomWithEventsTimeline = (room: Room, events: MatrixEvent[] = []): void => {
const timelineSet = room.getUnfilteredTimelineSet();
const getTimelineForEventSpy = jest.spyOn(timelineSet, "getTimelineForEvent");
const eventTimeline = {
getEvents: jest.fn().mockReturnValue(events),
} as unknown as EventTimeline;
getTimelineForEventSpy.mockReturnValue(eventTimeline);
};