Merge pull request #160 from glitch-soc/ugly-fix-notif-clearing

workaround for notif clearing
pull/12504/head
Ondřej Hruška 8 years ago committed by GitHub
commit 1a8011648f

@ -19,38 +19,30 @@ Imports:
// Package imports // // Package imports //
import { connect } from 'react-redux'; import { connect } from 'react-redux';
// Mastodon imports //
import { makeGetNotification } from '../../../mastodon/selectors';
// Our imports // // Our imports //
import Notification from '.'; import Notification from '.';
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/* const mapStateToProps = (state, props) => {
// replace account id with object
State mapping: let leNotif = props.notification.set('account', state.getIn(['accounts', props.notification.get('account')]));
--------------
The `mapStateToProps()` function maps various state properties to the // populate markedForDelete from state - is mysteriously lost somewhere
props of our component. We wrap this in `makeMapStateToProps()` so that for (let n of state.getIn(['notifications', 'items'])) {
we only have to call `makeGetNotification()` once instead of every if (n.get('id') === props.notification.get('id')) {
time. leNotif = leNotif.set('markedForDelete', n.get('markedForDelete'));
break;
}
}
*/ return ({
notification: leNotif,
const makeMapStateToProps = () => {
const getNotification = makeGetNotification();
const mapStateToProps = (state, props) => ({
notification: getNotification(state, props.notification, props.accountId),
settings: state.get('local_settings'), settings: state.get('local_settings'),
notifCleaning: state.getIn(['notifications', 'cleaningMode']), notifCleaning: state.getIn(['notifications', 'cleaningMode']),
}); });
return mapStateToProps;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
export default connect(makeMapStateToProps)(Notification); export default connect(mapStateToProps)(Notification);

@ -11,7 +11,7 @@ import Link from 'react-router-dom/Link';
import { FormattedDate, FormattedNumber } from 'react-intl'; import { FormattedDate, FormattedNumber } from 'react-intl';
import CardContainer from '../containers/card_container'; import CardContainer from '../containers/card_container';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import Video from '../../video'; // import Video from '../../video';
import VisibilityIcon from '../../../../glitch/components/status/visibility_icon'; import VisibilityIcon from '../../../../glitch/components/status/visibility_icon';
export default class DetailedStatus extends ImmutablePureComponent { export default class DetailedStatus extends ImmutablePureComponent {
@ -37,9 +37,9 @@ export default class DetailedStatus extends ImmutablePureComponent {
e.stopPropagation(); e.stopPropagation();
} }
handleOpenVideo = startTime => { // handleOpenVideo = startTime => {
this.props.onOpenVideo(this.props.status.getIn(['media_attachments', 0]), startTime); // this.props.onOpenVideo(this.props.status.getIn(['media_attachments', 0]), startTime);
} // }
render () { render () {
const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status; const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status;

@ -26,9 +26,9 @@ describe 'about/show.html.haml', without_verify_partial_doubles: true do
header_tags = view.content_for(:header_tags) header_tags = view.content_for(:header_tags)
expect(header_tags).to match(%r{<meta content='.+' property='og:title'>}) expect(header_tags).to match(%r{<meta content=".+" property="og:title" />})
expect(header_tags).to match(%r{<meta content='website' property='og:type'>}) expect(header_tags).to match(%r{<meta content="website" property="og:type" />})
expect(header_tags).to match(%r{<meta content='.+' property='og:image'>}) expect(header_tags).to match(%r{<meta content=".+" property="og:image" />})
expect(header_tags).to match(%r{<meta content='http://.+' property='og:url'>}) expect(header_tags).to match(%r{<meta content="http://.+" property="og:url" />})
end end
end end

Loading…
Cancel
Save