Remove extensible events v1 experimental rendering (#9881)
* Remove extensible events v1 experimental rendering With the changes to extensible events in v2 largely being contained to a room version, we don't need to have this code or the labs flag anymore. If the labs flag becomes useful in the future, it will be re-added. * Run prettierpull/28788/head^2
parent
c09ca7b4ee
commit
67396020e8
|
@ -20,15 +20,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { removeDirectionOverrideChars } from "matrix-js-sdk/src/utils";
|
import { removeDirectionOverrideChars } from "matrix-js-sdk/src/utils";
|
||||||
import { GuestAccess, HistoryVisibility, JoinRule } from "matrix-js-sdk/src/@types/partials";
|
import { GuestAccess, HistoryVisibility, JoinRule } from "matrix-js-sdk/src/@types/partials";
|
||||||
import { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
|
import { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
|
||||||
import {
|
import { M_POLL_START, M_POLL_END, PollStartEvent } from "matrix-events-sdk";
|
||||||
M_EMOTE,
|
|
||||||
M_NOTICE,
|
|
||||||
M_MESSAGE,
|
|
||||||
MessageEvent,
|
|
||||||
M_POLL_START,
|
|
||||||
M_POLL_END,
|
|
||||||
PollStartEvent,
|
|
||||||
} from "matrix-events-sdk";
|
|
||||||
|
|
||||||
import { _t } from "./languageHandler";
|
import { _t } from "./languageHandler";
|
||||||
import * as Roles from "./Roles";
|
import * as Roles from "./Roles";
|
||||||
|
@ -347,17 +339,6 @@ function textForMessageEvent(ev: MatrixEvent): () => string | null {
|
||||||
message = textForRedactedPollAndMessageEvent(ev);
|
message = textForRedactedPollAndMessageEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SettingsStore.isEnabled("feature_extensible_events")) {
|
|
||||||
const extev = ev.unstableExtensibleEvent as MessageEvent;
|
|
||||||
if (extev) {
|
|
||||||
if (extev.isEquivalentTo(M_EMOTE)) {
|
|
||||||
return `* ${senderDisplayName} ${extev.text}`;
|
|
||||||
} else if (extev.isEquivalentTo(M_NOTICE) || extev.isEquivalentTo(M_MESSAGE)) {
|
|
||||||
return `${senderDisplayName}: ${extev.text}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ev.getContent().msgtype === MsgType.Emote) {
|
if (ev.getContent().msgtype === MsgType.Emote) {
|
||||||
message = "* " + senderDisplayName + " " + message;
|
message = "* " + senderDisplayName + " " + message;
|
||||||
} else if (ev.getContent().msgtype === MsgType.Image) {
|
} else if (ev.getContent().msgtype === MsgType.Image) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import React, { createRef, SyntheticEvent, MouseEvent, ReactNode } from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import highlight from "highlight.js";
|
import highlight from "highlight.js";
|
||||||
import { MsgType } from "matrix-js-sdk/src/@types/event";
|
import { MsgType } from "matrix-js-sdk/src/@types/event";
|
||||||
import { isEventLike, LegacyMsgType, M_MESSAGE, MessageEvent } from "matrix-events-sdk";
|
|
||||||
|
|
||||||
import * as HtmlUtils from "../../../HtmlUtils";
|
import * as HtmlUtils from "../../../HtmlUtils";
|
||||||
import { formatDate } from "../../../DateUtils";
|
import { formatDate } from "../../../DateUtils";
|
||||||
|
@ -579,29 +578,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
||||||
// only strip reply if this is the original replying event, edits thereafter do not have the fallback
|
// only strip reply if this is the original replying event, edits thereafter do not have the fallback
|
||||||
const stripReply = !mxEvent.replacingEvent() && !!getParentEventId(mxEvent);
|
const stripReply = !mxEvent.replacingEvent() && !!getParentEventId(mxEvent);
|
||||||
let body: ReactNode;
|
let body: ReactNode;
|
||||||
if (SettingsStore.isEnabled("feature_extensible_events")) {
|
|
||||||
const extev = this.props.mxEvent.unstableExtensibleEvent as MessageEvent;
|
|
||||||
if (extev?.isEquivalentTo(M_MESSAGE)) {
|
|
||||||
isEmote = isEventLike(extev.wireFormat, LegacyMsgType.Emote);
|
|
||||||
isNotice = isEventLike(extev.wireFormat, LegacyMsgType.Notice);
|
|
||||||
body = HtmlUtils.bodyToHtml(
|
|
||||||
{
|
|
||||||
body: extev.text,
|
|
||||||
format: extev.html ? "org.matrix.custom.html" : undefined,
|
|
||||||
formatted_body: extev.html,
|
|
||||||
msgtype: MsgType.Text,
|
|
||||||
},
|
|
||||||
this.props.highlights,
|
|
||||||
{
|
|
||||||
disableBigEmoji: isEmote || !SettingsStore.getValue<boolean>("TextualBody.enableBigEmoji"),
|
|
||||||
// Part of Replies fallback support
|
|
||||||
stripReplyFallback: stripReply,
|
|
||||||
ref: this.contentRef,
|
|
||||||
returnString: false,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!body) {
|
if (!body) {
|
||||||
isEmote = content.msgtype === MsgType.Emote;
|
isEmote = content.msgtype === MsgType.Emote;
|
||||||
isNotice = content.msgtype === MsgType.Notice;
|
isNotice = content.msgtype === MsgType.Notice;
|
||||||
|
|
|
@ -938,7 +938,6 @@
|
||||||
"Show message previews for reactions in DMs": "Show message previews for reactions in DMs",
|
"Show message previews for reactions in DMs": "Show message previews for reactions in DMs",
|
||||||
"Show message previews for reactions in all rooms": "Show message previews for reactions in all rooms",
|
"Show message previews for reactions in all rooms": "Show message previews for reactions in all rooms",
|
||||||
"Offline encrypted messaging using dehydrated devices": "Offline encrypted messaging using dehydrated devices",
|
"Offline encrypted messaging using dehydrated devices": "Offline encrypted messaging using dehydrated devices",
|
||||||
"Show extensible event representation of events": "Show extensible event representation of events",
|
|
||||||
"Show current avatar and name for users in message history": "Show current avatar and name for users in message history",
|
"Show current avatar and name for users in message history": "Show current avatar and name for users in message history",
|
||||||
"Show HTML representation of room topics": "Show HTML representation of room topics",
|
"Show HTML representation of room topics": "Show HTML representation of room topics",
|
||||||
"Show info about bridges in room settings": "Show info about bridges in room settings",
|
"Show info about bridges in room settings": "Show info about bridges in room settings",
|
||||||
|
|
|
@ -340,13 +340,6 @@ export const SETTINGS: { [setting: string]: ISetting } = {
|
||||||
supportedLevels: LEVELS_FEATURE,
|
supportedLevels: LEVELS_FEATURE,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
"feature_extensible_events": {
|
|
||||||
isFeature: true,
|
|
||||||
labsGroup: LabGroup.Developer, // developer for now, eventually Messaging and default on
|
|
||||||
supportedLevels: LEVELS_FEATURE,
|
|
||||||
displayName: _td("Show extensible event representation of events"),
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
"useOnlyCurrentProfiles": {
|
"useOnlyCurrentProfiles": {
|
||||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||||
displayName: _td("Show current avatar and name for users in message history"),
|
displayName: _td("Show current avatar and name for users in message history"),
|
||||||
|
|
Loading…
Reference in New Issue