New create chat screen (#2463)
Some checks are pending
Deploy to Netlify (dev) / Deploy to Netlify (push) Waiting to run

* fix dm invite appears in home

* use migrated function for convert to dm/room commands

* add new create chat screen
This commit is contained in:
Ajay Bura 2025-08-24 18:10:44 +05:30 committed by GitHub
parent 23aa5c6f94
commit b4266c26b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 246 additions and 66 deletions

View file

@ -230,8 +230,11 @@ export const addRoomIdToMDirect = async (
roomId: string,
userId: string
): Promise<void> => {
const mDirectsEvent = mx.getAccountData(AccountDataEvent.Direct);
const userIdToRoomIds: Record<string, string[]> = mDirectsEvent?.getContent() ?? {};
const mDirectsEvent = mx.getAccountData(AccountDataEvent.Direct as any);
let userIdToRoomIds: Record<string, string[]> = {};
if (typeof mDirectsEvent !== 'undefined')
userIdToRoomIds = structuredClone(mDirectsEvent.getContent());
// remove it from the lists of any others users
// (it can only be a DM room for one person)
@ -252,12 +255,15 @@ export const addRoomIdToMDirect = async (
}
userIdToRoomIds[userId] = roomIds;
await mx.setAccountData(AccountDataEvent.Direct, userIdToRoomIds);
await mx.setAccountData(AccountDataEvent.Direct as any, userIdToRoomIds as any);
};
export const removeRoomIdFromMDirect = async (mx: MatrixClient, roomId: string): Promise<void> => {
const mDirectsEvent = mx.getAccountData(AccountDataEvent.Direct);
const userIdToRoomIds: Record<string, string[]> = mDirectsEvent?.getContent() ?? {};
const mDirectsEvent = mx.getAccountData(AccountDataEvent.Direct as any);
let userIdToRoomIds: Record<string, string[]> = {};
if (typeof mDirectsEvent !== 'undefined')
userIdToRoomIds = structuredClone(mDirectsEvent.getContent());
Object.keys(userIdToRoomIds).forEach((targetUserId) => {
const roomIds = userIdToRoomIds[targetUserId];
@ -267,7 +273,7 @@ export const removeRoomIdFromMDirect = async (mx: MatrixClient, roomId: string):
}
});
await mx.setAccountData(AccountDataEvent.Direct, userIdToRoomIds);
await mx.setAccountData(AccountDataEvent.Direct as any, userIdToRoomIds as any);
};
export const mxcUrlToHttp = (