Add clarifying text to DM dialog about what is about to happen
This commit is contained in:
parent
cc2fc911af
commit
e58b514803
4 changed files with 47 additions and 1 deletions
|
@ -24,6 +24,8 @@ import * as sdk from './';
|
|||
import { _t } from './languageHandler';
|
||||
import {KIND_DM, KIND_INVITE} from "./components/views/dialogs/InviteDialog";
|
||||
import CommunityPrototypeInviteDialog from "./components/views/dialogs/CommunityPrototypeInviteDialog";
|
||||
import GroupStore from "./stores/GroupStore";
|
||||
import dis from "./dispatcher/dispatcher";
|
||||
|
||||
/**
|
||||
* Invites multiple addresses to a room
|
||||
|
@ -64,6 +66,24 @@ export function showCommunityRoomInviteDialog(roomId, communityName) {
|
|||
);
|
||||
}
|
||||
|
||||
export function showCommunityInviteDialog(communityId) {
|
||||
const rooms = GroupStore.getGroupRooms(communityId)
|
||||
.map(r => MatrixClientPeg.get().getRoom(r.roomId))
|
||||
.filter(r => !!r);
|
||||
let chat = rooms.find(r => {
|
||||
const idState = r.currentState.getStateEvents("im.vector.general_chat", "");
|
||||
if (!idState || idState.getContent()['groupId'] !== communityId) return false;
|
||||
return true;
|
||||
});
|
||||
if (!chat) chat = rooms[0];
|
||||
if (chat) {
|
||||
const summary = GroupStore.getSummary(communityId);
|
||||
showCommunityRoomInviteDialog(chat.roomId, summary?.profile?.name || communityId);
|
||||
} else {
|
||||
throw new Error("Failed to locate appropriate room to start an invite in");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given MatrixEvent is a valid 3rd party user invite.
|
||||
* @param {MatrixEvent} event The event to check
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue