From 8773ab9661e89fcf31091658bce5420e0ef5ab8a Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 7 Oct 2020 19:23:18 +0200 Subject: [PATCH] Fixed error for importing old subscriptions, which added channels to the same profile multiple times --- src/renderer/components/data-settings/data-settings.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/data-settings/data-settings.js b/src/renderer/components/data-settings/data-settings.js index 4056423f..7e424938 100644 --- a/src/renderer/components/data-settings/data-settings.js +++ b/src/renderer/components/data-settings/data-settings.js @@ -149,7 +149,6 @@ export default Vue.extend({ ] const profileObject = {} - Object.keys(profileData).forEach((key) => { if (!requiredKeys.includes(key)) { const message = this.$t('Settings.Data Settings.Unknown data key') @@ -772,6 +771,7 @@ export default Vue.extend({ async convertOldFreeTubeFormatToNew(oldData) { const convertedData = [] for (const channel of oldData) { + const listOfProfilesAlreadyAdded = [] for (const profile of channel.profile) { let index = convertedData.findIndex(p => p.name === profile.value) if (index === -1) { // profile doesn't exist yet @@ -785,7 +785,10 @@ export default Vue.extend({ _id: channel._id }) index = convertedData.length - 1 + } else if (listOfProfilesAlreadyAdded.indexOf(index) !== -1) { + continue } + listOfProfilesAlreadyAdded.push(index) convertedData[index].subscriptions.push({ id: channel.channelId, name: channel.channelName,