mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-09-13 22:32:26 +03:00
use migrated function for convert to dm/room commands
This commit is contained in:
parent
782dabe21b
commit
dfd9809ddd
1 changed files with 6 additions and 2 deletions
|
@ -2,12 +2,15 @@ import { Direction, IContextResponse, MatrixClient, Method, Room, RoomMember } f
|
||||||
import { RoomServerAclEventContent } from 'matrix-js-sdk/lib/types';
|
import { RoomServerAclEventContent } from 'matrix-js-sdk/lib/types';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
|
addRoomIdToMDirect,
|
||||||
getDMRoomFor,
|
getDMRoomFor,
|
||||||
|
guessDmRoomUserId,
|
||||||
isRoomAlias,
|
isRoomAlias,
|
||||||
isRoomId,
|
isRoomId,
|
||||||
isServerName,
|
isServerName,
|
||||||
isUserId,
|
isUserId,
|
||||||
rateLimitedActions,
|
rateLimitedActions,
|
||||||
|
removeRoomIdFromMDirect,
|
||||||
} from '../utils/matrix';
|
} from '../utils/matrix';
|
||||||
import { hasDevices } from '../../util/matrixUtil';
|
import { hasDevices } from '../../util/matrixUtil';
|
||||||
import * as roomActions from '../../client/action/room';
|
import * as roomActions from '../../client/action/room';
|
||||||
|
@ -348,14 +351,15 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||||
name: Command.ConvertToDm,
|
name: Command.ConvertToDm,
|
||||||
description: 'Convert room to direct message',
|
description: 'Convert room to direct message',
|
||||||
exe: async () => {
|
exe: async () => {
|
||||||
roomActions.convertToDm(mx, room.roomId);
|
const dmUserId = guessDmRoomUserId(room, mx.getSafeUserId());
|
||||||
|
await addRoomIdToMDirect(mx, room.roomId, dmUserId);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Command.ConvertToRoom]: {
|
[Command.ConvertToRoom]: {
|
||||||
name: Command.ConvertToRoom,
|
name: Command.ConvertToRoom,
|
||||||
description: 'Convert direct message to room',
|
description: 'Convert direct message to room',
|
||||||
exe: async () => {
|
exe: async () => {
|
||||||
roomActions.convertToRoom(mx, room.roomId);
|
await removeRoomIdFromMDirect(mx, room.roomId);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Command.Delete]: {
|
[Command.Delete]: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue