Remove Piwik support (#8835)

* Remove all mentions of Piwik

* Kill off all consumer of the old Piwik Analytics module

* Simplify ModalManager interface

* i18n

* Attempt to fix old e2e tests

* Remove unused component

* Iterate PR
This commit is contained in:
Michael Telatynski 2022-06-14 17:51:51 +01:00 committed by GitHub
parent 7d14d15ba6
commit 3c5c2bef6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
142 changed files with 446 additions and 1412 deletions

View file

@ -57,37 +57,37 @@ export class DialogOpener {
private onDispatch = (payload: ActionPayload) => {
switch (payload.action) {
case 'open_room_settings':
Modal.createTrackedDialog('Room settings', '', RoomSettingsDialog, {
Modal.createDialog(RoomSettingsDialog, {
roomId: payload.room_id || RoomViewStore.instance.getRoomId(),
initialTabId: payload.initial_tab_id,
}, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true);
break;
case Action.OpenForwardDialog:
Modal.createTrackedDialog('Forward Message', '', ForwardDialog, {
Modal.createDialog(ForwardDialog, {
matrixClient: MatrixClientPeg.get(),
event: payload.event,
permalinkCreator: payload.permalinkCreator,
});
break;
case Action.OpenReportEventDialog:
Modal.createTrackedDialog('Report Event', '', ReportEventDialog, {
Modal.createDialog(ReportEventDialog, {
mxEvent: payload.event,
}, 'mx_Dialog_reportEvent');
break;
case Action.OpenSpacePreferences:
Modal.createTrackedDialog("Space preferences", "", SpacePreferencesDialog, {
Modal.createDialog(SpacePreferencesDialog, {
initialTabId: payload.initalTabId,
space: payload.space,
}, null, false, true);
break;
case Action.OpenSpaceSettings:
Modal.createTrackedDialog("Space Settings", "", SpaceSettingsDialog, {
Modal.createDialog(SpaceSettingsDialog, {
matrixClient: payload.space.client,
space: payload.space,
}, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true);
break;
case Action.OpenInviteDialog:
Modal.createTrackedDialog(payload.analyticsName, '', InviteDialog, {
Modal.createDialog(InviteDialog, {
kind: payload.kind,
call: payload.call,
roomId: payload.roomId,
@ -98,9 +98,7 @@ export class DialogOpener {
break;
case Action.OpenAddToExistingSpaceDialog: {
const space = payload.space;
Modal.createTrackedDialog(
"Space Landing",
"Add Existing",
Modal.createDialog(
AddExistingToSpaceDialog,
{
onCreateRoomClick: (ev: ButtonEvent) => {

View file

@ -316,7 +316,7 @@ export default class MultiInviter {
}
logger.log("Showing failed to invite dialog...");
Modal.createTrackedDialog('Failed to invite', '', AskInviteAnywayDialog, {
Modal.createDialog(AskInviteAnywayDialog, {
unknownProfileUsers: unknownProfileUsers.map(u => ({
userId: u,
errorText: this.errors[u].errorText,

View file

@ -99,7 +99,7 @@ export async function upgradeRoom(
if (!handleError) throw e;
logger.error(e);
Modal.createTrackedDialog("Room Upgrade Error", "", ErrorDialog, {
Modal.createDialog(ErrorDialog, {
title: _t('Error upgrading room'),
description: _t('Double check that your server supports the room version chosen and try again.'),
});

View file

@ -18,9 +18,6 @@ import { LocalStorageCryptoStore } from 'matrix-js-sdk/src/crypto/store/localSto
import { IndexedDBStore } from "matrix-js-sdk/src/store/indexeddb";
import { IndexedDBCryptoStore } from "matrix-js-sdk/src/crypto/store/indexeddb-crypto-store";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixClient } from 'matrix-js-sdk/src/client';
import Analytics from '../Analytics';
const localStorage = window.localStorage;
@ -43,10 +40,6 @@ function error(msg: string, ...args: string[]) {
logger.error(`StorageManager: ${msg}`, ...args);
}
function track(action: string) {
Analytics.trackEvent("StorageManager", action);
}
export function tryPersistStorage() {
if (navigator.storage && navigator.storage.persist) {
navigator.storage.persist().then(persistent => {
@ -81,7 +74,6 @@ export async function checkConsistency() {
} else {
healthy = false;
error("Local storage cannot be used on this browser");
track("Local storage disabled");
}
if (indexedDB && localStorage) {
@ -92,7 +84,6 @@ export async function checkConsistency() {
} else {
healthy = false;
error("Sync store cannot be used on this browser");
track("Sync store disabled");
}
if (indexedDB) {
@ -104,7 +95,6 @@ export async function checkConsistency() {
} else {
healthy = false;
error("Crypto store cannot be used on this browser");
track("Crypto store disabled");
}
if (dataInLocalStorage && cryptoInited && !dataInCryptoStore) {
@ -114,15 +104,12 @@ export async function checkConsistency() {
" but no data found in crypto store. " +
"IndexedDB storage has likely been evicted by the browser!",
);
track("Crypto store evicted");
}
if (healthy) {
log("Storage consistency checks passed");
track("Consistency checks passed");
} else {
error("Storage consistency checks failed");
track("Consistency checks failed");
}
return {
@ -143,7 +130,6 @@ async function checkSyncStore() {
return { exists, healthy: true };
} catch (e) {
error("Sync store using IndexedDB inaccessible", e);
track("Sync store using IndexedDB inaccessible");
}
log("Sync store using memory only");
return { exists, healthy: false };
@ -159,7 +145,6 @@ async function checkCryptoStore() {
return { exists, healthy: true };
} catch (e) {
error("Crypto store using IndexedDB inaccessible", e);
track("Crypto store using IndexedDB inaccessible");
}
try {
exists = LocalStorageCryptoStore.exists(localStorage);
@ -167,18 +152,11 @@ async function checkCryptoStore() {
return { exists, healthy: true };
} catch (e) {
error("Crypto store using local storage inaccessible", e);
track("Crypto store using local storage inaccessible");
}
log("Crypto store using memory only");
return { exists, healthy: false };
}
export function trackStores(client: MatrixClient) {
client.store?.on?.("degraded", () => {
track("Sync store using IndexedDB degraded to memory");
});
}
/**
* Sets whether crypto has ever been successfully
* initialised on this client.

View file

@ -108,7 +108,7 @@ export async function leaveRoomBehaviour(roomId: string, retry = true, spinner =
let message = _t("Unexpected server error trying to leave the room");
if (err.errcode && err.message) {
if (err.errcode === 'M_CANNOT_LEAVE_SERVER_NOTICE_ROOM') {
Modal.createTrackedDialog('Error Leaving Room', '', ErrorDialog, {
Modal.createDialog(ErrorDialog, {
title: _t("Can't leave Server Notices room"),
description: _t(
"This room is used for important messages from the Homeserver, " +
@ -121,7 +121,7 @@ export async function leaveRoomBehaviour(roomId: string, retry = true, spinner =
}
messages.push(message, React.createElement('BR')); // createElement to avoid using a tsx file in utils
}
Modal.createTrackedDialog('Error Leaving Room', '', ErrorDialog, {
Modal.createDialog(ErrorDialog, {
title: _t("Error leaving room"),
description: messages,
});
@ -143,7 +143,7 @@ export async function leaveRoomBehaviour(roomId: string, retry = true, spinner =
}
export const leaveSpace = (space: Room) => {
Modal.createTrackedDialog("Leave Space", "", LeaveSpaceDialog, {
Modal.createDialog(LeaveSpaceDialog, {
space,
onFinished: async (leave: boolean, rooms: Room[]) => {
if (!leave) return;

View file

@ -72,16 +72,11 @@ export const showAddExistingRooms = (space: Room): void => {
};
export const showCreateNewRoom = async (space: Room, type?: RoomType): Promise<boolean> => {
const modal = Modal.createTrackedDialog<[boolean, IOpts]>(
"Space Landing",
"Create Room",
CreateRoomDialog,
{
type,
defaultPublic: space.getJoinRule() === JoinRule.Public,
parentSpace: space,
},
);
const modal = Modal.createDialog<[boolean, IOpts]>(CreateRoomDialog, {
type,
defaultPublic: space.getJoinRule() === JoinRule.Public,
parentSpace: space,
});
const [shouldCreate, opts] = await modal.finished;
if (shouldCreate) {
await createRoom(opts);
@ -97,7 +92,7 @@ export const shouldShowSpaceInvite = (space: Room) =>
export const showSpaceInvite = (space: Room, initialText = ""): void => {
if (space.getJoinRule() === "public") {
const modal = Modal.createTrackedDialog("Space Invite", "User Menu", InfoDialog, {
const modal = Modal.createDialog(InfoDialog, {
title: _t("Invite to %(spaceName)s", { spaceName: space.name }),
description: <React.Fragment>
<span>{ _t("Share your public space") }</span>
@ -114,39 +109,27 @@ export const showSpaceInvite = (space: Room, initialText = ""): void => {
};
export const showAddExistingSubspace = (space: Room): void => {
Modal.createTrackedDialog(
"Space Landing",
"Create Subspace",
AddExistingSubspaceDialog,
{
space,
onCreateSubspaceClick: () => showCreateNewSubspace(space),
onFinished: (added: boolean) => {
if (added && RoomViewStore.instance.getRoomId() === space.roomId) {
defaultDispatcher.fire(Action.UpdateSpaceHierarchy);
}
},
Modal.createDialog(AddExistingSubspaceDialog, {
space,
onCreateSubspaceClick: () => showCreateNewSubspace(space),
onFinished: (added: boolean) => {
if (added && RoomViewStore.instance.getRoomId() === space.roomId) {
defaultDispatcher.fire(Action.UpdateSpaceHierarchy);
}
},
"mx_AddExistingToSpaceDialog_wrapper",
);
}, "mx_AddExistingToSpaceDialog_wrapper");
};
export const showCreateNewSubspace = (space: Room): void => {
Modal.createTrackedDialog(
"Space Landing",
"Create Subspace",
CreateSubspaceDialog,
{
space,
onAddExistingSpaceClick: () => showAddExistingSubspace(space),
onFinished: (added: boolean) => {
if (added && RoomViewStore.instance.getRoomId() === space.roomId) {
defaultDispatcher.fire(Action.UpdateSpaceHierarchy);
}
},
Modal.createDialog(CreateSubspaceDialog, {
space,
onAddExistingSpaceClick: () => showAddExistingSubspace(space),
onFinished: (added: boolean) => {
if (added && RoomViewStore.instance.getRoomId() === space.roomId) {
defaultDispatcher.fire(Action.UpdateSpaceHierarchy);
}
},
"mx_CreateSubspaceDialog_wrapper",
);
}, "mx_CreateSubspaceDialog_wrapper");
};
export const bulkSpaceBehaviour = async (