mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-14 19:20:28 +03:00
(chore) remove outdated code (#1765)
* optimize room typing members hook * remove unused code - WIP * remove old code from initMatrix * remove twemojify function * remove old sanitize util * delete old markdown util * delete Math atom component * uninstall unused dependencies * remove old notification system * decrypt message in inbox notification center and fix refresh in background * improve notification --------- Co-authored-by: Krishan <33421343+kfiven@users.noreply.github.com>
This commit is contained in:
parent
60e022035f
commit
4f09e6bbb5
147 changed files with 1164 additions and 15330 deletions
|
|
@ -107,37 +107,12 @@ async function join(roomIdOrAlias, isDM = false, via = undefined) {
|
|||
const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());
|
||||
await addRoomToMDirect(resultRoom.roomId, targetUserId);
|
||||
}
|
||||
appDispatcher.dispatch({
|
||||
type: cons.actions.room.JOIN,
|
||||
roomId: resultRoom.roomId,
|
||||
isDM,
|
||||
});
|
||||
return resultRoom.roomId;
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} roomId
|
||||
* @param {boolean} isDM
|
||||
*/
|
||||
async function leave(roomId) {
|
||||
const mx = initMatrix.matrixClient;
|
||||
const isDM = initMatrix.roomList.directs.has(roomId);
|
||||
try {
|
||||
await mx.leave(roomId);
|
||||
appDispatcher.dispatch({
|
||||
type: cons.actions.room.LEAVE,
|
||||
roomId,
|
||||
isDM,
|
||||
});
|
||||
} catch {
|
||||
console.error('Unable to leave room.');
|
||||
}
|
||||
}
|
||||
|
||||
async function create(options, isDM = false) {
|
||||
const mx = initMatrix.matrixClient;
|
||||
try {
|
||||
|
|
@ -145,11 +120,6 @@ async function create(options, isDM = false) {
|
|||
if (isDM && typeof options.invite?.[0] === 'string') {
|
||||
await addRoomToMDirect(result.room_id, options.invite[0]);
|
||||
}
|
||||
appDispatcher.dispatch({
|
||||
type: cons.actions.room.CREATE,
|
||||
roomId: result.room_id,
|
||||
isDM,
|
||||
});
|
||||
return result;
|
||||
} catch (e) {
|
||||
const errcodes = ['M_UNKNOWN', 'M_BAD_JSON', 'M_ROOM_IN_USE', 'M_INVALID_ROOM_STATE', 'M_UNSUPPORTED_ROOM_VERSION'];
|
||||
|
|
@ -348,7 +318,7 @@ async function setMyRoomAvatar(roomId, mxc) {
|
|||
export {
|
||||
convertToDm,
|
||||
convertToRoom,
|
||||
join, leave,
|
||||
join,
|
||||
createDM, createRoom,
|
||||
invite, kick, ban, unban,
|
||||
ignore, unignore,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue