remove subscriptions with short channel URLs (#98)
* remove subscriptions with short channel URLs * added comments
This commit is contained in:
parent
c58aecb35e
commit
53f143f232
2 changed files with 14 additions and 0 deletions
|
@ -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)),
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue