From 61c8e205d8d81471e4e13f0636666655b1531f24 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 16 Sep 2022 17:18:51 +1200 Subject: [PATCH] Show subscribed properly on /user or /c pages --- api/channels.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/channels.js b/api/channels.js index c0df993..be2c9e9 100644 --- a/api/channels.js +++ b/api/channels.js @@ -11,13 +11,13 @@ module.exports = [ const user = getUser(req) const settings = user.getSettingsOrDefaults() const data = await fetchChannel(path, 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 + const subscribed = user.isSubscribed(id) return render(statusCode, "pug/channel-error.pug", {settings, data, subscribed, instanceOrigin}) } @@ -34,6 +34,7 @@ module.exports = [ video.watched = watchedVideos.includes(video.videoId) }) } + const subscribed = user.isSubscribed(data.authorId) return render(200, "pug/channel.pug", {settings, data, subscribed, instanceOrigin}) } } -- 2.45.2