diff --git a/app/javascript/gabsocial/features/community_timeline/components/column_settings.js b/app/javascript/gabsocial/features/community_timeline/components/column_settings.js index 8250190a..7adeb674 100644 --- a/app/javascript/gabsocial/features/community_timeline/components/column_settings.js +++ b/app/javascript/gabsocial/features/community_timeline/components/column_settings.js @@ -11,7 +11,6 @@ class ColumnSettings extends React.PureComponent { settings: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - columnId: PropTypes.string, }; render () { diff --git a/app/javascript/gabsocial/features/community_timeline/containers/column_settings_container.js b/app/javascript/gabsocial/features/community_timeline/containers/column_settings_container.js index 405064c3..0a756197 100644 --- a/app/javascript/gabsocial/features/community_timeline/containers/column_settings_container.js +++ b/app/javascript/gabsocial/features/community_timeline/containers/column_settings_container.js @@ -1,26 +1,15 @@ import { connect } from 'react-redux'; import ColumnSettings from '../components/column_settings'; import { changeSetting } from '../../../actions/settings'; -import { changeColumnParams } from '../../../actions/columns'; -const mapStateToProps = (state, { columnId }) => { - const uuid = columnId; - const columns = state.getIn(['settings', 'columns']); - const index = columns.findIndex(c => c.get('uuid') === uuid); +const mapStateToProps = state => ({ + settings: state.getIn(['settings', 'community']), +}); - return { - settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'community']), - }; -}; - -const mapDispatchToProps = (dispatch, { columnId }) => { +const mapDispatchToProps = (dispatch) => { return { onChange (key, checked) { - if (columnId) { - dispatch(changeColumnParams(columnId, key, checked)); - } else { - dispatch(changeSetting(['community', ...key], checked)); - } + dispatch(changeSetting(['community', ...key], checked)); }, }; }; diff --git a/app/javascript/gabsocial/features/community_timeline/index.js b/app/javascript/gabsocial/features/community_timeline/index.js index cb8ae3d3..d987d55c 100644 --- a/app/javascript/gabsocial/features/community_timeline/index.js +++ b/app/javascript/gabsocial/features/community_timeline/index.js @@ -13,16 +13,10 @@ const messages = defineMessages({ title: { id: 'column.community', defaultMessage: 'Local timeline' }, }); -const mapStateToProps = (state, { onlyMedia, columnId }) => { - const uuid = columnId; - const columns = state.getIn(['settings', 'columns']); - const index = columns.findIndex(c => c.get('uuid') === uuid); - - return { - hasUnread: state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`, 'unread']) > 0, - onlyMedia: (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'community', 'other', 'onlyMedia']), - }; -}; +const mapStateToProps = (state, { onlyMedia }) => ({ + hasUnread: state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`, 'unread']) > 0, + onlyMedia: state.getIn(['settings', 'community', 'other', 'onlyMedia']), +}); export default @connect(mapStateToProps) @injectIntl @@ -38,7 +32,6 @@ class CommunityTimeline extends React.PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, - columnId: PropTypes.string, intl: PropTypes.object.isRequired, hasUnread: PropTypes.bool, onlyMedia: PropTypes.bool, @@ -75,7 +68,7 @@ class CommunityTimeline extends React.PureComponent { } render () { - const { intl, hasUnread, columnId, onlyMedia } = this.props; + const { intl, hasUnread, onlyMedia } = this.props; return ( @@ -86,7 +79,7 @@ class CommunityTimeline extends React.PureComponent { } diff --git a/app/javascript/gabsocial/features/direct_timeline/index.js b/app/javascript/gabsocial/features/direct_timeline/index.js index 9eab561e..1b82ae30 100644 --- a/app/javascript/gabsocial/features/direct_timeline/index.js +++ b/app/javascript/gabsocial/features/direct_timeline/index.js @@ -18,7 +18,6 @@ class DirectTimeline extends React.PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, - columnId: PropTypes.string, intl: PropTypes.object.isRequired, hasUnread: PropTypes.bool, }; @@ -45,14 +44,14 @@ class DirectTimeline extends React.PureComponent { } render () { - const { intl, hasUnread, columnId } = this.props; + const { intl, hasUnread } = this.props; return ( } diff --git a/app/javascript/gabsocial/features/favourited_statuses/index.js b/app/javascript/gabsocial/features/favourited_statuses/index.js index 81505629..439898aa 100644 --- a/app/javascript/gabsocial/features/favourited_statuses/index.js +++ b/app/javascript/gabsocial/features/favourited_statuses/index.js @@ -29,7 +29,6 @@ class Favourites extends ImmutablePureComponent { dispatch: PropTypes.func.isRequired, statusIds: ImmutablePropTypes.list.isRequired, intl: PropTypes.object.isRequired, - columnId: PropTypes.string, hasMore: PropTypes.bool, isLoading: PropTypes.bool, isMyAccount: PropTypes.bool.isRequired, @@ -44,7 +43,7 @@ class Favourites extends ImmutablePureComponent { }, 300, { leading: true }) render () { - const { intl, statusIds, columnId, hasMore, isLoading, isMyAccount } = this.props; + const { intl, statusIds, hasMore, isLoading, isMyAccount } = this.props; if (!isMyAccount) { return ( @@ -60,7 +59,7 @@ class Favourites extends ImmutablePureComponent { } alwaysPrepend - scrollKey={`group_timeline-${columnId}`} + scrollKey='group_timeline' timelineId={`group:${id}`} onLoadMore={this.handleLoadMore} emptyMessage={} diff --git a/app/javascript/gabsocial/features/hashtag_timeline/index.js b/app/javascript/gabsocial/features/hashtag_timeline/index.js index 5948af79..a89d8413 100644 --- a/app/javascript/gabsocial/features/hashtag_timeline/index.js +++ b/app/javascript/gabsocial/features/hashtag_timeline/index.js @@ -21,7 +21,6 @@ class HashtagTimeline extends React.PureComponent { static propTypes = { params: PropTypes.object.isRequired, - columnId: PropTypes.string, dispatch: PropTypes.func.isRequired, hasUnread: PropTypes.bool, }; @@ -104,17 +103,14 @@ class HashtagTimeline extends React.PureComponent { } render () { - const { hasUnread, columnId } = this.props; + const { hasUnread } = this.props; const { id } = this.props.params; return ( - - {columnId && } - - + } diff --git a/app/javascript/gabsocial/features/home_timeline/index.js b/app/javascript/gabsocial/features/home_timeline/index.js index b4a375b8..1448d44f 100644 --- a/app/javascript/gabsocial/features/home_timeline/index.js +++ b/app/javascript/gabsocial/features/home_timeline/index.js @@ -26,7 +26,6 @@ class HomeTimeline extends React.PureComponent { intl: PropTypes.object.isRequired, hasUnread: PropTypes.bool, isPartial: PropTypes.bool, - columnId: PropTypes.string, }; handleLoadMore = maxId => { @@ -67,7 +66,7 @@ class HomeTimeline extends React.PureComponent { } render () { - const { intl, hasUnread, columnId } = this.props; + const { intl, hasUnread } = this.props; return ( @@ -78,7 +77,7 @@ class HomeTimeline extends React.PureComponent { } diff --git a/app/javascript/gabsocial/features/list_timeline/index.js b/app/javascript/gabsocial/features/list_timeline/index.js index bd873b21..0dcb7662 100644 --- a/app/javascript/gabsocial/features/list_timeline/index.js +++ b/app/javascript/gabsocial/features/list_timeline/index.js @@ -36,7 +36,6 @@ class ListTimeline extends React.PureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, - columnId: PropTypes.string, hasUnread: PropTypes.bool, list: PropTypes.oneOfType([ImmutablePropTypes.map, PropTypes.bool]), intl: PropTypes.object.isRequired, @@ -69,7 +68,7 @@ class ListTimeline extends React.PureComponent { } handleDeleteClick = () => { - const { dispatch, columnId, intl } = this.props; + const { dispatch, intl } = this.props; const { id } = this.props.params; dispatch(openModal('CONFIRM', { @@ -77,18 +76,13 @@ class ListTimeline extends React.PureComponent { confirm: intl.formatMessage(messages.deleteConfirm), onConfirm: () => { dispatch(deleteList(id)); - - if (!!columnId) { - // - } else { - this.context.router.history.push('/lists'); - } + this.context.router.history.push('/lists'); }, })); } render () { - const { hasUnread, columnId, list } = this.props; + const { hasUnread, list } = this.props; const { id } = this.props.params; const title = list ? list.get('title') : id; @@ -126,7 +120,7 @@ class ListTimeline extends React.PureComponent { } diff --git a/app/javascript/gabsocial/features/notifications/index.js b/app/javascript/gabsocial/features/notifications/index.js index 011c6ecb..9c075c08 100644 --- a/app/javascript/gabsocial/features/notifications/index.js +++ b/app/javascript/gabsocial/features/notifications/index.js @@ -47,7 +47,6 @@ export default @connect(mapStateToProps) class Notifications extends React.PureComponent { static propTypes = { - columnId: PropTypes.string, notifications: ImmutablePropTypes.list.isRequired, showFilterBar: PropTypes.bool.isRequired, dispatch: PropTypes.func.isRequired, @@ -150,7 +149,7 @@ class Notifications extends React.PureComponent { const scrollContainer = ( { - const uuid = columnId; - const columns = state.getIn(['settings', 'columns']); - const index = columns.findIndex(c => c.get('uuid') === uuid); +const mapStateToProps = state => ({ + settings: state.getIn(['settings', 'public']), +}); - return { - settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'public']), - }; -}; - -const mapDispatchToProps = (dispatch, { columnId }) => { +const mapDispatchToProps = dispatch => { return { onChange (key, checked) { - if (columnId) { - dispatch(changeColumnParams(columnId, key, checked)); - } else { - dispatch(changeSetting(['public', ...key], checked)); - } + dispatch(changeSetting(['public', ...key], checked)); }, }; }; diff --git a/app/javascript/gabsocial/features/public_timeline/index.js b/app/javascript/gabsocial/features/public_timeline/index.js index 99949244..da40ca81 100644 --- a/app/javascript/gabsocial/features/public_timeline/index.js +++ b/app/javascript/gabsocial/features/public_timeline/index.js @@ -13,14 +13,12 @@ const messages = defineMessages({ title: { id: 'column.public', defaultMessage: 'Federated timeline' }, }); -const mapStateToProps = (state, { onlyMedia, columnId }) => { - const uuid = columnId; +const mapStateToProps = (state, { onlyMedia }) => { const columns = state.getIn(['settings', 'columns']); - const index = columns.findIndex(c => c.get('uuid') === uuid); return { hasUnread: state.getIn(['timelines', `public${onlyMedia ? ':media' : ''}`, 'unread']) > 0, - onlyMedia: (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'public', 'other', 'onlyMedia']), + onlyMedia: state.getIn(['settings', 'public', 'other', 'onlyMedia']), }; }; @@ -39,7 +37,6 @@ class PublicTimeline extends React.PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - columnId: PropTypes.string, hasUnread: PropTypes.bool, onlyMedia: PropTypes.bool, }; @@ -80,13 +77,13 @@ class PublicTimeline extends React.PureComponent { return ( - + } />