From eeb0fdcd47182c162e21313ea1e1607c7538dcad Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Thu, 20 Aug 2020 15:11:39 -0500 Subject: [PATCH] Fixed issues in StatusLikes, StatusReposts, made own pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed: - issues in StatusLikes, StatusReposts, made own pages --- .../gabsocial/features/status_likes.js | 28 ++++++++++--------- .../gabsocial/features/status_reposts.js | 23 ++++++++------- app/javascript/gabsocial/features/ui/ui.js | 5 ++-- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/app/javascript/gabsocial/features/status_likes.js b/app/javascript/gabsocial/features/status_likes.js index 7274dd25..2df14dd5 100644 --- a/app/javascript/gabsocial/features/status_likes.js +++ b/app/javascript/gabsocial/features/status_likes.js @@ -11,17 +11,17 @@ import Account from '../components/account' import ColumnIndicator from '../components/column_indicator' import ScrollableList from '../components/scrollable_list' -class StatusReposts extends ImmutablePureComponent { +class StatusLikes extends ImmutablePureComponent { componentWillMount () { - this.props.dispatch(fetchLikes(this.props.params.statusId)) - this.props.dispatch(fetchStatus(this.props.params.statusId)) + this.props.dispatch(fetchLikes(this.props.statusId)) + this.props.dispatch(fetchStatus(this.props.statusId)) } componentWillReceiveProps(nextProps) { - if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { - this.props.dispatch(fetchLikes(nextProps.params.statusId)) - this.props.dispatch(fetchStatus(nextProps.params.statusId)) + if (nextProps.statusId !== this.props.statusId && nextProps.statusId) { + this.props.dispatch(fetchLikes(nextProps.statusId)) + this.props.dispatch(fetchStatus(nextProps.statusId)) } } @@ -51,23 +51,25 @@ class StatusReposts extends ImmutablePureComponent { } const mapStateToProps = (state, props) => { + const statusId = props.params ? props.params.statusId : props.statusId + const getStatus = makeGetStatus() const status = getStatus(state, { - id: props.params.statusId, - username: props.params.username, + id: statusId }) return { status, - accountIds: state.getIn(['user_lists', 'liked_by', props.params.statusId]), + statusId, + accountIds: state.getIn(['user_lists', 'liked_by', statusId]), } } -StatusReposts.propTypes = { - params: PropTypes.object.isRequired, - dispatch: PropTypes.func.isRequired, +StatusLikes.propTypes = { accountIds: ImmutablePropTypes.list, + dispatch: PropTypes.func.isRequired, status: ImmutablePropTypes.map, + statusId: PropTypes.string.isRequired, } -export default connect(mapStateToProps)(StatusReposts) \ No newline at end of file +export default connect(mapStateToProps)(StatusLikes) \ No newline at end of file diff --git a/app/javascript/gabsocial/features/status_reposts.js b/app/javascript/gabsocial/features/status_reposts.js index 7c41423e..dcbbd72e 100644 --- a/app/javascript/gabsocial/features/status_reposts.js +++ b/app/javascript/gabsocial/features/status_reposts.js @@ -14,14 +14,14 @@ import ScrollableList from '../components/scrollable_list' class StatusReposts extends ImmutablePureComponent { componentWillMount () { - this.props.dispatch(fetchReposts(this.props.params.statusId)) - this.props.dispatch(fetchStatus(this.props.params.statusId)) + this.props.dispatch(fetchReposts(this.props.statusId)) + this.props.dispatch(fetchStatus(this.props.statusId)) } componentWillReceiveProps(nextProps) { - if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { - this.props.dispatch(fetchReposts(nextProps.params.statusId)) - this.props.dispatch(fetchStatus(nextProps.params.statusId)) + if (nextProps.statusId !== this.props.statusId && nextProps.statusId) { + this.props.dispatch(fetchReposts(nextProps.statusId)) + this.props.dispatch(fetchStatus(nextProps.statusId)) } } @@ -51,23 +51,26 @@ class StatusReposts extends ImmutablePureComponent { } const mapStateToProps = (state, props) => { + const statusId = props.params ? props.params.statusId : props.statusId + const getStatus = makeGetStatus() const status = getStatus(state, { - id: props.params.statusId, - username: props.params.username, + id: statusId, + // username: props.params.username, }) return { status, - accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]), + statusId, + accountIds: state.getIn(['user_lists', 'reblogged_by', statusId]), } } StatusReposts.propTypes = { - params: PropTypes.object.isRequired, - dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, + dispatch: PropTypes.func.isRequired, status: ImmutablePropTypes.map, + statusId: PropTypes.string.isRequired, } export default connect(mapStateToProps)(StatusReposts) \ No newline at end of file diff --git a/app/javascript/gabsocial/features/ui/ui.js b/app/javascript/gabsocial/features/ui/ui.js index 94652b68..3df22c59 100644 --- a/app/javascript/gabsocial/features/ui/ui.js +++ b/app/javascript/gabsocial/features/ui/ui.js @@ -245,12 +245,11 @@ class SwitchingArea extends React.PureComponent { - { /* - + - */ } +