Ensure DMs tagged outside of account data work in the invite dialog
Fixes https://github.com/vector-im/riot-web/issues/12418 Includes a refactor so we don't need to litter the code with the same magic string for DM tags.
This commit is contained in:
parent
866fdd6185
commit
866ed68615
5 changed files with 45 additions and 24 deletions
|
@ -14,6 +14,7 @@ import DMRoomMap from '../../../../src/utils/DMRoomMap.js';
|
|||
import GroupStore from '../../../../src/stores/GroupStore.js';
|
||||
|
||||
import { MatrixClient, Room, RoomMember } from 'matrix-js-sdk';
|
||||
import {TAG_DM} from "../../../../src/stores/RoomListStore";
|
||||
|
||||
function generateRoomId() {
|
||||
return '!' + Math.random().toString().slice(2, 10) + ':domain';
|
||||
|
@ -152,7 +153,7 @@ describe('RoomList', () => {
|
|||
// Set up the room that will be moved such that it has the correct state for a room in
|
||||
// the section for oldTag
|
||||
if (['m.favourite', 'm.lowpriority'].includes(oldTag)) movingRoom.tags = {[oldTag]: {}};
|
||||
if (oldTag === 'im.vector.fake.direct') {
|
||||
if (oldTag === TAG_DM) {
|
||||
// Mock inverse m.direct
|
||||
DMRoomMap.shared().roomToUser = {
|
||||
[movingRoom.roomId]: '@someotheruser:domain',
|
||||
|
@ -179,7 +180,7 @@ describe('RoomList', () => {
|
|||
// TODO: Re-enable dragging tests when we support dragging again.
|
||||
describe.skip('does correct optimistic update when dragging from', () => {
|
||||
it('rooms to people', () => {
|
||||
expectCorrectMove(undefined, 'im.vector.fake.direct');
|
||||
expectCorrectMove(undefined, TAG_DM);
|
||||
});
|
||||
|
||||
it('rooms to favourites', () => {
|
||||
|
@ -194,15 +195,15 @@ describe('RoomList', () => {
|
|||
// Whe running the app live, it updates when some other event occurs (likely the
|
||||
// m.direct arriving) that these tests do not fire.
|
||||
xit('people to rooms', () => {
|
||||
expectCorrectMove('im.vector.fake.direct', undefined);
|
||||
expectCorrectMove(TAG_DM, undefined);
|
||||
});
|
||||
|
||||
it('people to favourites', () => {
|
||||
expectCorrectMove('im.vector.fake.direct', 'm.favourite');
|
||||
expectCorrectMove(TAG_DM, 'm.favourite');
|
||||
});
|
||||
|
||||
it('people to lowpriority', () => {
|
||||
expectCorrectMove('im.vector.fake.direct', 'm.lowpriority');
|
||||
expectCorrectMove(TAG_DM, 'm.lowpriority');
|
||||
});
|
||||
|
||||
it('low priority to rooms', () => {
|
||||
|
@ -210,7 +211,7 @@ describe('RoomList', () => {
|
|||
});
|
||||
|
||||
it('low priority to people', () => {
|
||||
expectCorrectMove('m.lowpriority', 'im.vector.fake.direct');
|
||||
expectCorrectMove('m.lowpriority', TAG_DM);
|
||||
});
|
||||
|
||||
it('low priority to low priority', () => {
|
||||
|
@ -222,7 +223,7 @@ describe('RoomList', () => {
|
|||
});
|
||||
|
||||
it('favourites to people', () => {
|
||||
expectCorrectMove('m.favourite', 'im.vector.fake.direct');
|
||||
expectCorrectMove('m.favourite', TAG_DM);
|
||||
});
|
||||
|
||||
it('favourites to low priority', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue