Merge remote-tracking branch 'origin/develop' into rav/edited_events

This commit is contained in:
Richard van der Hoff 2022-12-20 11:20:03 +00:00
commit ad7c002f4d
62 changed files with 558 additions and 223 deletions

View file

@ -191,8 +191,6 @@ export interface IConfigOptions {
description: string;
show_once?: boolean;
};
use_rust_crypto_sdk?: boolean;
}
export interface ISsoRedirectOptions {

View file

@ -63,6 +63,8 @@ import { OpenInviteDialogPayload } from "./dispatcher/payloads/OpenInviteDialogP
import { findDMForUser } from "./utils/dm/findDMForUser";
import { getJoinedNonFunctionalMembers } from "./utils/room/getJoinedNonFunctionalMembers";
import { localNotificationsAreSilenced } from "./utils/notifications";
import { SdkContextClass } from "./contexts/SDKContext";
import { showCantStartACallDialog } from "./voice-broadcast/utils/showCantStartACallDialog";
export const PROTOCOL_PSTN = "m.protocol.pstn";
export const PROTOCOL_PSTN_PREFIXED = "im.vector.protocol.pstn";
@ -932,6 +934,15 @@ export default class LegacyCallHandler extends EventEmitter {
}
public async placeCall(roomId: string, type?: CallType, transferee?: MatrixCall): Promise<void> {
// Pause current broadcast, if any
SdkContextClass.instance.voiceBroadcastPlaybacksStore.getCurrent()?.pause();
if (SdkContextClass.instance.voiceBroadcastRecordingsStore.getCurrent()) {
// Do not start a call, if recording a broadcast
showCantStartACallDialog();
return;
}
// We might be using managed hybrid widgets
if (isManagedHybridWidgetEnabled()) {
await addManagedHybridWidget(roomId);

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import React, { ReactNode, useContext } from "react";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { Beacon, BeaconEvent } from "matrix-js-sdk/src/matrix";
import { LocationAssetType } from "matrix-js-sdk/src/@types/location";

View file

@ -17,7 +17,7 @@ limitations under the License.
import React, { useState, useEffect } from "react";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { Beacon, Room } from "matrix-js-sdk/src/matrix";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { Icon as LiveLocationIcon } from "../../../../res/img/location/live-location.svg";
import { useLiveBeacons } from "../../../utils/beacon/useLiveBeacons";

View file

@ -137,7 +137,7 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
private addMarkerToMap = () => {
this.marker = new maplibregl.Marker({
element: document.getElementById(this.getMarkerId()),
element: document.getElementById(this.getMarkerId()) ?? undefined,
anchor: "bottom",
offset: [0, -1],
})

View file

@ -16,7 +16,7 @@ limitations under the License.
import React, { ReactNode, useContext, useEffect } from "react";
import classNames from "classnames";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { ClientEvent, IClientWellKnown } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import React, { ReactNode, useCallback, useEffect, useState } from "react";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { RoomMember } from "matrix-js-sdk/src/matrix";
import { createMarker, parseGeoUri } from "../../../utils/location";

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import React from "react";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { _t } from "../../../languageHandler";
import AccessibleButton from "../elements/AccessibleButton";

View file

@ -115,7 +115,7 @@ const CurrentDeviceSection: React.FC<Props> = ({
onClick={() => setIsExpanded(!isExpanded)}
/>
</DeviceTile>
{isExpanded && (
{isExpanded ? (
<DeviceDetails
device={device}
localNotificationSettings={localNotificationSettings}
@ -125,9 +125,12 @@ const CurrentDeviceSection: React.FC<Props> = ({
onSignOutDevice={onSignOutCurrentDevice}
saveDeviceName={saveDeviceName}
/>
) : (
<>
<br />
<DeviceVerificationStatusCard device={device} onVerifyDevice={onVerifyCurrentDevice} />
</>
)}
<br />
<DeviceVerificationStatusCard device={device} onVerifyDevice={onVerifyCurrentDevice} />
</>
)}
</SettingsSubsection>

View file

@ -134,7 +134,7 @@ export const DeviceDetailHeading: React.FC<Props> = ({ device, saveDeviceName })
<DeviceNameEditor device={device} saveDeviceName={saveDeviceName} stopEditing={() => setIsEditing(false)} />
) : (
<div className="mx_DeviceDetailHeading" data-testid="device-detail-heading">
<Heading size="h3">{device.display_name || device.device_id}</Heading>
<Heading size="h4">{device.display_name || device.device_id}</Heading>
<AccessibleButton
kind="link_inline"
onClick={() => setIsEditing(true)}

View file

@ -50,7 +50,7 @@ const FilteredDeviceListHeader: React.FC<Props> = ({
</TooltipTarget>
<span className="mx_FilteredDeviceListHeader_label">
{selectedDeviceCount > 0
? _t("%(selectedDeviceCount)s sessions selected", { selectedDeviceCount })
? _t("%(count)s sessions selected", { count: selectedDeviceCount })
: _t("Sessions")}
</span>
{children}

View file

@ -53,7 +53,7 @@ const SecurityRecommendations: React.FC<Props> = ({ devices, currentDeviceId, go
return (
<SettingsSubsection
heading={_t("Security recommendations")}
description={_t("Improve your account security by following these recommendations")}
description={_t("Improve your account security by following these recommendations.")}
data-testid="security-recommendations-section"
>
{!!unverifiedDevicesCount && (
@ -89,7 +89,7 @@ const SecurityRecommendations: React.FC<Props> = ({ devices, currentDeviceId, go
<>
{_t(
`Consider signing out from old sessions ` +
`(%(inactiveAgeDays)s days or older) you don't use anymore`,
`(%(inactiveAgeDays)s days or older) you don't use anymore.`,
{ inactiveAgeDays },
)}
<DeviceSecurityLearnMore variation={DeviceSecurityVariation.Inactive} />

View file

@ -648,6 +648,8 @@
"You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.": "You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.",
"You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions.": "You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions.",
"Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one.": "Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one.",
"Cant start a call": "Cant start a call",
"You cant start a call as you are currently recording a live broadcast. Please end your live broadcast in order to start a call.": "You cant start a call as you are currently recording a live broadcast. Please end your live broadcast in order to start a call.",
"You ended a <a>voice broadcast</a>": "You ended a <a>voice broadcast</a>",
"%(senderName)s ended a <a>voice broadcast</a>": "%(senderName)s ended a <a>voice broadcast</a>",
"You ended a voice broadcast": "You ended a voice broadcast",
@ -1005,8 +1007,6 @@
"Enable URL previews by default for participants in this room": "Enable URL previews by default for participants in this room",
"Enable widget screenshots on supported widgets": "Enable widget screenshots on supported widgets",
"Prompt before sending invites to potentially invalid matrix IDs": "Prompt before sending invites to potentially invalid matrix IDs",
"Order rooms by name": "Order rooms by name",
"Show rooms with unread notifications first": "Show rooms with unread notifications first",
"Show shortcuts to recently viewed rooms above the room list": "Show shortcuts to recently viewed rooms above the room list",
"Show shortcut to welcome checklist above the room list": "Show shortcut to welcome checklist above the room list",
"Show hidden events in timeline": "Show hidden events in timeline",
@ -1835,14 +1835,14 @@
"Inactive for %(inactiveAgeDays)s days or longer": "Inactive for %(inactiveAgeDays)s days or longer",
"Filter devices": "Filter devices",
"Show": "Show",
"%(selectedDeviceCount)s sessions selected": "%(selectedDeviceCount)s sessions selected",
"%(count)s sessions selected|other": "%(count)s sessions selected",
"%(count)s sessions selected|one": "%(count)s session selected",
"Sign in with QR code": "Sign in with QR code",
"You can use this device to sign in a new device with a QR code. You will need to scan the QR code shown on this device with your device that's signed out.": "You can use this device to sign in a new device with a QR code. You will need to scan the QR code shown on this device with your device that's signed out.",
"Show QR code": "Show QR code",
"Security recommendations": "Security recommendations",
"Improve your account security by following these recommendations": "Improve your account security by following these recommendations",
"Improve your account security by following these recommendations.": "Improve your account security by following these recommendations.",
"View all": "View all",
"Consider signing out from old sessions (%(inactiveAgeDays)s days or older) you don't use anymore": "Consider signing out from old sessions (%(inactiveAgeDays)s days or older) you don't use anymore",
"Failed to set pusher state": "Failed to set pusher state",
"Unable to remove contact information": "Unable to remove contact information",
"Remove %(email)s?": "Remove %(email)s?",

View file

@ -885,18 +885,6 @@ export const SETTINGS: { [setting: string]: ISetting } = {
deny: [],
},
},
// TODO: Remove setting: https://github.com/vector-im/element-web/issues/14373
"RoomList.orderAlphabetically": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Order rooms by name"),
default: false,
},
// TODO: Remove setting: https://github.com/vector-im/element-web/issues/14373
"RoomList.orderByImportance": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Show rooms with unread notifications first"),
default: true,
},
"breadcrumbs": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Show shortcuts to recently viewed rooms above the room list"),

View file

@ -56,6 +56,7 @@ import {
doMaybeSetCurrentVoiceBroadcastPlayback,
} from "../voice-broadcast";
import { IRoomStateEventsActionPayload } from "../actions/MatrixActionCreators";
import { showCantStartACallDialog } from "../voice-broadcast/utils/showCantStartACallDialog";
const NUM_JOIN_RETRY = 5;
@ -180,6 +181,16 @@ export class RoomViewStore extends EventEmitter {
return;
}
if (newState.viewingCall) {
// Pause current broadcast, if any
this.stores.voiceBroadcastPlaybacksStore.getCurrent()?.pause();
if (this.stores.voiceBroadcastRecordingsStore.getCurrent()) {
showCantStartACallDialog();
newState.viewingCall = false;
}
}
const lastRoomId = this.state.roomId;
this.state = Object.assign(this.state, newState);
if (lastRoomId !== this.state.roomId) {

View file

@ -16,7 +16,6 @@ limitations under the License.
import { MatrixClient } from "matrix-js-sdk/src/client";
import { Room } from "matrix-js-sdk/src/models/room";
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
import { logger } from "matrix-js-sdk/src/logger";
import { EventType } from "matrix-js-sdk/src/@types/event";
@ -387,20 +386,15 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> implements
// logic must match calculateListOrder
private calculateTagSorting(tagId: TagID): SortAlgorithm {
const isDefaultRecent = tagId === DefaultTagID.Invite || tagId === DefaultTagID.DM;
const defaultSort = isDefaultRecent ? SortAlgorithm.Recent : SortAlgorithm.Alphabetic;
const settingAlphabetical = SettingsStore.getValue("RoomList.orderAlphabetically", null, true);
const definedSort = this.getTagSorting(tagId);
const storedSort = this.getStoredTagSorting(tagId);
// We use the following order to determine which of the 4 flags to use:
// Stored > Settings > Defined > Default
let tagSort = defaultSort;
let tagSort = SortAlgorithm.Recent;
if (storedSort) {
tagSort = storedSort;
} else if (!isNullOrUndefined(settingAlphabetical)) {
tagSort = settingAlphabetical ? SortAlgorithm.Alphabetic : SortAlgorithm.Recent;
} else if (definedSort) {
tagSort = definedSort;
} // else default (already set)
@ -431,8 +425,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> implements
// logic must match calculateTagSorting
private calculateListOrder(tagId: TagID): ListAlgorithm {
const defaultOrder = ListAlgorithm.Natural;
const settingImportance = SettingsStore.getValue("RoomList.orderByImportance", null, true);
const defaultOrder = ListAlgorithm.Importance;
const definedOrder = this.getListOrder(tagId);
const storedOrder = this.getStoredListOrder(tagId);
@ -442,8 +435,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> implements
let listOrder = defaultOrder;
if (storedOrder) {
listOrder = storedOrder;
} else if (!isNullOrUndefined(settingImportance)) {
listOrder = settingImportance ? ListAlgorithm.Importance : ListAlgorithm.Natural;
} else if (definedOrder) {
listOrder = definedOrder;
} // else default (already set)

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { M_LOCATION } from "matrix-js-sdk/src/@types/location";
import { logger } from "matrix-js-sdk/src/logger";

View file

@ -388,6 +388,7 @@ export class VoiceBroadcastPlayback
public stop(): void {
this.setState(VoiceBroadcastPlaybackState.Stopped);
this.getCurrentPlayback()?.stop();
this.currentlyPlaying = null;
this.setPosition(0);
}
@ -397,7 +398,6 @@ export class VoiceBroadcastPlayback
if (this.getState() === VoiceBroadcastPlaybackState.Stopped) return;
this.setState(VoiceBroadcastPlaybackState.Paused);
if (!this.currentlyPlaying) return;
this.getCurrentPlayback()?.pause();
}

View file

@ -0,0 +1,36 @@
/*
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 React from "react";
import InfoDialog from "../../components/views/dialogs/InfoDialog";
import { _t } from "../../languageHandler";
import Modal from "../../Modal";
export const showCantStartACallDialog = () => {
Modal.createDialog(InfoDialog, {
title: _t("Cant start a call"),
description: (
<p>
{_t(
"You cant start a call as you are currently recording a live broadcast. " +
"Please end your live broadcast in order to start a call.",
)}
</p>
),
hasCloseButton: true,
});
};