Fix: unsubsribe action removes all with same name

## Repro
- Do a search like "Test" and filter to "Channels Only".
- Follow a bunch @test channels
- Unfollow any one of them. All of them gets unfollowed.

## Notes
The change in b9fc9b63 to compare the lower-case channel name probably made it even worse, since "@TeSt" would be removed too.

## Change
Not sure why channel name was used in the first place ... perhaps it was to cover canon vs perm uri?

Anyway, comparing uri makes more sense, so doing that instead.
This commit is contained in:
infinite-persistence 2021-12-29 12:16:26 +08:00 committed by Thomas Zarebczan
parent c04023948b
commit c5e690c657

View file

@ -50,9 +50,7 @@ export default handleActions(
const subscriptionToRemove: Subscription = action.data;
const newSubscriptions = state.subscriptions
.slice()
.filter(
(subscription) => subscription.channelName.toLowerCase() !== subscriptionToRemove.channelName.toLowerCase()
);
.filter((subscription) => subscription.uri !== subscriptionToRemove.uri);
const newFollowing = state.following
.slice()
.filter((subscription) => subscription.uri !== subscriptionToRemove.uri);