Skip to content

Commit

Permalink
Display emotes on two lines like normal messages
Browse files Browse the repository at this point in the history
Fixes: #element-hq/element-web#2284
Signed-off-by: Johannes Marbach <johannesm@element.io>
  • Loading branch information
Johennes committed Apr 26, 2022
1 parent e718242 commit 53e888b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 31 deletions.
4 changes: 0 additions & 4 deletions res/css/views/messages/_MEmoteBody.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ limitations under the License.
.mx_MEmoteBody {
white-space: pre-wrap;
}

.mx_MEmoteBody_sender {
cursor: pointer;
}
6 changes: 1 addition & 5 deletions src/components/views/messages/EditHistoryMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,8 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
);
}
if (mxEvent.getContent().msgtype === "m.emote") {
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
contentContainer = (
<div className="mx_EventTile_content" ref={this.content}>*&nbsp;
<span className="mx_MEmoteBody_sender">{ name }</span>
&nbsp;{ contentElements }
</div>
<div className="mx_EventTile_content" ref={this.content}>*&nbsp;{ contentElements }</div>
);
} else {
contentContainer = <div className="mx_EventTile_content" ref={this.content}>{ contentElements }</div>;
Expand Down
6 changes: 0 additions & 6 deletions src/components/views/messages/SenderProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ export default class SenderProfile extends React.PureComponent<IProps> {

return <RoomContext.Consumer>
{ roomContext => {
if (msgtype === MsgType.Emote &&
roomContext.timelineRenderingType !== TimelineRenderingType.ThreadsList
) {
return null; // emote message must include the name so don't duplicate it
}

return (
<DisambiguatedProfile
fallbackName={mxEvent.getSender() || ""}
Expand Down
16 changes: 0 additions & 16 deletions src/components/views/messages/TextualBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
this.forceUpdate();
};

private onEmoteSenderClick = (): void => {
const mxEvent = this.props.mxEvent;
dis.dispatch<ComposerInsertPayload>({
action: Action.ComposerInsert,
userId: mxEvent.getSender(),
timelineRenderingType: this.context.timelineRenderingType,
});
};

/**
* This acts as a fallback in-app navigation handler for any body links that
* were ignored as part of linkification because they were already links
Expand Down Expand Up @@ -631,13 +622,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
onClick={this.onBodyLinkClick}
>
*&nbsp;
<span
className="mx_MEmoteBody_sender"
onClick={this.onEmoteSenderClick}
>
{ mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender() }
</span>
&nbsp;
{ body }
{ widgets }
</div>
Expand Down

0 comments on commit 53e888b

Please sign in to comment.