Delete the remainder of groups (#9357)

* Delete the remainder of groups

Fixes https://github.com/vector-im/element-web/issues/22770
Continues https://github.com/matrix-org/matrix-react-sdk/pull/8027

* Don't need the strings either
This commit is contained in:
Travis Ralston 2022-10-05 13:44:46 -04:00 committed by GitHub
parent bd270b08df
commit f92f7beb47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 4 additions and 202 deletions

View file

@ -179,9 +179,6 @@ export interface IConfigOptions {
sync_timeline_limit?: number; sync_timeline_limit?: number;
dangerously_allow_unsafe_and_insecure_passwords?: boolean; // developer option dangerously_allow_unsafe_and_insecure_passwords?: boolean; // developer option
// XXX: Undocumented URL for the "Learn more about spaces" link in the "Communities don't exist" messaging.
spaces_learn_more_url?: string;
} }
export interface ISsoRedirectOptions { export interface ISsoRedirectOptions {

View file

@ -20,7 +20,6 @@ enum PageType {
HomePage = "home_page", HomePage = "home_page",
RoomView = "room_view", RoomView = "room_view",
UserView = "user_view", UserView = "user_view",
LegacyGroupView = "legacy_group_view",
} }
export default PageType; export default PageType;

View file

@ -41,7 +41,6 @@ const loggedInPageTypeMap: Record<PageType, ScreenName> = {
[PageType.HomePage]: "Home", [PageType.HomePage]: "Home",
[PageType.RoomView]: "Room", [PageType.RoomView]: "Room",
[PageType.UserView]: "User", [PageType.UserView]: "User",
[PageType.LegacyGroupView]: "Group",
}; };
export default class PosthogTrackers { export default class PosthogTrackers {

View file

@ -44,7 +44,6 @@ export const DEFAULTS: IConfigOptions = {
logo: require("../res/img/element-desktop-logo.svg").default, logo: require("../res/img/element-desktop-logo.svg").default,
url: "https://element.io/get-started", url: "https://element.io/get-started",
}, },
spaces_learn_more_url: "https://element.io/blog/spaces-blast-out-of-beta/",
}; };
export default class SdkConfig { export default class SdkConfig {

View file

@ -1,51 +0,0 @@
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import * as React from "react";
import AutoHideScrollbar from './AutoHideScrollbar';
import { _t } from "../../languageHandler";
import SdkConfig, { DEFAULTS } from "../../SdkConfig";
interface IProps {
groupId: string;
}
const LegacyGroupView: React.FC<IProps> = ({ groupId }) => {
// XXX: Stealing classes from the HomePage component for CSS simplicity.
// XXX: Inline CSS because this is all temporary
const learnMoreUrl = SdkConfig.get().spaces_learn_more_url ?? DEFAULTS.spaces_learn_more_url;
return <AutoHideScrollbar className="mx_HomePage mx_HomePage_default">
<div className="mx_HomePage_default_wrapper">
<h1 style={{ fontSize: '24px' }}>{ _t("That link is no longer supported") }</h1>
<p>
{ _t(
"You're trying to access a community link (%(groupId)s).<br/>" +
"Communities are no longer supported and have been replaced by spaces.<br2/>" +
"<a>Learn more about spaces here.</a>",
{ groupId },
{
br: () => <br />,
br2: () => <br />,
a: (sub) => <a href={learnMoreUrl} rel="noreferrer noopener" target="_blank">{ sub }</a>,
},
) }
</p>
</div>
</AutoHideScrollbar>;
};
export default LegacyGroupView;

View file

@ -67,7 +67,6 @@ import RightPanelStore from '../../stores/right-panel/RightPanelStore';
import { TimelineRenderingType } from "../../contexts/RoomContext"; import { TimelineRenderingType } from "../../contexts/RoomContext";
import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts"; import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts";
import { SwitchSpacePayload } from "../../dispatcher/payloads/SwitchSpacePayload"; import { SwitchSpacePayload } from "../../dispatcher/payloads/SwitchSpacePayload";
import LegacyGroupView from "./LegacyGroupView";
import { IConfigOptions } from "../../IConfigOptions"; import { IConfigOptions } from "../../IConfigOptions";
import LeftPanelLiveShareWarning from '../views/beacon/LeftPanelLiveShareWarning'; import LeftPanelLiveShareWarning from '../views/beacon/LeftPanelLiveShareWarning';
import { UserOnboardingPage } from '../views/user-onboarding/UserOnboardingPage'; import { UserOnboardingPage } from '../views/user-onboarding/UserOnboardingPage';
@ -103,8 +102,6 @@ interface IProps {
justRegistered?: boolean; justRegistered?: boolean;
roomJustCreatedOpts?: IOpts; roomJustCreatedOpts?: IOpts;
forceTimeline?: boolean; // see props on MatrixChat forceTimeline?: boolean; // see props on MatrixChat
currentGroupId?: string;
} }
interface IState { interface IState {
@ -641,10 +638,6 @@ class LoggedInView extends React.Component<IProps, IState> {
case PageTypes.UserView: case PageTypes.UserView:
pageElement = <UserView userId={this.props.currentUserId} resizeNotifier={this.props.resizeNotifier} />; pageElement = <UserView userId={this.props.currentUserId} resizeNotifier={this.props.resizeNotifier} />;
break; break;
case PageTypes.LegacyGroupView:
pageElement = <LegacyGroupView groupId={this.props.currentGroupId} />;
break;
} }
const wrapperClasses = classNames({ const wrapperClasses = classNames({

View file

@ -188,8 +188,6 @@ interface IState {
currentRoomId?: string; currentRoomId?: string;
// If we're trying to just view a user ID (i.e. /user URL), this is it // If we're trying to just view a user ID (i.e. /user URL), this is it
currentUserId?: string; currentUserId?: string;
// Group ID for legacy "communities don't exist" page
currentGroupId?: string;
// this is persisted as mx_lhs_size, loaded in LoggedInView // this is persisted as mx_lhs_size, loaded in LoggedInView
collapseLhs: boolean; collapseLhs: boolean;
// Parameters used in the registration dance with the IS // Parameters used in the registration dance with the IS
@ -679,9 +677,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
} }
break; break;
} }
case 'view_legacy_group':
this.viewLegacyGroup(payload.groupId);
break;
case Action.ViewUserSettings: { case Action.ViewUserSettings: {
const tabPayload = payload as OpenToTabPayload; const tabPayload = payload as OpenToTabPayload;
Modal.createDialog(UserSettingsDialog, Modal.createDialog(UserSettingsDialog,
@ -1023,16 +1018,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
}); });
} }
private viewLegacyGroup(groupId: string) {
this.setStateForNewView({
view: Views.LOGGED_IN,
currentRoomId: null,
currentGroupId: groupId,
});
this.notifyNewScreen('group/' + groupId);
this.setPage(PageType.LegacyGroupView);
}
private async createRoom(defaultPublic = false, defaultName?: string, type?: RoomType) { private async createRoom(defaultPublic = false, defaultName?: string, type?: RoomType) {
const modal = Modal.createDialog(CreateRoomDialog, { const modal = Modal.createDialog(CreateRoomDialog, {
type, type,
@ -1803,12 +1788,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
userId: userId, userId: userId,
subAction: params.action, subAction: params.action,
}); });
} else if (screen.indexOf('group/') === 0) {
const groupId = screen.substring(6);
dis.dispatch({
action: 'view_legacy_group',
groupId: groupId,
});
} else { } else {
logger.info("Ignoring showScreen for '%s'", screen); logger.info("Ignoring showScreen for '%s'", screen);
} }

View file

@ -1,45 +0,0 @@
/*
Copyright 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import * as React from "react";
import Modal from "./Modal";
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
import { _t } from "./languageHandler";
import SdkConfig, { DEFAULTS } from "./SdkConfig";
export function showGroupReplacedWithSpacesDialog(groupId: string) {
const learnMoreUrl = SdkConfig.get().spaces_learn_more_url ?? DEFAULTS.spaces_learn_more_url;
Modal.createDialog(QuestionDialog, {
title: _t("That link is no longer supported"),
description: <>
<p>
{ _t(
"You're trying to access a community link (%(groupId)s).<br/>" +
"Communities are no longer supported and have been replaced by spaces.<br2/>" +
"<a>Learn more about spaces here.</a>",
{ groupId },
{
br: () => <br />,
br2: () => <br />,
a: (sub) => <a href={learnMoreUrl} rel="noreferrer noopener" target="_blank">{ sub }</a>,
},
) }
</p>
</>,
hasCancelButton: false,
});
}

View file

@ -52,8 +52,6 @@
"%(value)sh": "%(value)sh", "%(value)sh": "%(value)sh",
"%(value)sm": "%(value)sm", "%(value)sm": "%(value)sm",
"%(value)ss": "%(value)ss", "%(value)ss": "%(value)ss",
"That link is no longer supported": "That link is no longer supported",
"You're trying to access a community link (%(groupId)s).<br/>Communities are no longer supported and have been replaced by spaces.<br2/><a>Learn more about spaces here.</a>": "You're trying to access a community link (%(groupId)s).<br/>Communities are no longer supported and have been replaced by spaces.<br2/><a>Learn more about spaces here.</a>",
"Identity server has no terms of service": "Identity server has no terms of service", "Identity server has no terms of service": "Identity server has no terms of service",
"This action requires accessing the default identity server <server /> to validate an email address or phone number, but the server does not have any terms of service.": "This action requires accessing the default identity server <server /> to validate an email address or phone number, but the server does not have any terms of service.", "This action requires accessing the default identity server <server /> to validate an email address or phone number, but the server does not have any terms of service.": "This action requires accessing the default identity server <server /> to validate an email address or phone number, but the server does not have any terms of service.",
"Only continue if you trust the owner of the server.": "Only continue if you trust the owner of the server.", "Only continue if you trust the owner of the server.": "Only continue if you trust the owner of the server.",

View file

@ -30,13 +30,11 @@ import dis from './dispatcher/dispatcher';
import { Action } from './dispatcher/actions'; import { Action } from './dispatcher/actions';
import { ViewUserPayload } from './dispatcher/payloads/ViewUserPayload'; import { ViewUserPayload } from './dispatcher/payloads/ViewUserPayload';
import { ViewRoomPayload } from "./dispatcher/payloads/ViewRoomPayload"; import { ViewRoomPayload } from "./dispatcher/payloads/ViewRoomPayload";
import { showGroupReplacedWithSpacesDialog } from "./group_helpers";
export enum Type { export enum Type {
URL = "url", URL = "url",
UserId = "userid", UserId = "userid",
RoomAlias = "roomalias", RoomAlias = "roomalias",
GroupId = "groupid",
} }
// Linkify stuff doesn't type scanner/parser/utils properly :/ // Linkify stuff doesn't type scanner/parser/utils properly :/
@ -115,11 +113,6 @@ function onUserClick(event: MouseEvent, userId: string) {
}); });
} }
function onGroupClick(event: MouseEvent, groupId: string) {
event.preventDefault();
showGroupReplacedWithSpacesDialog(groupId);
}
function onAliasClick(event: MouseEvent, roomAlias: string) { function onAliasClick(event: MouseEvent, roomAlias: string) {
event.preventDefault(); event.preventDefault();
dis.dispatch<ViewRoomPayload>({ dis.dispatch<ViewRoomPayload>({
@ -192,15 +185,6 @@ export const options = {
onAliasClick(e, alias); onAliasClick(e, alias);
}, },
}; };
case Type.GroupId:
return {
// @ts-ignore see https://linkify.js.org/docs/options.html
click: function(e: MouseEvent) {
const groupId = parsePermalink(href).groupId;
onGroupClick(e, groupId);
},
};
} }
}, },
@ -208,7 +192,6 @@ export const options = {
switch (type) { switch (type) {
case Type.RoomAlias: case Type.RoomAlias:
case Type.UserId: case Type.UserId:
case Type.GroupId:
default: { default: {
return tryTransformEntityToPermalink(href); return tryTransformEntityToPermalink(href);
} }
@ -255,17 +238,6 @@ registerPlugin(Type.RoomAlias, ({ scanner, parser, utils }) => {
}); });
}); });
registerPlugin(Type.GroupId, ({ scanner, parser, utils }) => {
const token = scanner.tokens.PLUS as '+';
matrixOpaqueIdLinkifyParser({
scanner,
parser,
utils,
token,
name: Type.GroupId,
});
});
registerPlugin(Type.UserId, ({ scanner, parser, utils }) => { registerPlugin(Type.UserId, ({ scanner, parser, utils }) => {
const token = scanner.tokens.AT as '@'; const token = scanner.tokens.AT as '@';
matrixOpaqueIdLinkifyParser({ matrixOpaqueIdLinkifyParser({

View file

@ -43,17 +43,11 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
return `${this.elementUrl}/#/user/${userId}`; return `${this.elementUrl}/#/user/${userId}`;
} }
forGroup(groupId: string): string {
return `${this.elementUrl}/#/group/${groupId}`;
}
forEntity(entityId: string): string { forEntity(entityId: string): string {
if (entityId[0] === '!' || entityId[0] === '#') { if (entityId[0] === '!' || entityId[0] === '#') {
return this.forRoom(entityId); return this.forRoom(entityId);
} else if (entityId[0] === '@') { } else if (entityId[0] === '@') {
return this.forUser(entityId); return this.forUser(entityId);
} else if (entityId[0] === '+') {
return this.forGroup(entityId);
} else throw new Error("Unrecognized entity"); } else throw new Error("Unrecognized entity");
} }
@ -107,8 +101,6 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
const eventId = parts.length > 2 ? parts.slice(2).join('/') : ""; const eventId = parts.length > 2 ? parts.slice(2).join('/') : "";
const via = query.split(/&?via=/).filter(p => !!p); const via = query.split(/&?via=/).filter(p => !!p);
return PermalinkParts.forEvent(entity, eventId, via); return PermalinkParts.forEvent(entity, eventId, via);
} else if (entityType === 'group') {
return PermalinkParts.forGroup(entity);
} else { } else {
throw new Error("Unknown entity type in permalink"); throw new Error("Unknown entity type in permalink");
} }

View file

@ -51,10 +51,6 @@ export default class MatrixSchemePermalinkConstructor extends PermalinkConstruct
return `matrix:${this.encodeEntity(userId)}`; return `matrix:${this.encodeEntity(userId)}`;
} }
forGroup(groupId: string): string {
throw new Error("Deliberately not implemented");
}
forEntity(entityId: string): string { forEntity(entityId: string): string {
return `matrix:${this.encodeEntity(entityId)}`; return `matrix:${this.encodeEntity(entityId)}`;
} }

View file

@ -39,10 +39,6 @@ export default class MatrixToPermalinkConstructor extends PermalinkConstructor {
return `${baseUrl}/#/${userId}`; return `${baseUrl}/#/${userId}`;
} }
forGroup(groupId: string): string {
return `${baseUrl}/#/${groupId}`;
}
forEntity(entityId: string): string { forEntity(entityId: string): string {
return `${baseUrl}/#/${entityId}`; return `${baseUrl}/#/${entityId}`;
} }
@ -82,8 +78,6 @@ export default class MatrixToPermalinkConstructor extends PermalinkConstructor {
const via = query.split(/&?via=/g).filter(p => !!p); const via = query.split(/&?via=/g).filter(p => !!p);
return PermalinkParts.forEvent(entity, eventId, via); return PermalinkParts.forEvent(entity, eventId, via);
} else if (entity[0] === '+') {
return PermalinkParts.forGroup(entity);
} else { } else {
throw new Error("Unknown entity type in permalink"); throw new Error("Unknown entity type in permalink");
} }

View file

@ -27,10 +27,6 @@ export default class PermalinkConstructor {
throw new Error("Not implemented"); throw new Error("Not implemented");
} }
forGroup(groupId: string): string {
throw new Error("Not implemented");
}
forUser(userId: string): string { forUser(userId: string): string {
throw new Error("Not implemented"); throw new Error("Not implemented");
} }
@ -55,30 +51,24 @@ export class PermalinkParts {
eventId: string; eventId: string;
userId: string; userId: string;
viaServers: string[]; viaServers: string[];
groupId: string;
constructor(roomIdOrAlias: string, eventId: string, userId: string, groupId: string, viaServers: string[]) { constructor(roomIdOrAlias: string, eventId: string, userId: string, viaServers: string[]) {
this.roomIdOrAlias = roomIdOrAlias; this.roomIdOrAlias = roomIdOrAlias;
this.eventId = eventId; this.eventId = eventId;
this.userId = userId; this.userId = userId;
this.groupId = groupId;
this.viaServers = viaServers; this.viaServers = viaServers;
} }
static forUser(userId: string): PermalinkParts { static forUser(userId: string): PermalinkParts {
return new PermalinkParts(null, null, userId, null, null); return new PermalinkParts(null, null, userId, null);
}
static forGroup(groupId: string): PermalinkParts {
return new PermalinkParts(null, null, null, groupId, null);
} }
static forRoom(roomIdOrAlias: string, viaServers: string[] = []): PermalinkParts { static forRoom(roomIdOrAlias: string, viaServers: string[] = []): PermalinkParts {
return new PermalinkParts(roomIdOrAlias, null, null, null, viaServers); return new PermalinkParts(roomIdOrAlias, null, null, viaServers);
} }
static forEvent(roomId: string, eventId: string, viaServers: string[] = []): PermalinkParts { static forEvent(roomId: string, eventId: string, viaServers: string[] = []): PermalinkParts {
return new PermalinkParts(roomId, eventId, null, null, viaServers); return new PermalinkParts(roomId, eventId, null, viaServers);
} }
get primaryEntityId(): string { get primaryEntityId(): string {

View file

@ -295,10 +295,6 @@ export function makeRoomPermalink(roomId: string): string {
return permalinkCreator.forShareableRoom(); return permalinkCreator.forShareableRoom();
} }
export function makeGroupPermalink(groupId: string): string {
return getPermalinkConstructor().forGroup(groupId);
}
export function isPermalinkHost(host: string): boolean { export function isPermalinkHost(host: string): boolean {
// Always check if the permalink is a spec permalink (callers are likely to call // Always check if the permalink is a spec permalink (callers are likely to call
// parsePermalink after this function). // parsePermalink after this function).
@ -319,7 +315,6 @@ export function tryTransformEntityToPermalink(entity: string): string {
// Check to see if it is a bare entity for starters // Check to see if it is a bare entity for starters
if (entity[0] === '#' || entity[0] === '!') return makeRoomPermalink(entity); if (entity[0] === '#' || entity[0] === '!') return makeRoomPermalink(entity);
if (entity[0] === '@') return makeUserPermalink(entity); if (entity[0] === '@') return makeUserPermalink(entity);
if (entity[0] === '+') return makeGroupPermalink(entity);
if (entity.slice(0, 7) === "matrix:") { if (entity.slice(0, 7) === "matrix:") {
try { try {
@ -332,8 +327,6 @@ export function tryTransformEntityToPermalink(entity: string): string {
pl += new MatrixToPermalinkConstructor().encodeServerCandidates(permalinkParts.viaServers); pl += new MatrixToPermalinkConstructor().encodeServerCandidates(permalinkParts.viaServers);
} }
return pl; return pl;
} else if (permalinkParts.groupId) {
return matrixtoBaseUrl + `/#/${permalinkParts.groupId}`;
} else if (permalinkParts.userId) { } else if (permalinkParts.userId) {
return matrixtoBaseUrl + `/#/${permalinkParts.userId}`; return matrixtoBaseUrl + `/#/${permalinkParts.userId}`;
} }
@ -381,8 +374,6 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string {
} }
} else if (permalinkParts.userId) { } else if (permalinkParts.userId) {
permalink = `#/user/${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 } // else not a valid permalink for our purposes - do not handle
} }
} catch (e) { } catch (e) {
@ -410,7 +401,6 @@ export function getPrimaryPermalinkEntity(permalink: string): string {
if (!permalinkParts) return null; // not processable if (!permalinkParts) return null; // not processable
if (permalinkParts.userId) return permalinkParts.userId; if (permalinkParts.userId) return permalinkParts.userId;
if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias; if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias;
if (permalinkParts.groupId) return permalinkParts.groupId;
} catch (e) { } catch (e) {
// no entity - not a permalink // no entity - not a permalink
} }