Merge branch 'develop' into travis/cross-room
This commit is contained in:
commit
73dd30f919
10 changed files with 62 additions and 39 deletions
|
@ -151,7 +151,7 @@
|
||||||
"@typescript-eslint/eslint-plugin": "^4.17.0",
|
"@typescript-eslint/eslint-plugin": "^4.17.0",
|
||||||
"@typescript-eslint/parser": "^4.17.0",
|
"@typescript-eslint/parser": "^4.17.0",
|
||||||
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
|
||||||
"allchange": "^1.0.0",
|
"allchange": "^1.0.2",
|
||||||
"babel-jest": "^26.6.3",
|
"babel-jest": "^26.6.3",
|
||||||
"chokidar": "^3.5.1",
|
"chokidar": "^3.5.1",
|
||||||
"concurrently": "^5.3.0",
|
"concurrently": "^5.3.0",
|
||||||
|
|
|
@ -381,11 +381,6 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus {
|
||||||
font-size: $font-14px;
|
font-size: $font-14px;
|
||||||
color: $primary-content;
|
color: $primary-content;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
|
||||||
a {
|
|
||||||
color: $accent-color;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Dialog_buttons {
|
.mx_Dialog_buttons {
|
||||||
|
|
|
@ -15,8 +15,6 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.mx_ScrollPanel {
|
.mx_ScrollPanel {
|
||||||
contain: strict;
|
|
||||||
|
|
||||||
.mx_RoomView_MessageList {
|
.mx_RoomView_MessageList {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -514,7 +514,7 @@ $hover-select-border: 4px;
|
||||||
|
|
||||||
.mx_EventTile:hover .mx_EventTile_body pre,
|
.mx_EventTile:hover .mx_EventTile_body pre,
|
||||||
.mx_EventTile.focus-visible:focus-within .mx_EventTile_body pre {
|
.mx_EventTile.focus-visible:focus-within .mx_EventTile_body pre {
|
||||||
border: 1px solid #e5e5e5; // deliberate constant as we're behind an invert filter
|
border: 1px solid $tertiary-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile_pre_container {
|
.mx_EventTile_pre_container {
|
||||||
|
|
|
@ -250,7 +250,15 @@ export default class CallHandler extends EventEmitter {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
private areAnyCallsUnsilenced(): boolean {
|
private areAnyCallsUnsilenced(): boolean {
|
||||||
return this.calls.size > this.silencedCalls.size;
|
for (const call of this.calls.values()) {
|
||||||
|
if (
|
||||||
|
call.state === CallState.Ringing &&
|
||||||
|
!this.isCallSilenced(call.callId)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkProtocols(maxTries) {
|
private async checkProtocols(maxTries) {
|
||||||
|
@ -878,6 +886,8 @@ export default class CallHandler extends EventEmitter {
|
||||||
break;
|
break;
|
||||||
case 'hangup':
|
case 'hangup':
|
||||||
case 'reject':
|
case 'reject':
|
||||||
|
this.stopRingingIfPossible(this.calls.get(payload.room_id).callId);
|
||||||
|
|
||||||
if (!this.calls.get(payload.room_id)) {
|
if (!this.calls.get(payload.room_id)) {
|
||||||
return; // no call to hangup
|
return; // no call to hangup
|
||||||
}
|
}
|
||||||
|
@ -890,11 +900,15 @@ export default class CallHandler extends EventEmitter {
|
||||||
// the hangup event away)
|
// the hangup event away)
|
||||||
break;
|
break;
|
||||||
case 'hangup_all':
|
case 'hangup_all':
|
||||||
|
this.stopRingingIfPossible(this.calls.get(payload.room_id).callId);
|
||||||
|
|
||||||
for (const call of this.calls.values()) {
|
for (const call of this.calls.values()) {
|
||||||
call.hangup(CallErrorCode.UserHangup, false);
|
call.hangup(CallErrorCode.UserHangup, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'answer': {
|
case 'answer': {
|
||||||
|
this.stopRingingIfPossible(this.calls.get(payload.room_id).callId);
|
||||||
|
|
||||||
if (!this.calls.has(payload.room_id)) {
|
if (!this.calls.has(payload.room_id)) {
|
||||||
return; // no call to answer
|
return; // no call to answer
|
||||||
}
|
}
|
||||||
|
@ -929,6 +943,12 @@ export default class CallHandler extends EventEmitter {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private stopRingingIfPossible(callId: string): void {
|
||||||
|
this.silencedCalls.delete(callId);
|
||||||
|
if (this.areAnyCallsUnsilenced()) return;
|
||||||
|
this.pause(AudioID.Ring);
|
||||||
|
}
|
||||||
|
|
||||||
private async dialNumber(number: string) {
|
private async dialNumber(number: string) {
|
||||||
const results = await this.pstnLookup(number);
|
const results = await this.pstnLookup(number);
|
||||||
if (!results || results.length === 0 || !results[0].userid) {
|
if (!results || results.length === 0 || !results[0].userid) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ const LeftPanelWidget: React.FC = () => {
|
||||||
aria-expanded={expanded}
|
aria-expanded={expanded}
|
||||||
aria-level={1}
|
aria-level={1}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setExpanded(e => !e);
|
setExpanded(!expanded);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span className={classNames({
|
<span className={classNames({
|
||||||
|
|
|
@ -33,14 +33,6 @@ import { CapabilityText } from "../../../widgets/CapabilityText";
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
import { lexicographicCompare } from "matrix-js-sdk/src/utils";
|
import { lexicographicCompare } from "matrix-js-sdk/src/utils";
|
||||||
|
|
||||||
export function getRememberedCapabilitiesForWidget(widget: Widget): Capability[] {
|
|
||||||
return JSON.parse(localStorage.getItem(`widget_${widget.id}_approved_caps`) || "[]");
|
|
||||||
}
|
|
||||||
|
|
||||||
function setRememberedCapabilitiesForWidget(widget: Widget, caps: Capability[]) {
|
|
||||||
localStorage.setItem(`widget_${widget.id}_approved_caps`, JSON.stringify(caps));
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IProps extends IDialogProps {
|
interface IProps extends IDialogProps {
|
||||||
requestedCapabilities: Set<Capability>;
|
requestedCapabilities: Set<Capability>;
|
||||||
widget: Widget;
|
widget: Widget;
|
||||||
|
@ -97,10 +89,7 @@ export default class WidgetCapabilitiesPromptDialog extends React.PureComponent<
|
||||||
};
|
};
|
||||||
|
|
||||||
private closeAndTryRemember(approved: Capability[]) {
|
private closeAndTryRemember(approved: Capability[]) {
|
||||||
if (this.state.rememberSelection) {
|
this.props.onFinished({ approved, remember: this.state.rememberSelection });
|
||||||
setRememberedCapabilitiesForWidget(this.props.widget, approved);
|
|
||||||
}
|
|
||||||
this.props.onFinished({ approved });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
|
|
|
@ -149,10 +149,12 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
|
||||||
"To avoid these issues, create a <a>new encrypted room</a> for " +
|
"To avoid these issues, create a <a>new encrypted room</a> for " +
|
||||||
"the conversation you plan to have.",
|
"the conversation you plan to have.",
|
||||||
null,
|
null,
|
||||||
{ "a": (sub) => <a onClick={() => {
|
{ "a": (sub) => <a
|
||||||
dialog.close();
|
className="mx_linkButton"
|
||||||
this.createNewRoom(false, true);
|
onClick={() => {
|
||||||
}}> { sub } </a> },
|
dialog.close();
|
||||||
|
this.createNewRoom(false, true);
|
||||||
|
}}> { sub } </a> },
|
||||||
) } </p>
|
) } </p>
|
||||||
</div>,
|
</div>,
|
||||||
|
|
||||||
|
@ -248,10 +250,12 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
|
||||||
"you plan to have.",
|
"you plan to have.",
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
"a": (sub) => <a onClick={() => {
|
"a": (sub) => <a
|
||||||
dialog.close();
|
className="mx_linkButton"
|
||||||
this.createNewRoom(true, false);
|
onClick={() => {
|
||||||
}}> { sub } </a>,
|
dialog.close();
|
||||||
|
this.createNewRoom(true, false);
|
||||||
|
}}> { sub } </a>,
|
||||||
},
|
},
|
||||||
) } </p>
|
) } </p>
|
||||||
</div>,
|
</div>,
|
||||||
|
|
|
@ -34,9 +34,7 @@ import { MatrixClientPeg } from "../../MatrixClientPeg";
|
||||||
import ActiveRoomObserver from "../../ActiveRoomObserver";
|
import ActiveRoomObserver from "../../ActiveRoomObserver";
|
||||||
import Modal from "../../Modal";
|
import Modal from "../../Modal";
|
||||||
import WidgetOpenIDPermissionsDialog from "../../components/views/dialogs/WidgetOpenIDPermissionsDialog";
|
import WidgetOpenIDPermissionsDialog from "../../components/views/dialogs/WidgetOpenIDPermissionsDialog";
|
||||||
import WidgetCapabilitiesPromptDialog, {
|
import WidgetCapabilitiesPromptDialog from "../../components/views/dialogs/WidgetCapabilitiesPromptDialog";
|
||||||
getRememberedCapabilitiesForWidget,
|
|
||||||
} from "../../components/views/dialogs/WidgetCapabilitiesPromptDialog";
|
|
||||||
import { WidgetPermissionCustomisations } from "../../customisations/WidgetPermissions";
|
import { WidgetPermissionCustomisations } from "../../customisations/WidgetPermissions";
|
||||||
import { OIDCState, WidgetPermissionStore } from "./WidgetPermissionStore";
|
import { OIDCState, WidgetPermissionStore } from "./WidgetPermissionStore";
|
||||||
import { WidgetType } from "../../widgets/WidgetType";
|
import { WidgetType } from "../../widgets/WidgetType";
|
||||||
|
@ -50,6 +48,14 @@ import { Room } from "matrix-js-sdk";
|
||||||
|
|
||||||
// TODO: Purge this from the universe
|
// TODO: Purge this from the universe
|
||||||
|
|
||||||
|
function getRememberedCapabilitiesForWidget(widget: Widget): Capability[] {
|
||||||
|
return JSON.parse(localStorage.getItem(`widget_${widget.id}_approved_caps`) || "[]");
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRememberedCapabilitiesForWidget(widget: Widget, caps: Capability[]) {
|
||||||
|
localStorage.setItem(`widget_${widget.id}_approved_caps`, JSON.stringify(caps));
|
||||||
|
}
|
||||||
|
|
||||||
export class StopGapWidgetDriver extends WidgetDriver {
|
export class StopGapWidgetDriver extends WidgetDriver {
|
||||||
private allowedCapabilities: Set<Capability>;
|
private allowedCapabilities: Set<Capability>;
|
||||||
|
|
||||||
|
@ -102,6 +108,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Do something when the widget requests new capabilities not yet asked for
|
// TODO: Do something when the widget requests new capabilities not yet asked for
|
||||||
|
let rememberApproved = false;
|
||||||
if (missing.size > 0) {
|
if (missing.size > 0) {
|
||||||
try {
|
try {
|
||||||
const [result] = await Modal.createTrackedDialog(
|
const [result] = await Modal.createTrackedDialog(
|
||||||
|
@ -113,12 +120,19 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||||
widgetKind: this.forWidgetKind,
|
widgetKind: this.forWidgetKind,
|
||||||
}).finished;
|
}).finished;
|
||||||
(result.approved || []).forEach(cap => allowedSoFar.add(cap));
|
(result.approved || []).forEach(cap => allowedSoFar.add(cap));
|
||||||
|
rememberApproved = result.remember;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Non-fatal error getting capabilities: ", e);
|
console.error("Non-fatal error getting capabilities: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Set(iterableUnion(allowedSoFar, requested));
|
const allAllowed = new Set(iterableUnion(allowedSoFar, requested));
|
||||||
|
|
||||||
|
if (rememberApproved) {
|
||||||
|
setRememberedCapabilitiesForWidget(this.forWidget, Array.from(allAllowed));
|
||||||
|
}
|
||||||
|
|
||||||
|
return allAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendEvent(
|
public async sendEvent(
|
||||||
|
@ -136,6 +150,9 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||||
if (stateKey !== null) {
|
if (stateKey !== null) {
|
||||||
// state event
|
// state event
|
||||||
r = await client.sendStateEvent(roomId, eventType, content, stateKey);
|
r = await client.sendStateEvent(roomId, eventType, content, stateKey);
|
||||||
|
} else if (eventType === EventType.RoomRedaction) {
|
||||||
|
// special case: extract the `redacts` property and call redact
|
||||||
|
r = await client.redactEvent(roomId, content['redacts']);
|
||||||
} else {
|
} else {
|
||||||
// message event
|
// message event
|
||||||
r = await client.sendEvent(roomId, eventType, content);
|
r = await client.sendEvent(roomId, eventType, content);
|
||||||
|
|
|
@ -2036,10 +2036,10 @@ ajv@^8.0.1:
|
||||||
require-from-string "^2.0.2"
|
require-from-string "^2.0.2"
|
||||||
uri-js "^4.2.2"
|
uri-js "^4.2.2"
|
||||||
|
|
||||||
allchange@^1.0.0:
|
allchange@^1.0.2:
|
||||||
version "1.0.1"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/allchange/-/allchange-1.0.1.tgz#f32a75f65ab182d044d18e8baa43bd1c9be982f6"
|
resolved "https://registry.yarnpkg.com/allchange/-/allchange-1.0.2.tgz#86b9190e12b7ede4f230ae763cbd504c48fd907b"
|
||||||
integrity sha512-lj8HZcvQ04RsNqwLWjCYSDvchrW4nnjlOZ3z+VGhA78M7KootV0eRwlvTlYJec73jsz/Ts59kVArgooEsACOog==
|
integrity sha512-qJv1t2yvBThkes8g/dPMt8CGu+04U+q5QjCJn2Ngp92edZU8DJBfKGyGXo7w1iV48LVuQKQDfMsdIWhP7zHdlQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/core" "^1.4.0"
|
"@actions/core" "^1.4.0"
|
||||||
"@actions/github" "^5.0.0"
|
"@actions/github" "^5.0.0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue