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

Commit 709e6e7

Browse files
authored
Revert "Use styled mxids in member list (#6328)" (#8107)
This reverts commit 5d28e05.
1 parent 5d28e05 commit 709e6e7

File tree

12 files changed

+50
-136
lines changed

12 files changed

+50
-136
lines changed

res/css/_components.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@
192192
@import "./views/messages/_CallEvent.scss";
193193
@import "./views/messages/_CreateEvent.scss";
194194
@import "./views/messages/_DateSeparator.scss";
195-
@import "./views/messages/_DisambiguatedProfile.scss";
196195
@import "./views/messages/_EventTileBubble.scss";
197196
@import "./views/messages/_HiddenBody.scss";
198197
@import "./views/messages/_JumpToDatePicker.scss";
@@ -215,6 +214,7 @@
215214
@import "./views/messages/_ReactionsRowButton.scss";
216215
@import "./views/messages/_RedactedBody.scss";
217216
@import "./views/messages/_RoomAvatarEvent.scss";
217+
@import "./views/messages/_SenderProfile.scss";
218218
@import "./views/messages/_TextualEvent.scss";
219219
@import "./views/messages/_UnknownBody.scss";
220220
@import "./views/messages/_ViewSourceEvent.scss";

res/css/structures/_FilePanel.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ limitations under the License.
9393
text-decoration: none;
9494
}
9595

96-
.mx_FilePanel .mx_EventTile .mx_DisambiguatedProfile {
96+
.mx_FilePanel .mx_EventTile .mx_SenderProfile {
9797
flex: 1 1 auto;
9898
line-height: initial;
9999
padding: 0px;

res/css/structures/_NotificationPanel.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ limitations under the License.
7777
display: none; // we don't need this in this view
7878
}
7979

80-
.mx_NotificationPanel .mx_EventTile .mx_DisambiguatedProfile,
80+
.mx_NotificationPanel .mx_EventTile .mx_SenderProfile,
8181
.mx_NotificationPanel .mx_EventTile .mx_MessageTimestamp {
8282
color: $primary-content;
8383
font-size: $font-12px;
Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
3-
Copyright 2021 Šimon Brandner <[email protected]>
43
54
Licensed under the Apache License, Version 2.0 (the "License");
65
you may not use this file except in compliance with the License.
@@ -15,18 +14,13 @@ See the License for the specific language governing permissions and
1514
limitations under the License.
1615
*/
1716

18-
.mx_DisambiguatedProfile {
19-
overflow: hidden;
20-
text-overflow: ellipsis;
21-
22-
.mx_DisambiguatedProfile_displayName {
23-
font-weight: 600;
24-
}
17+
.mx_SenderProfile_displayName {
18+
font-weight: 600;
19+
}
2520

26-
.mx_DisambiguatedProfile_mxid {
27-
font-weight: 600;
28-
font-size: 1.1rem;
29-
margin-left: 5px;
30-
opacity: 0.5; // Match mx_TextualEvent
31-
}
21+
.mx_SenderProfile_mxid {
22+
font-weight: 600;
23+
font-size: 1.1rem;
24+
margin-left: 5px;
25+
opacity: 0.5; // Match mx_TextualEvent
3226
}

res/css/views/rooms/_EventTile.scss

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ $left-gutter: 64px;
126126
max-width: calc(100% - $left-gutter);
127127
}
128128

129-
.mx_DisambiguatedProfile .mx_Flair {
129+
.mx_SenderProfile .mx_Flair {
130130
opacity: 0.7;
131131
margin-left: 5px;
132132
display: inline-block;
@@ -141,21 +141,6 @@ $left-gutter: 64px;
141141
}
142142
}
143143

144-
.mx_DisambiguatedProfile {
145-
color: $primary-content;
146-
font-size: $font-14px;
147-
display: inline-block; /* anti-zalgo, with overflow hidden */
148-
overflow: hidden;
149-
cursor: pointer;
150-
padding-bottom: 0px;
151-
padding-top: 0px;
152-
margin: 0px;
153-
/* the next three lines, along with overflow hidden, truncate long display names */
154-
white-space: nowrap;
155-
text-overflow: ellipsis;
156-
max-width: calc(100% - $left-gutter);
157-
}
158-
159144
&.mx_EventTile_isEditing .mx_MessageTimestamp {
160145
visibility: hidden;
161146
}

res/css/views/rooms/_GroupLayout.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $left-gutter: 64px;
1919

2020
.mx_GroupLayout {
2121
.mx_EventTile {
22-
> .mx_DisambiguatedProfile {
22+
> .mx_SenderProfile {
2323
line-height: $font-20px;
2424
margin-left: $left-gutter;
2525
}
@@ -65,7 +65,7 @@ $left-gutter: 64px;
6565
}
6666
}
6767

68-
.mx_DisambiguatedProfile {
68+
.mx_SenderProfile {
6969
font-size: $font-13px;
7070
}
7171

res/css/views/rooms/_IRCLayout.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,42 +173,42 @@ $irc-line-height: $font-18px;
173173
border-left: 0;
174174
}
175175

176-
.mx_DisambiguatedProfile {
176+
.mx_SenderProfile {
177177
width: var(--name-width);
178178
display: flex;
179179
order: 2;
180180
flex-shrink: 0;
181181
justify-content: flex-start;
182182
align-items: center;
183183

184-
> .mx_DisambiguatedProfile_displayName {
184+
> .mx_SenderProfile_displayName {
185185
width: 100%;
186186
text-align: end;
187187
overflow: hidden;
188188
text-overflow: ellipsis;
189189
}
190190

191-
> .mx_DisambiguatedProfile_mxid {
191+
> .mx_SenderProfile_mxid {
192192
visibility: collapse;
193193
// Override the inherited margin.
194194
margin-left: 0;
195195
padding: 0 5px;
196196
}
197197
}
198198

199-
.mx_DisambiguatedProfile:hover {
199+
.mx_SenderProfile:hover {
200200
overflow: visible;
201201
z-index: 10;
202202

203-
> .mx_DisambiguatedProfile_displayName {
203+
> .mx_SenderProfile_displayName {
204204
overflow: visible;
205205
display: inline;
206206
background-color: $event-selected-color;
207207
border-radius: 8px 0 0 8px;
208208
padding-right: 8px;
209209
}
210210

211-
> .mx_DisambiguatedProfile_mxid {
211+
> .mx_SenderProfile_mxid {
212212
visibility: visible;
213213
opacity: 1;
214214
background-color: $event-selected-color;
@@ -217,7 +217,7 @@ $irc-line-height: $font-18px;
217217

218218
.mx_ReplyChain {
219219
margin: 0;
220-
.mx_DisambiguatedProfile {
220+
.mx_SenderProfile {
221221
order: unset;
222222
max-width: unset;
223223
width: unset;

src/components/views/messages/DisambiguatedProfile.tsx

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/components/views/messages/SenderProfile.tsx

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
2121

2222
import Flair from '../elements/Flair';
2323
import FlairStore from '../../../stores/FlairStore';
24+
import { getUserNameColorClass } from '../../../utils/FormattingUtils';
2425
import MatrixClientContext from "../../../contexts/MatrixClientContext";
2526
import { replaceableComponent } from "../../../utils/replaceableComponent";
26-
import DisambiguatedProfile from "./DisambiguatedProfile";
27+
import UserIdentifier from '../../../customisations/UserIdentifier';
2728
import RoomContext, { TimelineRenderingType } from '../../../contexts/RoomContext';
2829
import SettingsStore from "../../../settings/SettingsStore";
2930
import { MatrixClientPeg } from "../../../MatrixClientPeg";
@@ -105,8 +106,9 @@ export default class SenderProfile extends React.Component<IProps, IState> {
105106
}
106107

107108
render() {
108-
const { mxEvent, onClick } = this.props;
109-
const msgtype = mxEvent.getContent().msgtype;
109+
const { mxEvent } = this.props;
110+
const colorClass = getUserNameColorClass(mxEvent.getSender());
111+
const { msgtype } = mxEvent.getContent();
110112

111113
let member = mxEvent.sender;
112114
if (SettingsStore.getValue("feature_use_only_current_profiles")) {
@@ -116,6 +118,10 @@ export default class SenderProfile extends React.Component<IProps, IState> {
116118
}
117119
}
118120

121+
const disambiguate = member?.disambiguate || mxEvent.sender?.disambiguate;
122+
const displayName = member?.rawDisplayName || mxEvent.getSender() || "";
123+
const mxid = member?.userId || mxEvent.getSender() || "";
124+
119125
return <RoomContext.Consumer>
120126
{ roomContext => {
121127
if (msgtype === MsgType.Emote &&
@@ -124,6 +130,17 @@ export default class SenderProfile extends React.Component<IProps, IState> {
124130
return null; // emote message must include the name so don't duplicate it
125131
}
126132

133+
let mxidElement;
134+
if (disambiguate) {
135+
mxidElement = (
136+
<span className="mx_SenderProfile_mxid">
137+
{ UserIdentifier.getDisplayUserIdentifier(
138+
mxid, { withDisplayName: true, roomId: mxEvent.getRoomId() },
139+
) }
140+
</span>
141+
);
142+
}
143+
127144
let flair;
128145
if (this.props.enableFlair) {
129146
const displayedGroups = this.getDisplayedGroups(
@@ -134,14 +151,13 @@ export default class SenderProfile extends React.Component<IProps, IState> {
134151
}
135152

136153
return (
137-
<DisambiguatedProfile
138-
fallbackName={mxEvent.getSender() || ""}
139-
flair={flair}
140-
onClick={onClick}
141-
member={member}
142-
colored={true}
143-
emphasizeDisplayName={true}
144-
/>
154+
<div className="mx_SenderProfile" dir="auto" onClick={this.props.onClick}>
155+
<span className={`mx_SenderProfile_displayName ${colorClass}`}>
156+
{ displayName }
157+
</span>
158+
{ mxidElement }
159+
{ flair }
160+
</div>
145161
);
146162
} }
147163
</RoomContext.Consumer>;

src/components/views/rooms/EntityTile.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ function presenceClassForMember(presenceState: string, lastActiveAgo: number, sh
6464

6565
interface IProps {
6666
name?: string;
67-
nameJSX?: JSX.Element;
6867
title?: string;
6968
avatarJsx?: JSX.Element; // <BaseAvatar />
7069
className?: string;
@@ -118,7 +117,7 @@ export default class EntityTile extends React.PureComponent<IProps, IState> {
118117
mainClassNames[presenceClass] = true;
119118

120119
let nameEl;
121-
const name = this.props.nameJSX || this.props.name;
120+
const { name } = this.props;
122121

123122
if (!this.props.suppressOnHover) {
124123
const activeAgo = this.props.presenceLastActiveAgo ?

0 commit comments

Comments
 (0)