Merge branch 'develop' into sort-imports

Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
Aaron Raimist 2021-12-09 08:34:20 +00:00
commit 7b94e13a84
642 changed files with 30052 additions and 8035 deletions

View file

@ -28,12 +28,17 @@ import { IOperableEventTile } from "../context_menus/MessageContextMenu";
import { MediaEventHelper } from "../../../utils/MediaEventHelper";
import { ReactAnyComponent } from "../../../@types/common";
import { IBodyProps } from "./IBodyProps";
import { POLL_START_EVENT_TYPE } from '../../../polls/consts';
import { Relations } from 'matrix-js-sdk/src/models/relations';
// onMessageAllowed is handled internally
interface IProps extends Omit<IBodyProps, "onMessageAllowed"> {
/* overrides for the msgtype-specific components, used by ReplyTile to override file rendering */
overrideBodyTypes?: Record<string, React.Component>;
overrideEventTypes?: Record<string, React.Component>;
// helper function to access relations for this event
getRelationsForEvent?: (eventId: string, relationType: string, eventType: string) => Relations;
}
@replaceableComponent("views.messages.MessageEvent")
@ -112,6 +117,23 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
// Fallback to UnknownBody otherwise if not redacted
BodyType = UnknownBody;
}
if (type && type === POLL_START_EVENT_TYPE.name) {
// TODO: this can all disappear when Polls comes out of labs -
// instead, add something like this into this.evTypes:
// [EventType.Poll]: "messages.MPollBody"
if (SettingsStore.getValue("feature_polls")) {
BodyType = sdk.getComponent('messages.MPollBody');
}
}
if ((type && type === "org.matrix.msc3488.location") ||
(type && type === EventType.RoomMessage && msgtype && msgtype === MsgType.Location)) {
// TODO: tidy this up once location sharing is out of labs
if (SettingsStore.getValue("feature_location_share")) {
BodyType = sdk.getComponent('messages.MLocationBody');
}
}
}
if (SettingsStore.getValue("feature_mjolnir")) {
@ -145,6 +167,7 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
onMessageAllowed={this.onTileUpdate}
permalinkCreator={this.props.permalinkCreator}
mediaEventHelper={this.mediaHelper}
getRelationsForEvent={this.props.getRelationsForEvent}
/> : null;
}
}