mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 05:04:57 +08:00
Merge branch 'master' into develop
# Conflicts: # src/events/EventTileFactory.tsx # yarn.lock
This commit is contained in:
commit
c89c02f4e0
41
CHANGELOG.md
41
CHANGELOG.md
@ -1,3 +1,44 @@
|
||||
Changes in [3.53.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.53.0) (2022-08-31)
|
||||
=====================================================================================================
|
||||
|
||||
## ✨ Features
|
||||
* Device manager - scroll to filtered list from security recommendations ([\#9227](https://github.com/matrix-org/matrix-react-sdk/pull/9227)). Contributed by @kerryarchibald.
|
||||
* Device manager - updated dropdown style in filtered device list ([\#9226](https://github.com/matrix-org/matrix-react-sdk/pull/9226)). Contributed by @kerryarchibald.
|
||||
* Device manager - device type and verification icons on device tile ([\#9197](https://github.com/matrix-org/matrix-react-sdk/pull/9197)). Contributed by @kerryarchibald.
|
||||
* Ignore unreads in low priority rooms in the space panel ([\#6518](https://github.com/matrix-org/matrix-react-sdk/pull/6518)). Fixes vector-im/element-web#16836.
|
||||
* Release message right-click context menu out of labs ([\#8613](https://github.com/matrix-org/matrix-react-sdk/pull/8613)).
|
||||
* Device manager - expandable session details in device list ([\#9188](https://github.com/matrix-org/matrix-react-sdk/pull/9188)). Contributed by @kerryarchibald.
|
||||
* Device manager - device list filtering ([\#9181](https://github.com/matrix-org/matrix-react-sdk/pull/9181)). Contributed by @kerryarchibald.
|
||||
* Device manager - add verification details to session details ([\#9187](https://github.com/matrix-org/matrix-react-sdk/pull/9187)). Contributed by @kerryarchibald.
|
||||
* Device manager - current session expandable details ([\#9185](https://github.com/matrix-org/matrix-react-sdk/pull/9185)). Contributed by @kerryarchibald.
|
||||
* Device manager - security recommendations section ([\#9179](https://github.com/matrix-org/matrix-react-sdk/pull/9179)). Contributed by @kerryarchibald.
|
||||
* The Welcome Home Screen: Return Button ([\#9089](https://github.com/matrix-org/matrix-react-sdk/pull/9089)). Fixes vector-im/element-web#22917. Contributed by @justjanne.
|
||||
* Device manager - label devices as inactive ([\#9175](https://github.com/matrix-org/matrix-react-sdk/pull/9175)). Contributed by @kerryarchibald.
|
||||
* Device manager - other sessions list ([\#9155](https://github.com/matrix-org/matrix-react-sdk/pull/9155)). Contributed by @kerryarchibald.
|
||||
* Implement MSC3846: Allowing widgets to access TURN servers ([\#9061](https://github.com/matrix-org/matrix-react-sdk/pull/9061)).
|
||||
* Allow widgets to send/receive to-device messages ([\#8885](https://github.com/matrix-org/matrix-react-sdk/pull/8885)).
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
* Add super cool feature ([\#9222](https://github.com/matrix-org/matrix-react-sdk/pull/9222)). Contributed by @gefgu.
|
||||
* Make use of js-sdk roomNameGenerator to handle i18n for generated room names ([\#9209](https://github.com/matrix-org/matrix-react-sdk/pull/9209)). Fixes vector-im/element-web#21369.
|
||||
* Fix progress bar regression throughout the app ([\#9219](https://github.com/matrix-org/matrix-react-sdk/pull/9219)). Fixes vector-im/element-web#23121.
|
||||
* Reuse empty string & space string logic for event types in devtools ([\#9218](https://github.com/matrix-org/matrix-react-sdk/pull/9218)). Fixes vector-im/element-web#23115.
|
||||
* Reduce amount of requests done by the onboarding task list ([\#9194](https://github.com/matrix-org/matrix-react-sdk/pull/9194)). Fixes vector-im/element-web#23085. Contributed by @justjanne.
|
||||
* Avoid hardcoding branding in user onboarding ([\#9206](https://github.com/matrix-org/matrix-react-sdk/pull/9206)). Fixes vector-im/element-web#23111. Contributed by @justjanne.
|
||||
* End jitsi call when member is banned ([\#8879](https://github.com/matrix-org/matrix-react-sdk/pull/8879)). Contributed by @maheichyk.
|
||||
* Fix context menu being opened when clicking message action bar buttons ([\#9200](https://github.com/matrix-org/matrix-react-sdk/pull/9200)). Fixes vector-im/element-web#22279 and vector-im/element-web#23100.
|
||||
* Add gap between checkbox and text in report dialog following the same pattern (8px) used in the gap between the two buttons. It fixes vector-im/element-web#23060 ([\#9195](https://github.com/matrix-org/matrix-react-sdk/pull/9195)). Contributed by @gefgu.
|
||||
* Fix url preview AXE and layout issue & add percy test ([\#9189](https://github.com/matrix-org/matrix-react-sdk/pull/9189)). Fixes vector-im/element-web#23083.
|
||||
* Wrap long space names ([\#9201](https://github.com/matrix-org/matrix-react-sdk/pull/9201)). Fixes vector-im/element-web#23095.
|
||||
* Attempt to fix `Failed to execute 'removeChild' on 'Node'` ([\#9196](https://github.com/matrix-org/matrix-react-sdk/pull/9196)).
|
||||
* Fix soft crash around space hierarchy changing between spaces ([\#9191](https://github.com/matrix-org/matrix-react-sdk/pull/9191)). Fixes matrix-org/element-web-rageshakes#14613.
|
||||
* Fix soft crash around room view store metrics ([\#9190](https://github.com/matrix-org/matrix-react-sdk/pull/9190)). Fixes matrix-org/element-web-rageshakes#14361.
|
||||
* Fix the same person appearing multiple times when searching for them. ([\#9177](https://github.com/matrix-org/matrix-react-sdk/pull/9177)). Fixes vector-im/element-web#22851.
|
||||
* Fix space panel subspace indentation going missing ([\#9167](https://github.com/matrix-org/matrix-react-sdk/pull/9167)). Fixes vector-im/element-web#23049.
|
||||
* Fix invisible power levels tile when showing hidden events ([\#9162](https://github.com/matrix-org/matrix-react-sdk/pull/9162)). Fixes vector-im/element-web#23013.
|
||||
* Space panel accessibility improvements ([\#9157](https://github.com/matrix-org/matrix-react-sdk/pull/9157)). Fixes vector-im/element-web#22995.
|
||||
* Fix inverted logic for showing UserWelcomeTop component ([\#9164](https://github.com/matrix-org/matrix-react-sdk/pull/9164)). Fixes vector-im/element-web#23037.
|
||||
|
||||
Changes in [3.52.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.52.0) (2022-08-16)
|
||||
=====================================================================================================
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "matrix-react-sdk",
|
||||
"version": "3.52.0",
|
||||
"version": "3.53.0",
|
||||
"description": "SDK for matrix.org using React",
|
||||
"author": "matrix.org",
|
||||
"repository": {
|
||||
@ -23,7 +23,7 @@
|
||||
"package.json",
|
||||
".stylelintrc.js"
|
||||
],
|
||||
"main": "./src/index.ts",
|
||||
"main": "./lib/index.ts",
|
||||
"matrix_src_main": "./src/index.ts",
|
||||
"matrix_lib_main": "./lib/index.ts",
|
||||
"matrix_lib_typings": "./lib/index.d.ts",
|
||||
@ -93,7 +93,7 @@
|
||||
"maplibre-gl": "^1.15.2",
|
||||
"matrix-encrypt-attachment": "^1.0.3",
|
||||
"matrix-events-sdk": "^0.0.1-beta.7",
|
||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
||||
"matrix-js-sdk": "19.4.0",
|
||||
"matrix-widget-api": "^1.0.0",
|
||||
"minimist": "^1.2.5",
|
||||
"opus-recorder": "^8.0.3",
|
||||
@ -252,5 +252,6 @@
|
||||
"jestSonar": {
|
||||
"reportPath": "coverage",
|
||||
"sonar56x": true
|
||||
}
|
||||
},
|
||||
"typings": "./lib/index.d.ts"
|
||||
}
|
||||
|
@ -59,11 +59,30 @@ export interface IOperableEventTile {
|
||||
getEventTileOps(): IEventTileOps;
|
||||
}
|
||||
|
||||
const baseBodyTypes = new Map<string, typeof React.Component>([
|
||||
[MsgType.Text, TextualBody],
|
||||
[MsgType.Notice, TextualBody],
|
||||
[MsgType.Emote, TextualBody],
|
||||
[MsgType.Image, MImageBody],
|
||||
[MsgType.File, MFileBody],
|
||||
[MsgType.Audio, MVoiceOrAudioBody],
|
||||
[MsgType.Video, MVideoBody],
|
||||
]);
|
||||
const baseEvTypes = new Map<string, React.ComponentType<Partial<IBodyProps>>>([
|
||||
[EventType.Sticker, MStickerBody],
|
||||
[M_POLL_START.name, MPollBody],
|
||||
[M_POLL_START.altName, MPollBody],
|
||||
[M_BEACON_INFO.name, MBeaconBody],
|
||||
[M_BEACON_INFO.altName, MBeaconBody],
|
||||
]);
|
||||
|
||||
export default class MessageEvent extends React.Component<IProps> implements IMediaBody, IOperableEventTile {
|
||||
private body: React.RefObject<React.Component | IOperableEventTile> = createRef();
|
||||
private mediaHelper: MediaEventHelper;
|
||||
private bodyTypes = new Map<string, typeof React.Component>(baseBodyTypes.entries());
|
||||
private evTypes = new Map<string, React.ComponentType<Partial<IBodyProps>>>(baseEvTypes.entries());
|
||||
|
||||
static contextType = MatrixClientContext;
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
@ -72,6 +91,8 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
|
||||
if (MediaEventHelper.isEligible(this.props.mxEvent)) {
|
||||
this.mediaHelper = new MediaEventHelper(this.props.mxEvent);
|
||||
}
|
||||
|
||||
this.updateComponentMaps();
|
||||
}
|
||||
|
||||
public componentDidMount(): void {
|
||||
@ -88,32 +109,20 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
|
||||
this.mediaHelper?.destroy();
|
||||
this.mediaHelper = new MediaEventHelper(this.props.mxEvent);
|
||||
}
|
||||
|
||||
this.updateComponentMaps();
|
||||
}
|
||||
|
||||
private get bodyTypes(): Record<string, typeof React.Component> {
|
||||
return {
|
||||
[MsgType.Text]: TextualBody,
|
||||
[MsgType.Notice]: TextualBody,
|
||||
[MsgType.Emote]: TextualBody,
|
||||
[MsgType.Image]: MImageBody,
|
||||
[MsgType.File]: MFileBody,
|
||||
[MsgType.Audio]: MVoiceOrAudioBody,
|
||||
[MsgType.Video]: MVideoBody,
|
||||
private updateComponentMaps() {
|
||||
this.bodyTypes = new Map<string, typeof React.Component>(baseBodyTypes.entries());
|
||||
for (const [bodyType, bodyComponent] of Object.entries(this.props.overrideBodyTypes ?? {})) {
|
||||
this.bodyTypes.set(bodyType, bodyComponent);
|
||||
}
|
||||
|
||||
...(this.props.overrideBodyTypes || {}),
|
||||
};
|
||||
}
|
||||
|
||||
private get evTypes(): Record<string, React.ComponentType<Partial<IBodyProps>>> {
|
||||
return {
|
||||
[EventType.Sticker]: MStickerBody,
|
||||
[M_POLL_START.name]: MPollBody,
|
||||
[M_POLL_START.altName]: MPollBody,
|
||||
[M_BEACON_INFO.name]: MBeaconBody,
|
||||
[M_BEACON_INFO.altName]: MBeaconBody,
|
||||
|
||||
...(this.props.overrideEventTypes || {}),
|
||||
};
|
||||
this.evTypes = new Map<string, React.ComponentType<Partial<IBodyProps>>>(baseEvTypes.entries());
|
||||
for (const [evType, evComponent] of Object.entries(this.props.overrideEventTypes ?? {})) {
|
||||
this.evTypes.set(evType, evComponent);
|
||||
}
|
||||
}
|
||||
|
||||
public getEventTileOps = () => {
|
||||
@ -143,13 +152,13 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
|
||||
let BodyType: React.ComponentType<Partial<IBodyProps>> | ReactAnyComponent = RedactedBody;
|
||||
if (!this.props.mxEvent.isRedacted()) {
|
||||
// only resolve BodyType if event is not redacted
|
||||
if (type && this.evTypes[type]) {
|
||||
BodyType = this.evTypes[type];
|
||||
} else if (msgtype && this.bodyTypes[msgtype]) {
|
||||
BodyType = this.bodyTypes[msgtype];
|
||||
if (type && this.evTypes.has(type)) {
|
||||
BodyType = this.evTypes.get(type);
|
||||
} else if (msgtype && this.bodyTypes.has(msgtype)) {
|
||||
BodyType = this.bodyTypes.get(msgtype);
|
||||
} else if (content.url) {
|
||||
// Fallback to MFileBody if there's a content URL
|
||||
BodyType = this.bodyTypes[MsgType.File];
|
||||
BodyType = this.bodyTypes.get(MsgType.File);
|
||||
} else {
|
||||
// Fallback to UnknownBody otherwise if not redacted
|
||||
BodyType = UnknownBody;
|
||||
|
@ -67,7 +67,6 @@ export interface EventTileTypeProps {
|
||||
|
||||
type FactoryProps = Omit<EventTileTypeProps, "ref">;
|
||||
type Factory<X = FactoryProps> = (ref: Optional<React.RefObject<any>>, props: X) => JSX.Element;
|
||||
type FactoryMap = Record<string, Factory>;
|
||||
|
||||
const MessageEventFactory: Factory = (ref, props) => <MessageEvent ref={ref} {...props} />;
|
||||
const KeyVerificationConclFactory: Factory = (ref, props) => <MKeyVerificationConclusion ref={ref} {...props} />;
|
||||
@ -82,40 +81,40 @@ const HiddenEventFactory: Factory = (ref, props) => <HiddenBody ref={ref} {...pr
|
||||
export const JitsiEventFactory: Factory = (ref, props) => <MJitsiWidgetEvent ref={ref} {...props} />;
|
||||
export const JSONEventFactory: Factory = (ref, props) => <ViewSourceEvent ref={ref} {...props} />;
|
||||
|
||||
const EVENT_TILE_TYPES: FactoryMap = {
|
||||
[EventType.RoomMessage]: MessageEventFactory, // note that verification requests are handled in pickFactory()
|
||||
[EventType.Sticker]: MessageEventFactory,
|
||||
[M_POLL_START.name]: MessageEventFactory,
|
||||
[M_POLL_START.altName]: MessageEventFactory,
|
||||
[EventType.KeyVerificationCancel]: KeyVerificationConclFactory,
|
||||
[EventType.KeyVerificationDone]: KeyVerificationConclFactory,
|
||||
[EventType.CallInvite]: LegacyCallEventFactory, // note that this requires a special factory type
|
||||
};
|
||||
const EVENT_TILE_TYPES = new Map<string, Factory>([
|
||||
[EventType.RoomMessage, MessageEventFactory], // note that verification requests are handled in pickFactory()
|
||||
[EventType.Sticker, MessageEventFactory],
|
||||
[M_POLL_START.name, MessageEventFactory],
|
||||
[M_POLL_START.altName, MessageEventFactory],
|
||||
[EventType.KeyVerificationCancel, KeyVerificationConclFactory],
|
||||
[EventType.KeyVerificationDone, KeyVerificationConclFactory],
|
||||
[EventType.CallInvite, CallEventFactory], // note that this requires a special factory type
|
||||
]);
|
||||
|
||||
const STATE_EVENT_TILE_TYPES: FactoryMap = {
|
||||
[EventType.RoomEncryption]: (ref, props) => <EncryptionEvent ref={ref} {...props} />,
|
||||
[EventType.RoomCanonicalAlias]: TextualEventFactory,
|
||||
[EventType.RoomCreate]: (ref, props) => <RoomCreate ref={ref} {...props} />,
|
||||
[EventType.RoomMember]: TextualEventFactory,
|
||||
[EventType.RoomName]: TextualEventFactory,
|
||||
[EventType.RoomAvatar]: (ref, props) => <RoomAvatarEvent ref={ref} {...props} />,
|
||||
[EventType.RoomThirdPartyInvite]: TextualEventFactory,
|
||||
[EventType.RoomHistoryVisibility]: TextualEventFactory,
|
||||
[EventType.RoomTopic]: TextualEventFactory,
|
||||
[EventType.RoomPowerLevels]: TextualEventFactory,
|
||||
[EventType.RoomPinnedEvents]: TextualEventFactory,
|
||||
[EventType.RoomServerAcl]: TextualEventFactory,
|
||||
const STATE_EVENT_TILE_TYPES = new Map<string, Factory>([
|
||||
[EventType.RoomEncryption, (ref, props) => <EncryptionEvent ref={ref} {...props} />],
|
||||
[EventType.RoomCanonicalAlias, TextualEventFactory],
|
||||
[EventType.RoomCreate, (ref, props) => <RoomCreate ref={ref} {...props} />],
|
||||
[EventType.RoomMember, TextualEventFactory],
|
||||
[EventType.RoomName, TextualEventFactory],
|
||||
[EventType.RoomAvatar, (ref, props) => <RoomAvatarEvent ref={ref} {...props} />],
|
||||
[EventType.RoomThirdPartyInvite, TextualEventFactory],
|
||||
[EventType.RoomHistoryVisibility, TextualEventFactory],
|
||||
[EventType.RoomTopic, TextualEventFactory],
|
||||
[EventType.RoomPowerLevels, TextualEventFactory],
|
||||
[EventType.RoomPinnedEvents, TextualEventFactory],
|
||||
[EventType.RoomServerAcl, TextualEventFactory],
|
||||
// TODO: Enable support for m.widget event type (https://github.com/vector-im/element-web/issues/13111)
|
||||
'im.vector.modular.widgets': TextualEventFactory, // note that Jitsi widgets are special in pickFactory()
|
||||
[WIDGET_LAYOUT_EVENT_TYPE]: TextualEventFactory,
|
||||
[EventType.RoomTombstone]: TextualEventFactory,
|
||||
[EventType.RoomJoinRules]: TextualEventFactory,
|
||||
[EventType.RoomGuestAccess]: TextualEventFactory,
|
||||
};
|
||||
['im.vector.modular.widgets', TextualEventFactory], // note that Jitsi widgets are special in pickFactory()
|
||||
[WIDGET_LAYOUT_EVENT_TYPE, TextualEventFactory],
|
||||
[EventType.RoomTombstone, TextualEventFactory],
|
||||
[EventType.RoomJoinRules, TextualEventFactory],
|
||||
[EventType.RoomGuestAccess, TextualEventFactory],
|
||||
]);
|
||||
|
||||
// Add all the Mjolnir stuff to the renderer too
|
||||
for (const evType of ALL_RULE_TYPES) {
|
||||
STATE_EVENT_TILE_TYPES[evType] = TextualEventFactory;
|
||||
STATE_EVENT_TILE_TYPES.set(evType, TextualEventFactory);
|
||||
}
|
||||
|
||||
// These events should be recorded in the STATE_EVENT_TILE_TYPES
|
||||
@ -225,11 +224,11 @@ export function pickFactory(
|
||||
return noEventFactoryFactory(); // improper event type to render
|
||||
}
|
||||
|
||||
if (STATE_EVENT_TILE_TYPES[evType] === TextualEventFactory && !hasText(mxEvent, showHiddenEvents)) {
|
||||
if (STATE_EVENT_TILE_TYPES.get(evType) === TextualEventFactory && !hasText(mxEvent, showHiddenEvents)) {
|
||||
return noEventFactoryFactory();
|
||||
}
|
||||
|
||||
return STATE_EVENT_TILE_TYPES[evType] ?? noEventFactoryFactory();
|
||||
return STATE_EVENT_TILE_TYPES.get(evType) ?? noEventFactoryFactory();
|
||||
}
|
||||
|
||||
// Blanket override for all events. The MessageEvent component handles redacted states for us.
|
||||
@ -241,7 +240,7 @@ export function pickFactory(
|
||||
return noEventFactoryFactory();
|
||||
}
|
||||
|
||||
return EVENT_TILE_TYPES[evType] ?? noEventFactoryFactory();
|
||||
return EVENT_TILE_TYPES.get(evType) ?? noEventFactoryFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -391,7 +390,7 @@ export function haveRendererForEvent(mxEvent: MatrixEvent, showHiddenEvents: boo
|
||||
if (!handler) return false;
|
||||
if (handler === TextualEventFactory) {
|
||||
return hasText(mxEvent, showHiddenEvents);
|
||||
} else if (handler === STATE_EVENT_TILE_TYPES[EventType.RoomCreate]) {
|
||||
} else if (handler === STATE_EVENT_TILE_TYPES.get(EventType.RoomCreate)) {
|
||||
return Boolean(mxEvent.getContent()['predecessor']);
|
||||
} else if (handler === JSONEventFactory) {
|
||||
return false;
|
||||
|
@ -6745,9 +6745,10 @@ matrix-events-sdk@^0.0.1-beta.7:
|
||||
resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1-beta.7.tgz#5ffe45eba1f67cc8d7c2377736c728b322524934"
|
||||
integrity sha512-9jl4wtWanUFSy2sr2lCjErN/oC8KTAtaeaozJtrgot1JiQcEI4Rda9OLgQ7nLKaqb4Z/QUx/fR3XpDzm5Jy1JA==
|
||||
|
||||
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop":
|
||||
version "19.3.0"
|
||||
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/1df329df7c9702114ebe350ff87c429c5d013ddd"
|
||||
matrix-js-sdk@19.4.0:
|
||||
version "19.4.0"
|
||||
resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-19.4.0.tgz#ea333ec3b7893ea953bd1ac00c0ce1108fffc0d0"
|
||||
integrity sha512-B8Mm4jCsCHaMaChcdM3VhZDVKrn0nMSDtYvHmS15Iu8Pe0G4qmIpk2AoADBAL9U9yN3pCqvs3TDXaQhM8UxRRA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.12.5"
|
||||
another-json "^0.2.0"
|
||||
|
Loading…
Reference in New Issue
Block a user