Fix clicking on avatar/display opening status instead of profile (#2897)
Fix regression from #2895
This commit is contained in:
		
							parent
							
								
									b7a66c6eac
								
							
						
					
					
						commit
						1ae5f84774
					
				| 
						 | 
					@ -372,26 +372,29 @@ class Status extends ImmutablePureComponent {
 | 
				
			||||||
    const { isCollapsed } = this.state;
 | 
					    const { isCollapsed } = this.state;
 | 
				
			||||||
    if (!history) return;
 | 
					    if (!history) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey)) {
 | 
					    if (e.button !== 0 || e.ctrlKey || e.altKey || e.metaKey) {
 | 
				
			||||||
      if (isCollapsed) this.setCollapsed(false);
 | 
					      return;
 | 
				
			||||||
      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);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      e.preventDefault();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    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);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    e.preventDefault();
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  handleToggleMediaVisibility = () => {
 | 
					  handleToggleMediaVisibility = () => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,15 +18,10 @@ export default class StatusHeader extends PureComponent {
 | 
				
			||||||
    parseClick: PropTypes.func.isRequired,
 | 
					    parseClick: PropTypes.func.isRequired,
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //  Handles clicks on account name/image
 | 
					 | 
				
			||||||
  handleClick = (acct, e) => {
 | 
					 | 
				
			||||||
    const { parseClick } = this.props;
 | 
					 | 
				
			||||||
    parseClick(e, `/@${acct}`);
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  handleAccountClick = (e) => {
 | 
					  handleAccountClick = (e) => {
 | 
				
			||||||
    const { status } = this.props;
 | 
					    const { status, parseClick } = this.props;
 | 
				
			||||||
    this.handleClick(status.getIn(['account', 'acct']), e);
 | 
					    parseClick(e, `/@${status.getIn(['account', 'acct'])}`);
 | 
				
			||||||
 | 
					    e.stopPropagation();
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //  Rendering.
 | 
					  //  Rendering.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue