From c03cbb9471be1437f3cf1671b7592966db9c5c0b Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 27 May 2018 21:23:56 +0200 Subject: [PATCH] [Glitch] Save onlyMedia prop when pinning column Port 5ea643b27908b14bd89ff068fc87e446e8cbcd32 to glitch-soc --- .../glitch/features/community_timeline/index.js | 13 +++++++++---- .../glitch/features/public_timeline/index.js | 13 +++++++++---- .../glitch/features/ui/components/columns_area.js | 3 ++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/javascript/flavours/glitch/features/community_timeline/index.js b/app/javascript/flavours/glitch/features/community_timeline/index.js index 0bf0c1cd343..3efb4a32f28 100644 --- a/app/javascript/flavours/glitch/features/community_timeline/index.js +++ b/app/javascript/flavours/glitch/features/community_timeline/index.js @@ -1,7 +1,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { NavLink } from 'react-router-dom'; +import { NavLink, Link } from 'react-router-dom'; import PropTypes from 'prop-types'; import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; import Column from 'flavours/glitch/components/column'; @@ -37,12 +37,12 @@ export default class CommunityTimeline extends React.PureComponent { }; handlePin = () => { - const { columnId, dispatch } = this.props; + const { columnId, dispatch, onlyMedia } = this.props; if (columnId) { dispatch(removeColumn(columnId)); } else { - dispatch(addColumn('COMMUNITY', {})); + dispatch(addColumn('COMMUNITY', { other: { onlyMedia } })); } } @@ -83,7 +83,12 @@ export default class CommunityTimeline extends React.PureComponent { const { intl, hasUnread, columnId, multiColumn, onlyMedia } = this.props; const pinned = !!columnId; - const headline = ( + const headline = pinned ? ( +
+ + +
+ ) : (
diff --git a/app/javascript/flavours/glitch/features/public_timeline/index.js b/app/javascript/flavours/glitch/features/public_timeline/index.js index daaa9b6caff..8e27bcd7c4f 100644 --- a/app/javascript/flavours/glitch/features/public_timeline/index.js +++ b/app/javascript/flavours/glitch/features/public_timeline/index.js @@ -1,7 +1,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { NavLink } from 'react-router-dom'; +import { NavLink, Link } from 'react-router-dom'; import PropTypes from 'prop-types'; import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; import Column from 'flavours/glitch/components/column'; @@ -37,12 +37,12 @@ export default class PublicTimeline extends React.PureComponent { }; handlePin = () => { - const { columnId, dispatch } = this.props; + const { columnId, dispatch, onlyMedia } = this.props; if (columnId) { dispatch(removeColumn(columnId)); } else { - dispatch(addColumn('PUBLIC', {})); + dispatch(addColumn('PUBLIC', { other: { onlyMedia } })); } } @@ -83,7 +83,12 @@ export default class PublicTimeline extends React.PureComponent { const { intl, columnId, hasUnread, multiColumn, onlyMedia } = this.props; const pinned = !!columnId; - const headline = ( + const headline = pinned ? ( +
+ + +
+ ) : (
diff --git a/app/javascript/flavours/glitch/features/ui/components/columns_area.js b/app/javascript/flavours/glitch/features/ui/components/columns_area.js index 71cb7e8c948..65a63294b53 100644 --- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js +++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js @@ -179,10 +179,11 @@ export default class ColumnsArea extends ImmutablePureComponent {
{columns.map(column => { const params = column.get('params', null) === null ? null : column.get('params').toJS(); + const other = params && params.other ? params.other : {}; return ( - {SpecificComponent => } + {SpecificComponent => } ); })}