Prevent subscriptions from showing up twice on OPML and NewPipe imports
This commit is contained in:
parent
47f7f01a24
commit
4ce826b59e
|
@ -171,8 +171,8 @@ export default Vue.extend({
|
||||||
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))
|
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))
|
||||||
// filter out subscriptions that already exist before concatenating
|
// filter out subscriptions that already exist before concatenating
|
||||||
profileObject.subscriptions = profileObject.subscriptions.filter(newSub => {
|
profileObject.subscriptions = profileObject.subscriptions.filter(newSub => {
|
||||||
const existingSub = primaryProfile.subscriptions.find(existingSub => existingSub.id === newSub.id)
|
const subExists = primaryProfile.subscriptions.find(existingSub => existingSub.id === newSub.id)
|
||||||
return !existingSub // return false if sub already exists in default profile
|
return !subExists // return false if sub already exists in default profile
|
||||||
})
|
})
|
||||||
primaryProfile.subscriptions = primaryProfile.subscriptions.concat(profileObject.subscriptions)
|
primaryProfile.subscriptions = primaryProfile.subscriptions.concat(profileObject.subscriptions)
|
||||||
this.updateProfile(primaryProfile)
|
this.updateProfile(primaryProfile)
|
||||||
|
@ -265,7 +265,13 @@ export default Vue.extend({
|
||||||
thumbnail: channelInfo.authorThumbnails[1].url
|
thumbnail: channelInfo.authorThumbnails[1].url
|
||||||
}
|
}
|
||||||
|
|
||||||
subscriptions.push(subscription)
|
const subExists = primaryProfile.subscriptions.findIndex((sub) => {
|
||||||
|
return sub.id === subscription.id || sub.name === subscription.name
|
||||||
|
})
|
||||||
|
|
||||||
|
if (subExists === -1) {
|
||||||
|
subscriptions.push(subscription)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
count++
|
count++
|
||||||
|
@ -362,7 +368,13 @@ export default Vue.extend({
|
||||||
thumbnail: channelInfo.authorThumbnails[1].url
|
thumbnail: channelInfo.authorThumbnails[1].url
|
||||||
}
|
}
|
||||||
|
|
||||||
subscriptions.push(subscription)
|
const subExists = primaryProfile.subscriptions.findIndex((sub) => {
|
||||||
|
return sub.id === subscription.id || sub.name === subscription.name
|
||||||
|
})
|
||||||
|
|
||||||
|
if (subExists === -1) {
|
||||||
|
subscriptions.push(subscription)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
count++
|
count++
|
||||||
|
|
Loading…
Reference in New Issue