Skip to content

Commit

Permalink
Fix clicking on avatar/display opening status instead of profile (#2897)
Browse files Browse the repository at this point in the history
Fix regression from #2895
  • Loading branch information
ClearlyClaire authored Nov 11, 2024
1 parent b7a66c6 commit 1ae5f84
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
39 changes: 21 additions & 18 deletions app/javascript/flavours/glitch/components/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,26 +372,29 @@ class Status extends ImmutablePureComponent {
const { isCollapsed } = this.state;
if (!history) return;

if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey)) {
if (isCollapsed) this.setCollapsed(false);
else if (e.shiftKey) {
this.setCollapsed(true);
document.getSelection().removeAllRanges();
} else if (this.props.onClick) {
this.props.onClick();
return;
} else {
if (destination === undefined) {
destination = `/@${
status.getIn(['reblog', 'account', 'acct'], status.getIn(['account', 'acct']))
}/${
status.getIn(['reblog', 'id'], status.get('id'))
}`;
}
history.push(destination);
if (e.button !== 0 || e.ctrlKey || e.altKey || e.metaKey) {
return;
}

if (isCollapsed) this.setCollapsed(false);
else if (e.shiftKey) {
this.setCollapsed(true);
document.getSelection().removeAllRanges();
} else if (this.props.onClick) {
this.props.onClick();
return;
} else {
if (destination === undefined) {
destination = `/@${
status.getIn(['reblog', 'account', 'acct'], status.getIn(['account', 'acct']))
}/${
status.getIn(['reblog', 'id'], status.get('id'))
}`;
}
e.preventDefault();
history.push(destination);
}

e.preventDefault();
};

handleToggleMediaVisibility = () => {
Expand Down
11 changes: 3 additions & 8 deletions app/javascript/flavours/glitch/components/status_header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ export default class StatusHeader extends PureComponent {
parseClick: PropTypes.func.isRequired,
};

// Handles clicks on account name/image
handleClick = (acct, e) => {
const { parseClick } = this.props;
parseClick(e, `/@${acct}`);
};

handleAccountClick = (e) => {
const { status } = this.props;
this.handleClick(status.getIn(['account', 'acct']), e);
const { status, parseClick } = this.props;
parseClick(e, `/@${status.getIn(['account', 'acct'])}`);
e.stopPropagation();
};

// Rendering.
Expand Down

0 comments on commit 1ae5f84

Please sign in to comment.