mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-05-26 12:32:25 +00:00
Rework subscribing to deleted channels
This commit is contained in:
parent
15e3f06ad6
commit
109dcd22de
12 changed files with 167 additions and 22 deletions
|
|
@ -13,6 +13,16 @@ module.exports = [
|
|||
const data = await fetchChannel(id, settings.instance)
|
||||
const subscribed = user.isSubscribed(id)
|
||||
const instanceOrigin = settings.instance
|
||||
|
||||
// problem with the channel? fetchChannel has collected the necessary information for us.
|
||||
// we can render a skeleton page, display the message, and provide the option to unsubscribe.
|
||||
if (data.error) {
|
||||
const statusCode = data.missing ? 410 : 500
|
||||
return render(statusCode, "pug/channel-error.pug", {settings, data, subscribed, instanceOrigin})
|
||||
}
|
||||
|
||||
// everything is fine
|
||||
|
||||
// normalise info, apply watched status
|
||||
if (!data.second__subCountText && data.subCount) {
|
||||
data.second__subCountText = converters.subscriberCountToText(data.subCount)
|
||||
|
|
@ -24,7 +34,7 @@ module.exports = [
|
|||
video.watched = watchedVideos.includes(video.videoId)
|
||||
})
|
||||
}
|
||||
return render(200, "pug/channel.pug", {settings, url, data, subscribed, instanceOrigin})
|
||||
return render(200, "pug/channel.pug", {settings, data, subscribed, instanceOrigin})
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue