Delete groups (legacy communities system) (#8027)
* Remove deprecated feature_communities_v2_prototypes * Update _components * i18n * delint * Cut out a bit more dead code * Carve into legacy components * Carve into mostly the room list code * Carve into instances of "groupId" * Carve out more of what comes up with "groups" * Carve out some settings * ignore related groups state * Remove instances of spacesEnabled * Fix some obvious issues * Remove now-unused css * Fix variable naming for legacy components * Update i18n * Misc cleanup from manual review * Update snapshot for changed flag * Appease linters * rethemedex * Remove now-unused AddressPickerDialog * Make ConfirmUserActionDialog's member a required prop * Remove useless override from RightPanelStore * Remove extraneous CSS * Update i18n * Demo: "Communities are now Spaces" landing page * Restore linkify for group IDs * Demo: Dialog on click for communities->spaces notice * i18n for demos * i18n post-merge * Update copy * Appease the linter * Post-merge cleanup * Re-add spaces_learn_more_url to the new SdkConfig place * Round 1 of post-merge fixes * i18n Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
03c80707c9
commit
fce36ec826
171 changed files with 317 additions and 12160 deletions
|
@ -23,7 +23,6 @@ import { HistoryVisibility } from "matrix-js-sdk/src/@types/partials";
|
|||
|
||||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import { AddressType, getAddressType } from '../UserAddress';
|
||||
import GroupStore from '../stores/GroupStore';
|
||||
import { _t } from "../languageHandler";
|
||||
import Modal from "../Modal";
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
|
@ -47,11 +46,9 @@ const USER_ALREADY_JOINED = "IO.ELEMENT.ALREADY_JOINED";
|
|||
const USER_ALREADY_INVITED = "IO.ELEMENT.ALREADY_INVITED";
|
||||
|
||||
/**
|
||||
* Invites multiple addresses to a room or group, handling rate limiting from the server
|
||||
* Invites multiple addresses to a room, handling rate limiting from the server
|
||||
*/
|
||||
export default class MultiInviter {
|
||||
private readonly roomId?: string;
|
||||
private readonly groupId?: string;
|
||||
private readonly matrixClient: MatrixClient;
|
||||
|
||||
private canceled = false;
|
||||
|
@ -64,18 +61,10 @@ export default class MultiInviter {
|
|||
private reason: string = null;
|
||||
|
||||
/**
|
||||
* @param {string} targetId The ID of the room or group to invite to
|
||||
* @param {string} roomId The ID of the room to invite to
|
||||
* @param {function} progressCallback optional callback, fired after each invite.
|
||||
*/
|
||||
constructor(targetId: string, private readonly progressCallback?: () => void) {
|
||||
if (targetId[0] === '+') {
|
||||
this.roomId = null;
|
||||
this.groupId = targetId;
|
||||
} else {
|
||||
this.roomId = targetId;
|
||||
this.groupId = null;
|
||||
}
|
||||
|
||||
constructor(private roomId: string, private readonly progressCallback?: () => void) {
|
||||
this.matrixClient = MatrixClientPeg.get();
|
||||
}
|
||||
|
||||
|
@ -196,13 +185,7 @@ export default class MultiInviter {
|
|||
return new Promise<void>((resolve, reject) => {
|
||||
logger.log(`Inviting ${address}`);
|
||||
|
||||
let doInvite;
|
||||
if (this.groupId !== null) {
|
||||
doInvite = GroupStore.inviteUserToGroup(this.groupId, address);
|
||||
} else {
|
||||
doInvite = this.inviteToRoom(this.roomId, address, ignoreProfile);
|
||||
}
|
||||
|
||||
const doInvite = this.inviteToRoom(this.roomId, address, ignoreProfile);
|
||||
doInvite.then(() => {
|
||||
if (this.canceled) {
|
||||
return;
|
||||
|
@ -288,7 +271,7 @@ export default class MultiInviter {
|
|||
|
||||
if (nextIndex === this.addresses.length) {
|
||||
this.busy = false;
|
||||
if (Object.keys(this.errors).length > 0 && !this.groupId) {
|
||||
if (Object.keys(this.errors).length > 0) {
|
||||
// There were problems inviting some people - see if we can invite them
|
||||
// without caring if they exist or not.
|
||||
const unknownProfileUsers = Object.keys(this.errors)
|
||||
|
|
|
@ -284,7 +284,6 @@ export default class HTMLExporter extends Exporter {
|
|||
getRelationsForEvent={null}
|
||||
showReactions={false}
|
||||
layout={Layout.Group}
|
||||
enableFlair={false}
|
||||
showReadReceipts={false}
|
||||
/>
|
||||
</MatrixClientContext.Provider>
|
||||
|
|
|
@ -184,8 +184,7 @@ export async function leaveRoomBehaviour(roomId: string, retry = true, spinner =
|
|||
return;
|
||||
}
|
||||
|
||||
if (SpaceStore.spacesEnabled &&
|
||||
!isMetaSpace(SpaceStore.instance.activeSpace) &&
|
||||
if (!isMetaSpace(SpaceStore.instance.activeSpace) &&
|
||||
SpaceStore.instance.activeSpace !== roomId &&
|
||||
RoomViewStore.getRoomId() === roomId
|
||||
) {
|
||||
|
|
|
@ -80,8 +80,8 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parses an app route (`(user|room|group)/identifer`) to a Matrix entity
|
||||
* (room, user, group).
|
||||
* Parses an app route (`(user|room)/identifer`) to a Matrix entity
|
||||
* (room, user).
|
||||
* @param {string} route The app route
|
||||
* @returns {PermalinkParts}
|
||||
*/
|
||||
|
@ -102,14 +102,13 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
|||
if (entityType === 'user') {
|
||||
// Probably a user, no further parsing needed.
|
||||
return PermalinkParts.forUser(entity);
|
||||
} else if (entityType === 'group') {
|
||||
// Probably a group, no further parsing needed.
|
||||
return PermalinkParts.forGroup(entity);
|
||||
} else if (entityType === 'room') {
|
||||
// Rejoin the rest because v3 events can have slashes (annoyingly)
|
||||
const eventId = parts.length > 2 ? parts.slice(2).join('/') : "";
|
||||
const via = query.split(/&?via=/).filter(p => !!p);
|
||||
return PermalinkParts.forEvent(entity, eventId, via);
|
||||
} else if (entityType === 'group') {
|
||||
return PermalinkParts.forGroup(entity);
|
||||
} else {
|
||||
throw new Error("Unknown entity type in permalink");
|
||||
}
|
||||
|
|
|
@ -69,9 +69,6 @@ export default class MatrixToPermalinkConstructor extends PermalinkConstructor {
|
|||
if (entity[0] === '@') {
|
||||
// Probably a user, no further parsing needed.
|
||||
return PermalinkParts.forUser(entity);
|
||||
} else if (entity[0] === '+') {
|
||||
// Probably a group, no further parsing needed.
|
||||
return PermalinkParts.forGroup(entity);
|
||||
} else if (entity[0] === '#' || entity[0] === '!') {
|
||||
if (parts.length === 1) { // room without event permalink
|
||||
const [roomId, query=""] = entity.split("?");
|
||||
|
@ -85,6 +82,8 @@ export default class MatrixToPermalinkConstructor extends PermalinkConstructor {
|
|||
const via = query.split(/&?via=/g).filter(p => !!p);
|
||||
|
||||
return PermalinkParts.forEvent(entity, eventId, via);
|
||||
} else if (entity[0] === '+') {
|
||||
return PermalinkParts.forGroup(entity);
|
||||
} else {
|
||||
throw new Error("Unknown entity type in permalink");
|
||||
}
|
||||
|
|
|
@ -54,14 +54,14 @@ export class PermalinkParts {
|
|||
roomIdOrAlias: string;
|
||||
eventId: string;
|
||||
userId: string;
|
||||
groupId: string;
|
||||
viaServers: string[];
|
||||
groupId: string;
|
||||
|
||||
constructor(roomIdOrAlias: string, eventId: string, userId: string, groupId: string, viaServers: string[]) {
|
||||
this.roomIdOrAlias = roomIdOrAlias;
|
||||
this.eventId = eventId;
|
||||
this.groupId = groupId;
|
||||
this.userId = userId;
|
||||
this.groupId = groupId;
|
||||
this.viaServers = viaServers;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ export class PermalinkParts {
|
|||
}
|
||||
|
||||
get primaryEntityId(): string {
|
||||
return this.roomIdOrAlias || this.userId || this.groupId;
|
||||
return this.roomIdOrAlias || this.userId;
|
||||
}
|
||||
|
||||
get sigil(): string {
|
||||
|
|
|
@ -321,7 +321,7 @@ export function tryTransformEntityToPermalink(entity: string): string {
|
|||
if (permalinkParts) {
|
||||
if (permalinkParts.roomIdOrAlias) {
|
||||
const eventIdPart = permalinkParts.eventId ? `/${permalinkParts.eventId}` : '';
|
||||
let pl = matrixtoBaseUrl+`/#/${permalinkParts.roomIdOrAlias}${eventIdPart}`;
|
||||
let pl = matrixtoBaseUrl + `/#/${permalinkParts.roomIdOrAlias}${eventIdPart}`;
|
||||
if (permalinkParts.viaServers.length > 0) {
|
||||
pl += new MatrixToPermalinkConstructor().encodeServerCandidates(permalinkParts.viaServers);
|
||||
}
|
||||
|
@ -373,10 +373,10 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
|||
if (permalinkParts.viaServers.length > 0) {
|
||||
permalink += new MatrixToPermalinkConstructor().encodeServerCandidates(permalinkParts.viaServers);
|
||||
}
|
||||
} else if (permalinkParts.groupId) {
|
||||
permalink = `#/group/${permalinkParts.groupId}`;
|
||||
} else if (permalinkParts.userId) {
|
||||
permalink = `#/user/${permalinkParts.userId}`;
|
||||
} else if (permalinkParts.groupId) {
|
||||
permalink = `#/group/${permalinkParts.groupId}`;
|
||||
} // else not a valid permalink for our purposes - do not handle
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -403,8 +403,8 @@ export function getPrimaryPermalinkEntity(permalink: string): string {
|
|||
|
||||
if (!permalinkParts) return null; // not processable
|
||||
if (permalinkParts.userId) return permalinkParts.userId;
|
||||
if (permalinkParts.groupId) return permalinkParts.groupId;
|
||||
if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias;
|
||||
if (permalinkParts.groupId) return permalinkParts.groupId;
|
||||
} catch (e) {
|
||||
// no entity - not a permalink
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
import React from "react";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { JoinRule } from "matrix-js-sdk/src/@types/partials";
|
||||
|
||||
import { calculateRoomVia } from "./permalinks/Permalinks";
|
||||
|
@ -39,7 +38,6 @@ import { Action } from "../dispatcher/actions";
|
|||
import { leaveRoomBehaviour } from "./membership";
|
||||
import Spinner from "../components/views/elements/Spinner";
|
||||
import LeaveSpaceDialog from "../components/views/dialogs/LeaveSpaceDialog";
|
||||
import CreateSpaceFromCommunityDialog from "../components/views/dialogs/CreateSpaceFromCommunityDialog";
|
||||
import SpacePreferencesDialog, { SpacePreferenceTab } from "../components/views/dialogs/SpacePreferencesDialog";
|
||||
import PosthogTrackers from "../PosthogTrackers";
|
||||
import { ButtonEvent } from "../components/views/elements/AccessibleButton";
|
||||
|
@ -202,13 +200,6 @@ export const leaveSpace = (space: Room) => {
|
|||
}, "mx_LeaveSpaceDialog_wrapper");
|
||||
};
|
||||
|
||||
export const createSpaceFromCommunity = (cli: MatrixClient, groupId: string): Promise<[string?]> => {
|
||||
return Modal.createTrackedDialog('Create Space', 'from community', CreateSpaceFromCommunityDialog, {
|
||||
matrixClient: cli,
|
||||
groupId,
|
||||
}, "mx_CreateSpaceFromCommunityDialog_wrapper").finished as Promise<[string?]>;
|
||||
};
|
||||
|
||||
export const showSpacePreferences = (space: Room, initialTabId?: SpacePreferenceTab): Promise<unknown> => {
|
||||
return Modal.createTrackedDialog("Space preferences", "", SpacePreferencesDialog, {
|
||||
initialTabId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue