Skip to content

Commit 23604af

Browse files
authored
Change conversations to always show names of other participants (mastodon#10047)
Fix mastodon#9190
1 parent 7276ce3 commit 23604af

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

app/javascript/mastodon/components/display_name.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,36 @@ export default class DisplayName extends React.PureComponent {
1111
};
1212

1313
render () {
14-
const { account, others, localDomain } = this.props;
15-
const displayNameHtml = { __html: account.get('display_name_html') };
14+
const { others, localDomain } = this.props;
1615

17-
let suffix;
16+
let displayName, suffix, account;
1817

1918
if (others && others.size > 1) {
20-
suffix = `+${others.size}`;
19+
displayName = others.take(2).map(a => <bdi key={a.get('id')}><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} /></bdi>).reduce((prev, cur) => [prev, ', ', cur]);
20+
21+
if (others.size - 2 > 0) {
22+
suffix = `+${others.size - 2}`;
23+
}
2124
} else {
25+
if (others) {
26+
account = others.first();
27+
} else {
28+
account = this.props.account;
29+
}
30+
2231
let acct = account.get('acct');
2332

2433
if (acct.indexOf('@') === -1 && localDomain) {
2534
acct = `${acct}@${localDomain}`;
2635
}
2736

28-
suffix = <span className='display-name__account'>@{acct}</span>;
37+
displayName = <bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>;
38+
suffix = <span className='display-name__account'>@{acct}</span>;
2939
}
3040

3141
return (
3242
<span className='display-name'>
33-
<bdi><strong className='display-name__html' dangerouslySetInnerHTML={displayNameHtml} /></bdi> {suffix}
43+
{displayName} {suffix}
3444
</span>
3545
);
3646
}

0 commit comments

Comments
 (0)