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 eitherpull/28788/head^2
parent
bd270b08df
commit
f92f7beb47
|
@ -179,9 +179,6 @@ export interface IConfigOptions {
|
|||
|
||||
sync_timeline_limit?: number;
|
||||
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 {
|
||||
|
|
|
@ -20,7 +20,6 @@ enum PageType {
|
|||
HomePage = "home_page",
|
||||
RoomView = "room_view",
|
||||
UserView = "user_view",
|
||||
LegacyGroupView = "legacy_group_view",
|
||||
}
|
||||
|
||||
export default PageType;
|
||||
|
|
|
@ -41,7 +41,6 @@ const loggedInPageTypeMap: Record<PageType, ScreenName> = {
|
|||
[PageType.HomePage]: "Home",
|
||||
[PageType.RoomView]: "Room",
|
||||
[PageType.UserView]: "User",
|
||||
[PageType.LegacyGroupView]: "Group",
|
||||
};
|
||||
|
||||
export default class PosthogTrackers {
|
||||
|
|
|
@ -44,7 +44,6 @@ export const DEFAULTS: IConfigOptions = {
|
|||
logo: require("../res/img/element-desktop-logo.svg").default,
|
||||
url: "https://element.io/get-started",
|
||||
},
|
||||
spaces_learn_more_url: "https://element.io/blog/spaces-blast-out-of-beta/",
|
||||
};
|
||||
|
||||
export default class SdkConfig {
|
||||
|
|
|
@ -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;
|
|
@ -67,7 +67,6 @@ import RightPanelStore from '../../stores/right-panel/RightPanelStore';
|
|||
import { TimelineRenderingType } from "../../contexts/RoomContext";
|
||||
import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts";
|
||||
import { SwitchSpacePayload } from "../../dispatcher/payloads/SwitchSpacePayload";
|
||||
import LegacyGroupView from "./LegacyGroupView";
|
||||
import { IConfigOptions } from "../../IConfigOptions";
|
||||
import LeftPanelLiveShareWarning from '../views/beacon/LeftPanelLiveShareWarning';
|
||||
import { UserOnboardingPage } from '../views/user-onboarding/UserOnboardingPage';
|
||||
|
@ -103,8 +102,6 @@ interface IProps {
|
|||
justRegistered?: boolean;
|
||||
roomJustCreatedOpts?: IOpts;
|
||||
forceTimeline?: boolean; // see props on MatrixChat
|
||||
|
||||
currentGroupId?: string;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
@ -641,10 +638,6 @@ class LoggedInView extends React.Component<IProps, IState> {
|
|||
case PageTypes.UserView:
|
||||
pageElement = <UserView userId={this.props.currentUserId} resizeNotifier={this.props.resizeNotifier} />;
|
||||
break;
|
||||
|
||||
case PageTypes.LegacyGroupView:
|
||||
pageElement = <LegacyGroupView groupId={this.props.currentGroupId} />;
|
||||
break;
|
||||
}
|
||||
|
||||
const wrapperClasses = classNames({
|
||||
|
|
|
@ -188,8 +188,6 @@ interface IState {
|
|||
currentRoomId?: string;
|
||||
// If we're trying to just view a user ID (i.e. /user URL), this is it
|
||||
currentUserId?: string;
|
||||
// Group ID for legacy "communities don't exist" page
|
||||
currentGroupId?: string;
|
||||
// this is persisted as mx_lhs_size, loaded in LoggedInView
|
||||
collapseLhs: boolean;
|
||||
// Parameters used in the registration dance with the IS
|
||||
|
@ -679,9 +677,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'view_legacy_group':
|
||||
this.viewLegacyGroup(payload.groupId);
|
||||
break;
|
||||
case Action.ViewUserSettings: {
|
||||
const tabPayload = payload as OpenToTabPayload;
|
||||
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) {
|
||||
const modal = Modal.createDialog(CreateRoomDialog, {
|
||||
type,
|
||||
|
@ -1803,12 +1788,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
userId: userId,
|
||||
subAction: params.action,
|
||||
});
|
||||
} else if (screen.indexOf('group/') === 0) {
|
||||
const groupId = screen.substring(6);
|
||||
dis.dispatch({
|
||||
action: 'view_legacy_group',
|
||||
groupId: groupId,
|
||||
});
|
||||
} else {
|
||||
logger.info("Ignoring showScreen for '%s'", screen);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
}
|
|
@ -52,8 +52,6 @@
|
|||
"%(value)sh": "%(value)sh",
|
||||
"%(value)sm": "%(value)sm",
|
||||
"%(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",
|
||||
"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.",
|
||||
|
|
|
@ -30,13 +30,11 @@ import dis from './dispatcher/dispatcher';
|
|||
import { Action } from './dispatcher/actions';
|
||||
import { ViewUserPayload } from './dispatcher/payloads/ViewUserPayload';
|
||||
import { ViewRoomPayload } from "./dispatcher/payloads/ViewRoomPayload";
|
||||
import { showGroupReplacedWithSpacesDialog } from "./group_helpers";
|
||||
|
||||
export enum Type {
|
||||
URL = "url",
|
||||
UserId = "userid",
|
||||
RoomAlias = "roomalias",
|
||||
GroupId = "groupid",
|
||||
}
|
||||
|
||||
// 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) {
|
||||
event.preventDefault();
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
|
@ -192,15 +185,6 @@ export const options = {
|
|||
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) {
|
||||
case Type.RoomAlias:
|
||||
case Type.UserId:
|
||||
case Type.GroupId:
|
||||
default: {
|
||||
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 }) => {
|
||||
const token = scanner.tokens.AT as '@';
|
||||
matrixOpaqueIdLinkifyParser({
|
||||
|
|
|
@ -43,17 +43,11 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
|||
return `${this.elementUrl}/#/user/${userId}`;
|
||||
}
|
||||
|
||||
forGroup(groupId: string): string {
|
||||
return `${this.elementUrl}/#/group/${groupId}`;
|
||||
}
|
||||
|
||||
forEntity(entityId: string): string {
|
||||
if (entityId[0] === '!' || entityId[0] === '#') {
|
||||
return this.forRoom(entityId);
|
||||
} else if (entityId[0] === '@') {
|
||||
return this.forUser(entityId);
|
||||
} else if (entityId[0] === '+') {
|
||||
return this.forGroup(entityId);
|
||||
} 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 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");
|
||||
}
|
||||
|
|
|
@ -51,10 +51,6 @@ export default class MatrixSchemePermalinkConstructor extends PermalinkConstruct
|
|||
return `matrix:${this.encodeEntity(userId)}`;
|
||||
}
|
||||
|
||||
forGroup(groupId: string): string {
|
||||
throw new Error("Deliberately not implemented");
|
||||
}
|
||||
|
||||
forEntity(entityId: string): string {
|
||||
return `matrix:${this.encodeEntity(entityId)}`;
|
||||
}
|
||||
|
|
|
@ -39,10 +39,6 @@ export default class MatrixToPermalinkConstructor extends PermalinkConstructor {
|
|||
return `${baseUrl}/#/${userId}`;
|
||||
}
|
||||
|
||||
forGroup(groupId: string): string {
|
||||
return `${baseUrl}/#/${groupId}`;
|
||||
}
|
||||
|
||||
forEntity(entityId: string): string {
|
||||
return `${baseUrl}/#/${entityId}`;
|
||||
}
|
||||
|
@ -82,8 +78,6 @@ 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");
|
||||
}
|
||||
|
|
|
@ -27,10 +27,6 @@ export default class PermalinkConstructor {
|
|||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
forGroup(groupId: string): string {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
forUser(userId: string): string {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
@ -55,30 +51,24 @@ export class PermalinkParts {
|
|||
eventId: string;
|
||||
userId: 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.eventId = eventId;
|
||||
this.userId = userId;
|
||||
this.groupId = groupId;
|
||||
this.viaServers = viaServers;
|
||||
}
|
||||
|
||||
static forUser(userId: string): PermalinkParts {
|
||||
return new PermalinkParts(null, null, userId, null, null);
|
||||
}
|
||||
|
||||
static forGroup(groupId: string): PermalinkParts {
|
||||
return new PermalinkParts(null, null, null, groupId, null);
|
||||
return new PermalinkParts(null, null, userId, null);
|
||||
}
|
||||
|
||||
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 {
|
||||
return new PermalinkParts(roomId, eventId, null, null, viaServers);
|
||||
return new PermalinkParts(roomId, eventId, null, viaServers);
|
||||
}
|
||||
|
||||
get primaryEntityId(): string {
|
||||
|
|
|
@ -295,10 +295,6 @@ export function makeRoomPermalink(roomId: string): string {
|
|||
return permalinkCreator.forShareableRoom();
|
||||
}
|
||||
|
||||
export function makeGroupPermalink(groupId: string): string {
|
||||
return getPermalinkConstructor().forGroup(groupId);
|
||||
}
|
||||
|
||||
export function isPermalinkHost(host: string): boolean {
|
||||
// Always check if the permalink is a spec permalink (callers are likely to call
|
||||
// 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
|
||||
if (entity[0] === '#' || entity[0] === '!') return makeRoomPermalink(entity);
|
||||
if (entity[0] === '@') return makeUserPermalink(entity);
|
||||
if (entity[0] === '+') return makeGroupPermalink(entity);
|
||||
|
||||
if (entity.slice(0, 7) === "matrix:") {
|
||||
try {
|
||||
|
@ -332,8 +327,6 @@ export function tryTransformEntityToPermalink(entity: string): string {
|
|||
pl += new MatrixToPermalinkConstructor().encodeServerCandidates(permalinkParts.viaServers);
|
||||
}
|
||||
return pl;
|
||||
} else if (permalinkParts.groupId) {
|
||||
return matrixtoBaseUrl + `/#/${permalinkParts.groupId}`;
|
||||
} else if (permalinkParts.userId) {
|
||||
return matrixtoBaseUrl + `/#/${permalinkParts.userId}`;
|
||||
}
|
||||
|
@ -381,8 +374,6 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
|||
}
|
||||
} 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) {
|
||||
|
@ -410,7 +401,6 @@ export function getPrimaryPermalinkEntity(permalink: string): string {
|
|||
if (!permalinkParts) return null; // not processable
|
||||
if (permalinkParts.userId) return permalinkParts.userId;
|
||||
if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias;
|
||||
if (permalinkParts.groupId) return permalinkParts.groupId;
|
||||
} catch (e) {
|
||||
// no entity - not a permalink
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue