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:
		
						commit
						03ea158f24
					
				| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue