Compare commits

...

2 commits

Author SHA1 Message Date
Akinwale Ariwodola
f528312892 added comments 2019-12-18 10:24:35 +01:00
Akinwale Ariwodola
f501f009de remove subscriptions with short channel URLs 2019-12-15 12:14:26 +01:00
2 changed files with 14 additions and 0 deletions

View file

@ -1,5 +1,6 @@
import { connect } from 'react-redux';
import {
doChannelUnsubscribe,
doFetchMySubscriptions,
doSetViewMode,
doFetchRecommendedSubscriptions,
@ -36,6 +37,7 @@ const select = state => ({
});
const perform = dispatch => ({
channelUnsubscribe: subscription => dispatch(doChannelUnsubscribe(subscription)),
doFetchMySubscriptions: () => dispatch(doFetchMySubscriptions()),
doFetchRecommendedSubscriptions: () => dispatch(doFetchRecommendedSubscriptions()),
doSetViewMode: viewMode => dispatch(doSetViewMode(viewMode)),

View file

@ -82,6 +82,8 @@ class SubscriptionsPage extends React.PureComponent {
if (Constants.DRAWER_ROUTE_SUBSCRIPTIONS === currentRoute && currentRoute !== prevRoute) {
this.onComponentFocused();
}
this.unsubscribeShortChannelUrls();
}
handleSortByItemSelected = item => {
@ -109,6 +111,16 @@ class SubscriptionsPage extends React.PureComponent {
return [Constants.ALL_PLACEHOLDER].concat(channelUris);
};
// Added in 0.12.1. Can be dropped on or after 1 Feb 2020.
unsubscribeShortChannelUrls = () => {
// this should only have to happen once
const { subscribedChannels, channelUnsubscribe } = this.props;
const badSubs = subscribedChannels.filter(sub => sub.uri.split('#')[1].length < 5);
if (badSubs.length > 0) {
badSubs.forEach(sub => channelUnsubscribe(sub));
}
};
render() {
const {
suggestedChannels,