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]))
|
||||
// filter out subscriptions that already exist before concatenating
|
||||
profileObject.subscriptions = profileObject.subscriptions.filter(newSub => {
|
||||
const existingSub = primaryProfile.subscriptions.find(existingSub => existingSub.id === newSub.id)
|
||||
return !existingSub // return false if sub already exists in default profile
|
||||
const subExists = primaryProfile.subscriptions.find(existingSub => existingSub.id === newSub.id)
|
||||
return !subExists // return false if sub already exists in default profile
|
||||
})
|
||||
primaryProfile.subscriptions = primaryProfile.subscriptions.concat(profileObject.subscriptions)
|
||||
this.updateProfile(primaryProfile)
|
||||
|
@ -265,8 +265,14 @@ export default Vue.extend({
|
|||
thumbnail: channelInfo.authorThumbnails[1].url
|
||||
}
|
||||
|
||||
const subExists = primaryProfile.subscriptions.findIndex((sub) => {
|
||||
return sub.id === subscription.id || sub.name === subscription.name
|
||||
})
|
||||
|
||||
if (subExists === -1) {
|
||||
subscriptions.push(subscription)
|
||||
}
|
||||
}
|
||||
|
||||
count++
|
||||
|
||||
|
@ -362,8 +368,14 @@ export default Vue.extend({
|
|||
thumbnail: channelInfo.authorThumbnails[1].url
|
||||
}
|
||||
|
||||
const subExists = primaryProfile.subscriptions.findIndex((sub) => {
|
||||
return sub.id === subscription.id || sub.name === subscription.name
|
||||
})
|
||||
|
||||
if (subExists === -1) {
|
||||
subscriptions.push(subscription)
|
||||
}
|
||||
}
|
||||
|
||||
count++
|
||||
|
||||
|
|
Loading…
Reference in New Issue