Fix opening wrong profile when clicking on username of boosting user in WebUI (#17060)

Fixes #16799
This commit is contained in:
Claire 2021-11-26 22:04:09 +01:00 committed by GitHub
parent 912c6b3f49
commit ddcb9da74f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -146,7 +146,11 @@ class Status extends ImmutablePureComponent {
this.handleHotkeyOpen();
}
handleAccountClick = e => {
handlePrependAccountClick = e => {
this.handleAccountClick(e, false);
}
handleAccountClick = (e, proper = true) => {
if (e && (e.button !== 0 || e.ctrlKey || e.metaKey)) {
return;
}
@ -155,7 +159,7 @@ class Status extends ImmutablePureComponent {
e.preventDefault();
}
this.handleHotkeyOpenProfile();
this._openProfile(proper);
}
handleExpandedToggle = () => {
@ -244,8 +248,12 @@ class Status extends ImmutablePureComponent {
}
handleHotkeyOpenProfile = () => {
this._openProfile();
}
_openProfile = (proper = true) => {
const { router } = this.context;
const status = this._properStatus();
const status = proper ? this._properStatus() : this.props.status;
if (!router) {
return;
@ -349,7 +357,7 @@ class Status extends ImmutablePureComponent {
prepend = (
<div className='status__prepend'>
<div className='status__prepend-icon-wrapper'><Icon id='retweet' className='status__prepend-icon' fixedWidth /></div>
<FormattedMessage id='status.reblogged_by' defaultMessage='{name} boosted' values={{ name: <a onClick={this.handleAccountClick} data-id={status.getIn(['account', 'id'])} href={status.getIn(['account', 'url'])} className='status__display-name muted'><bdi><strong dangerouslySetInnerHTML={display_name_html} /></bdi></a> }} />
<FormattedMessage id='status.reblogged_by' defaultMessage='{name} boosted' values={{ name: <a onClick={this.handlePrependAccountClick} data-id={status.getIn(['account', 'id'])} href={status.getIn(['account', 'url'])} className='status__display-name muted'><bdi><strong dangerouslySetInnerHTML={display_name_html} /></bdi></a> }} />
</div>
);