mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	fix: serve category actor image instead of nothing, serve brand logo in icon
This commit is contained in:
		| @@ -204,18 +204,28 @@ Mocks.actors.user = async (uid) => { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| Mocks.actors.category = async (cid) => { | Mocks.actors.category = async (cid) => { | ||||||
| 	let { | 	const { | ||||||
| 		name, handle: preferredUsername, slug, | 		name, handle: preferredUsername, slug, | ||||||
| 		descriptionParsed: summary, backgroundImage, | 		descriptionParsed: summary, backgroundImage, | ||||||
| 	} = await categories.getCategoryData(cid); | 	} = await categories.getCategoryData(cid); | ||||||
| 	const publicKey = await activitypub.getPublicKey('cid', cid); | 	const publicKey = await activitypub.getPublicKey('cid', cid); | ||||||
|  |  | ||||||
| 	backgroundImage = backgroundImage || meta.config['brand:logo'] || `${nconf.get('relative_path')}/assets/logo.png`; | 	let image; | ||||||
| 	const filename = path.basename(utils.decodeHTMLEntities(backgroundImage)); | 	if (backgroundImage) { | ||||||
| 	backgroundImage = { | 		const filename = path.basename(utils.decodeHTMLEntities(backgroundImage)); | ||||||
|  | 		image = { | ||||||
|  | 			type: 'Image', | ||||||
|  | 			mediaType: mime.getType(filename), | ||||||
|  | 			url: `${nconf.get('url')}${utils.decodeHTMLEntities(backgroundImage)}`, | ||||||
|  | 		}; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	let icon = meta.config['brand:logo'] || `${nconf.get('relative_path')}/assets/logo.png`; | ||||||
|  | 	const filename = path.basename(utils.decodeHTMLEntities(icon)); | ||||||
|  | 	icon = { | ||||||
| 		type: 'Image', | 		type: 'Image', | ||||||
| 		mediaType: mime.getType(filename), | 		mediaType: mime.getType(filename), | ||||||
| 		url: `${nconf.get('url')}${utils.decodeHTMLEntities(backgroundImage)}`, | 		url: `${nconf.get('url')}${utils.decodeHTMLEntities(icon)}`, | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	return { | 	return { | ||||||
| @@ -234,7 +244,8 @@ Mocks.actors.category = async (cid) => { | |||||||
| 		name, | 		name, | ||||||
| 		preferredUsername, | 		preferredUsername, | ||||||
| 		summary, | 		summary, | ||||||
| 		icon: backgroundImage, | 		image, | ||||||
|  | 		icon, | ||||||
|  |  | ||||||
| 		publicKey: { | 		publicKey: { | ||||||
| 			id: `${nconf.get('url')}/category/${cid}#key`, | 			id: `${nconf.get('url')}/category/${cid}#key`, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user