alwaysPrepend: PropTypes.bool,
emptyMessage: PropTypes.node,
timelineId: PropTypes.string.isRequired,
+ regex: PropTypes.string,
};
static defaultProps = {
const columns = state.getIn(['settings', 'columns']);
const index = columns.findIndex(c => c.get('uuid') === uuid);
const onlyMedia = (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'community', 'other', 'onlyMedia']);
+ const regex = (columnId && index >= 0) ? columns.get(index).getIn(['params', 'regex', 'body']) : state.getIn(['settings', 'community', 'regex', 'body']);
const timelineState = state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`]);
return {
hasUnread: !!timelineState && timelineState.get('unread') > 0,
onlyMedia,
+ regex,
};
};
hasUnread: PropTypes.bool,
multiColumn: PropTypes.bool,
onlyMedia: PropTypes.bool,
+ regex: PropTypes.string,
};
handlePin = () => {
onLoadMore={this.handleLoadMore}
emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The local timeline is empty. Write something publicly to get the ball rolling!' />}
bindToDocument={!multiColumn}
+ regex={this.props.regex}
/>
</Column>
);
hasAnnouncements: !state.getIn(['announcements', 'items']).isEmpty(),
unreadAnnouncements: state.getIn(['announcements', 'items']).count(item => !item.get('read')),
showAnnouncements: state.getIn(['announcements', 'show']),
+ regex: state.getIn(['settings', 'home', 'regex', 'body']),
});
export default @connect(mapStateToProps)
hasAnnouncements: PropTypes.bool,
unreadAnnouncements: PropTypes.number,
showAnnouncements: PropTypes.bool,
+ regex: PropTypes.string,
};
handlePin = () => {
timelineId='home'
emptyMessage={<FormattedMessage id='empty_column.home' defaultMessage='Your home timeline is empty! Follow more people to fill it up. {suggestions}' values={{ suggestions: <Link to='/start'><FormattedMessage id='empty_column.home.suggestions' defaultMessage='See some suggestions' /></Link> }} />}
bindToDocument={!multiColumn}
+ regex={this.props.regex}
/>
</Column>
);
const onlyMedia = (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'public', 'other', 'onlyMedia']);
const onlyRemote = (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyRemote']) : state.getIn(['settings', 'public', 'other', 'onlyRemote']);
const allowLocalOnly = (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'allowLocalOnly']) : state.getIn(['settings', 'public', 'other', 'allowLocalOnly']);
+ const regex = (columnId && index >= 0) ? columns.get(index).getIn(['params', 'regex', 'body']) : state.getIn(['settings', 'public', 'regex', 'body']);
const timelineState = state.getIn(['timelines', `public${onlyMedia ? ':media' : ''}`]);
return {
onlyMedia,
onlyRemote,
allowLocalOnly,
+ regex,
};
};
onlyMedia: PropTypes.bool,
onlyRemote: PropTypes.bool,
allowLocalOnly: PropTypes.bool,
+ regex: PropTypes.string,
};
handlePin = () => {
scrollKey={`public_timeline-${columnId}`}
emptyMessage={<FormattedMessage id='empty_column.public' defaultMessage='There is nothing here! Write something publicly, or manually follow users from other servers to fill it up' />}
bindToDocument={!multiColumn}
+ regex={this.props.regex}
/>
</Column>
);
import { debounce } from 'lodash';
import { me } from 'flavours/glitch/util/initial_state';
-const normalizeTimelineId = timelineId => {
- if (timelineId.startsWith('public:')) {
- return 'public';
- }
-
- if (timelineId.startsWith('community:')) {
- return 'community';
- }
-
- return timelineId;
-};
-
const getRegex = createSelector([
- (state, { type }) => state.getIn(['settings', normalizeTimelineId(type), 'regex', 'body']),
+ (state, { regex }) => regex,
], (rawRegex) => {
let regex = null;
});
const makeGetStatusIds = (pending = false) => createSelector([
- (state, { type }) => state.getIn(['settings', normalizeTimelineId(type)], ImmutableMap()),
+ (state, { type }) => state.getIn(['settings', type], ImmutableMap()),
(state, { type }) => state.getIn(['timelines', type, pending ? 'pendingItems' : 'items'], ImmutableList()),
(state) => state.get('statuses'),
getRegex,
const getStatusIds = makeGetStatusIds();
const getPendingStatusIds = makeGetStatusIds(true);
- const mapStateToProps = (state, { timelineId }) => ({
- statusIds: getStatusIds(state, { type: timelineId }),
+ const mapStateToProps = (state, { timelineId, regex }) => ({
+ statusIds: getStatusIds(state, { type: timelineId, regex }),
isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true),
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),