remove subscriptions with short channel URLs #98

Merged
akinwale merged 2 commits from fix-short-channel-urls into master 2019-12-18 10:25:28 +01:00
2 changed files with 13 additions and 0 deletions
Showing only changes of commit f501f009de - Show all commits

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,15 @@ class SubscriptionsPage extends React.PureComponent {
return [Constants.ALL_PLACEHOLDER].concat(channelUris);
};
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 {
kauffj commented 2019-12-16 20:08:48 +01:00 (Migrated from github.com)
Review

// Added in v0.12, this can be dropped on or after 2/1/2020

// Added in v0.12, this can be dropped on or after 2/1/2020
suggestedChannels,