From 8ccb71066535ca17c2d89d71c2a747dbdffe94f6 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Thu, 18 Jul 2019 00:59:54 -0400 Subject: [PATCH] Updated status component to use properStatus when going to status page Takes into account if is reblog or not and uses the original poster information if so, otherwise use status url as normal. Fixes issue with clicking on status and it goes to wrong url of the reposter and shows error message. --- app/javascript/gabsocial/components/status.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/javascript/gabsocial/components/status.js b/app/javascript/gabsocial/components/status.js index 74c75fe7..bc72ffed 100644 --- a/app/javascript/gabsocial/components/status.js +++ b/app/javascript/gabsocial/components/status.js @@ -168,8 +168,7 @@ class Status extends ImmutablePureComponent { return; } - const { status } = this.props; - this.context.router.history.push(`/${status.getIn(['account', 'acct'])}/posts/${status.getIn(['reblog', 'id'], status.get('id'))}`); + this.context.router.history.push(`/${this._properStatus().getIn(['account', 'acct'])}/posts/${this._properStatus().get('id')}`); } handleExpandClick = (e) => { @@ -178,12 +177,7 @@ class Status extends ImmutablePureComponent { return; } - const { status } = this.props; - - const isReblog = !!status.getIn(['reblog', 'id']); - const originalPosterUsername = isReblog ? status.getIn(['reblog', 'account', 'acct']) : status.getIn(['account', 'acct']); - - this.context.router.history.push(`/${originalPosterUsername}/posts/${status.getIn(['reblog', 'id'], status.get('id'))}`); + this.context.router.history.push(`/${this._properStatus().getIn(['account', 'acct'])}/posts/${this._properStatus().get('id')}`); } } @@ -222,7 +216,7 @@ class Status extends ImmutablePureComponent { } handleHotkeyOpen = () => { - this.context.router.history.push(`/${status.getIn(['account', 'acct'])}/posts/${this._properStatus().get('id')}`); + this.context.router.history.push(`/${this._properStatus().getIn(['account', 'acct'])}/posts/${this._properStatus().get('id')}`); } handleHotkeyOpenProfile = () => {