mirror of https://github.com/vector-im/riot-web
Replace hardcoded strings with MsgType constants (#10604)
* replace hardcoded strings with MsgType constants * fix import and revert comments Signed-off-by: Ken Wu kenqiwu@gmail.com * fix import Signed-off-by: Ken Wu kenqiwu@gmail.com --------- Signed-off-by: Ken Wu kenqiwu@gmail.comt3chguy/dedup-icons-17oct
parent
4d859a34e7
commit
dc4bb237d4
|
@ -154,11 +154,8 @@ class FilePanel extends React.Component<IProps, IState> {
|
|||
},
|
||||
});
|
||||
|
||||
const filterId = await client.getOrCreateFilter("FILTER_FILES_" + client.credentials.userId, filter);
|
||||
filter.filterId = filterId;
|
||||
const timelineSet = room.getOrCreateFilteredTimelineSet(filter);
|
||||
|
||||
return timelineSet;
|
||||
filter.filterId = await client.getOrCreateFilter("FILTER_FILES_" + client.credentials.userId, filter);
|
||||
return room.getOrCreateFilteredTimelineSet(filter);
|
||||
}
|
||||
|
||||
private onPaginationRequest = (
|
||||
|
|
|
@ -18,6 +18,7 @@ import React from "react";
|
|||
import classnames from "classnames";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import { MsgType } from "matrix-js-sdk/src/@types/event";
|
||||
|
||||
import * as Avatar from "../../../Avatar";
|
||||
import EventTile from "../rooms/EventTile";
|
||||
|
@ -78,12 +79,12 @@ export default class EventTilePreview extends React.Component<IProps, IState> {
|
|||
sender: this.props.userId,
|
||||
content: {
|
||||
"m.new_content": {
|
||||
msgtype: "m.text",
|
||||
msgtype: MsgType.Text,
|
||||
body: message,
|
||||
displayname: this.props.displayName,
|
||||
avatar_url: this.props.avatarUrl,
|
||||
},
|
||||
"msgtype": "m.text",
|
||||
"msgtype": MsgType.Text,
|
||||
"body": message,
|
||||
"displayname": this.props.displayName,
|
||||
"avatar_url": this.props.avatarUrl,
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
import React, { createRef } from "react";
|
||||
import { EventStatus, IContent, MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/models/event";
|
||||
import classNames from "classnames";
|
||||
import { MsgType } from "matrix-js-sdk/src/@types/event";
|
||||
|
||||
import * as HtmlUtils from "../../../HtmlUtils";
|
||||
import { editBodyDiffToHtml } from "../../../utils/MessageDiffUtils";
|
||||
|
@ -166,7 +167,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
|
|||
returnString: false,
|
||||
});
|
||||
}
|
||||
if (mxEvent.getContent().msgtype === "m.emote") {
|
||||
if (mxEvent.getContent().msgtype === MsgType.Emote) {
|
||||
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||
contentContainer = (
|
||||
<div className="mx_EventTile_content" ref={this.content}>
|
||||
|
|
|
@ -18,7 +18,7 @@ import React, { ClipboardEvent, createRef, KeyboardEvent } from "react";
|
|||
import EMOJI_REGEX from "emojibase-regex";
|
||||
import { IContent, MatrixEvent, IEventRelation, IMentions } from "matrix-js-sdk/src/models/event";
|
||||
import { DebouncedFunc, throttle } from "lodash";
|
||||
import { EventType, RelationType } from "matrix-js-sdk/src/@types/event";
|
||||
import { EventType, MsgType, RelationType } from "matrix-js-sdk/src/@types/event";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { Composer as ComposerEvent } from "@matrix-org/analytics-events/types/typescript/Composer";
|
||||
|
@ -187,7 +187,7 @@ export function createMessageContent(
|
|||
const body = textSerialize(model);
|
||||
|
||||
const content: IContent = {
|
||||
msgtype: isEmote ? "m.emote" : "m.text",
|
||||
msgtype: isEmote ? MsgType.Emote : MsgType.Text,
|
||||
body: body,
|
||||
};
|
||||
const formattedBody = htmlSerializeIfNeeded(model, {
|
||||
|
|
|
@ -344,7 +344,7 @@ export default class HTMLExporter extends Exporter {
|
|||
|
||||
protected createModifiedEvent(text: string, mxEv: MatrixEvent, italic = true): MatrixEvent {
|
||||
const modifiedContent = {
|
||||
msgtype: "m.text",
|
||||
msgtype: MsgType.Text,
|
||||
body: `${text}`,
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: `${text}`,
|
||||
|
|
Loading…
Reference in New Issue