Update Subscription List when changing profiles in a different view
This commit is contained in:
parent
09740d4edf
commit
70d5b3453f
|
@ -472,6 +472,7 @@ a:visited {
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
background: var(--scrollbar-color);
|
background: var(--scrollbar-color);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
height: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
|
|
@ -86,27 +86,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
activeProfile: async function (val) {
|
activeProfile: async function (val) {
|
||||||
if (this.allSubscriptionsList.length !== 0) {
|
this.getProfileSubscriptions()
|
||||||
this.isLoading = true
|
|
||||||
this.videoList = await Promise.all(this.allSubscriptionsList.filter((video) => {
|
|
||||||
const channelIndex = this.activeSubscriptionList.findIndex((x) => {
|
|
||||||
return x.id === video.authorId
|
|
||||||
})
|
|
||||||
|
|
||||||
const historyIndex = this.historyCache.findIndex((x) => {
|
|
||||||
return x.videoId === video.videoId
|
|
||||||
})
|
|
||||||
|
|
||||||
if (this.hideWatchedSubs) {
|
|
||||||
return channelIndex !== -1 && historyIndex === -1
|
|
||||||
} else {
|
|
||||||
return channelIndex !== -1
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
this.isLoading = false
|
|
||||||
} else {
|
|
||||||
this.getSubscriptions()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: async function () {
|
mounted: async function () {
|
||||||
|
@ -117,6 +97,7 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.profileSubscriptions.videoList.length !== 0) {
|
if (this.profileSubscriptions.videoList.length !== 0) {
|
||||||
|
if (this.profileSubscriptions.activeProfile === this.activeProfile) {
|
||||||
const subscriptionList = JSON.parse(JSON.stringify(this.profileSubscriptions))
|
const subscriptionList = JSON.parse(JSON.stringify(this.profileSubscriptions))
|
||||||
if (this.hideWatchedSubs) {
|
if (this.hideWatchedSubs) {
|
||||||
this.videoList = await Promise.all(subscriptionList.videoList.filter((video) => {
|
this.videoList = await Promise.all(subscriptionList.videoList.filter((video) => {
|
||||||
|
@ -129,6 +110,9 @@ export default Vue.extend({
|
||||||
} else {
|
} else {
|
||||||
this.videoList = subscriptionList.videoList
|
this.videoList = subscriptionList.videoList
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.getProfileSubscriptions()
|
||||||
|
}
|
||||||
|
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,6 +189,30 @@ export default Vue.extend({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getProfileSubscriptions: async function () {
|
||||||
|
if (this.allSubscriptionsList.length !== 0) {
|
||||||
|
this.isLoading = true
|
||||||
|
this.videoList = await Promise.all(this.allSubscriptionsList.filter((video) => {
|
||||||
|
const channelIndex = this.activeSubscriptionList.findIndex((x) => {
|
||||||
|
return x.id === video.authorId
|
||||||
|
})
|
||||||
|
|
||||||
|
const historyIndex = this.historyCache.findIndex((x) => {
|
||||||
|
return x.videoId === video.videoId
|
||||||
|
})
|
||||||
|
|
||||||
|
if (this.hideWatchedSubs) {
|
||||||
|
return channelIndex !== -1 && historyIndex === -1
|
||||||
|
} else {
|
||||||
|
return channelIndex !== -1
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
this.isLoading = false
|
||||||
|
} else {
|
||||||
|
this.getSubscriptions()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getChannelVideosLocalScraper: function (channel, failedAttempts = 0) {
|
getChannelVideosLocalScraper: function (channel, failedAttempts = 0) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ytch.getChannelVideos(channel.id, 'latest').then(async (response) => {
|
ytch.getChannelVideos(channel.id, 'latest').then(async (response) => {
|
||||||
|
|
Loading…
Reference in New Issue