mirror of
				https://git.sr.ht/~cadence/cloudtube
				synced 2025-10-31 19:45:37 +00:00 
			
		
		
		
	Show subscribed properly on /user or /c pages
This commit is contained in:
		
							parent
							
								
									a2dfeb2edc
								
							
						
					
					
						commit
						61c8e205d8
					
				| @ -11,13 +11,13 @@ module.exports = [ | |||||||
| 			const user = getUser(req) | 			const user = getUser(req) | ||||||
| 			const settings = user.getSettingsOrDefaults() | 			const settings = user.getSettingsOrDefaults() | ||||||
| 			const data = await fetchChannel(path, id, settings.instance) | 			const data = await fetchChannel(path, id, settings.instance) | ||||||
| 			const subscribed = user.isSubscribed(id) |  | ||||||
| 			const instanceOrigin = settings.instance | 			const instanceOrigin = settings.instance | ||||||
| 
 | 
 | ||||||
| 			// problem with the channel? fetchChannel has collected the necessary information for us.
 | 			// 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.
 | 			// we can render a skeleton page, display the message, and provide the option to unsubscribe.
 | ||||||
| 			if (data.error) { | 			if (data.error) { | ||||||
| 				const statusCode = data.missing ? 410 : 500 | 				const statusCode = data.missing ? 410 : 500 | ||||||
|  | 				const subscribed = user.isSubscribed(id) | ||||||
| 				return render(statusCode, "pug/channel-error.pug", {settings, data, subscribed, instanceOrigin}) | 				return render(statusCode, "pug/channel-error.pug", {settings, data, subscribed, instanceOrigin}) | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| @ -34,6 +34,7 @@ module.exports = [ | |||||||
| 					video.watched = watchedVideos.includes(video.videoId) | 					video.watched = watchedVideos.includes(video.videoId) | ||||||
| 				}) | 				}) | ||||||
| 			} | 			} | ||||||
|  | 			const subscribed = user.isSubscribed(data.authorId) | ||||||
| 			return render(200, "pug/channel.pug", {settings, data, subscribed, instanceOrigin}) | 			return render(200, "pug/channel.pug", {settings, data, subscribed, instanceOrigin}) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user