Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 3845d29

Browse files
committed
Don't use Optional
Signed-off-by: Sumner Evans <sumner@beeper.com>
1 parent 1ab97d3 commit 3845d29

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/components/views/messages/ReactionsRowButton.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
import React from "react";
1818
import classNames from "classnames";
1919
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
20-
import { Optional } from "matrix-events-sdk/lib/types";
2120

2221
import { mediaFromMxc } from "../../../customisations/Media";
2322
import { _t } from "../../../languageHandler";
@@ -112,18 +111,16 @@ export default class ReactionsRowButton extends React.PureComponent<IProps, ISta
112111

113112
const room = this.context.getRoom(mxEvent.getRoomId());
114113
let label: string | undefined;
115-
let customReactionName: Optional<string>;
114+
let customReactionName: string | undefined;
116115
if (room) {
117116
const senders: string[] = [];
118117
for (const reactionEvent of reactionEvents) {
119118
const member = room.getMember(reactionEvent.getSender()!);
120119
senders.push(member?.name || reactionEvent.getSender()!);
121-
if (
122-
this.props.customReactionImagesEnabled &&
123-
REACTION_SHORTCODE_KEY.findIn(reactionEvent.getContent())
124-
) {
125-
customReactionName = REACTION_SHORTCODE_KEY.findIn(reactionEvent.getContent());
126-
}
120+
customReactionName =
121+
(this.props.customReactionImagesEnabled &&
122+
REACTION_SHORTCODE_KEY.findIn(reactionEvent.getContent())) ||
123+
undefined;
127124
}
128125

129126
const reactors = formatCommaSeparatedList(senders, 6);

src/components/views/messages/ReactionsRowButtonTooltip.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
import React from "react";
1818
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
19-
import { Optional } from "matrix-events-sdk/lib/types";
2019

2120
import { unicodeToShortcode } from "../../../HtmlUtils";
2221
import { _t } from "../../../languageHandler";
@@ -47,17 +46,15 @@ export default class ReactionsRowButtonTooltip extends React.PureComponent<IProp
4746
let tooltipLabel: JSX.Element | undefined;
4847
if (room) {
4948
const senders: string[] = [];
50-
let customReactionName: Optional<string>;
49+
let customReactionName: string | undefined;
5150
for (const reactionEvent of reactionEvents) {
5251
const member = room.getMember(reactionEvent.getSender()!);
5352
const name = member?.name ?? reactionEvent.getSender()!;
5453
senders.push(name);
55-
if (
56-
this.props.customReactionImagesEnabled &&
57-
REACTION_SHORTCODE_KEY.findIn(reactionEvent.getContent())
58-
) {
59-
customReactionName = REACTION_SHORTCODE_KEY.findIn(reactionEvent.getContent());
60-
}
54+
customReactionName =
55+
(this.props.customReactionImagesEnabled &&
56+
REACTION_SHORTCODE_KEY.findIn(reactionEvent.getContent())) ||
57+
undefined;
6158
}
6259
const shortName = unicodeToShortcode(content) || customReactionName;
6360
tooltipLabel = (

0 commit comments

Comments
 (0)