Merge pull request #613 from GilgusMaximus/development

Fixed error for importing old subscriptions, which added channels multiple times to profiles
This commit is contained in:
Luca Hohmann 2020-10-07 19:28:26 +02:00 committed by GitHub
commit 03ea158f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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,