remove subscriptions with short channel URLs #98
2 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
|
doChannelUnsubscribe,
|
||||||
doFetchMySubscriptions,
|
doFetchMySubscriptions,
|
||||||
doSetViewMode,
|
doSetViewMode,
|
||||||
doFetchRecommendedSubscriptions,
|
doFetchRecommendedSubscriptions,
|
||||||
|
@ -36,6 +37,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
channelUnsubscribe: subscription => dispatch(doChannelUnsubscribe(subscription)),
|
||||||
doFetchMySubscriptions: () => dispatch(doFetchMySubscriptions()),
|
doFetchMySubscriptions: () => dispatch(doFetchMySubscriptions()),
|
||||||
doFetchRecommendedSubscriptions: () => dispatch(doFetchRecommendedSubscriptions()),
|
doFetchRecommendedSubscriptions: () => dispatch(doFetchRecommendedSubscriptions()),
|
||||||
doSetViewMode: viewMode => dispatch(doSetViewMode(viewMode)),
|
doSetViewMode: viewMode => dispatch(doSetViewMode(viewMode)),
|
||||||
|
|
|
@ -82,6 +82,8 @@ class SubscriptionsPage extends React.PureComponent {
|
||||||
if (Constants.DRAWER_ROUTE_SUBSCRIPTIONS === currentRoute && currentRoute !== prevRoute) {
|
if (Constants.DRAWER_ROUTE_SUBSCRIPTIONS === currentRoute && currentRoute !== prevRoute) {
|
||||||
this.onComponentFocused();
|
this.onComponentFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.unsubscribeShortChannelUrls();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSortByItemSelected = item => {
|
handleSortByItemSelected = item => {
|
||||||
|
@ -109,6 +111,15 @@ class SubscriptionsPage extends React.PureComponent {
|
||||||
return [Constants.ALL_PLACEHOLDER].concat(channelUris);
|
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() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
|||||||
suggestedChannels,
|
suggestedChannels,
|
||||||
|
|
Loading…
Reference in a new issue
// Added in v0.12, this can be dropped on or after 2/1/2020