mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: reversed image and icon for remote categories, omit fa icon if remote category has icon property set, #13255
This commit is contained in:
		| @@ -242,7 +242,7 @@ Mocks.category = async (actors) => { | ||||
| 		const cid = actor.id; | ||||
| 		let hostname; | ||||
| 		let { | ||||
| 			url, preferredUsername, /* icon, */ image, | ||||
| 			url, preferredUsername, icon, /* image, */ | ||||
| 			name, summary, followers, inbox, endpoints, tag, | ||||
| 		} = actor; | ||||
| 		preferredUsername = slugify(preferredUsername || name); | ||||
| @@ -256,13 +256,15 @@ Mocks.category = async (actors) => { | ||||
|  | ||||
| 		// No support for category avatars yet ;( | ||||
| 		// let picture; | ||||
| 		// if (icon) { | ||||
| 		// 	picture = typeof icon === 'string' ? icon : icon.url; | ||||
| 		// if (image) { | ||||
| 		// 	picture = typeof image === 'string' ? image : image.url; | ||||
| 		// } | ||||
| 		const iconBackgrounds = await user.getIconBackgrounds(); | ||||
| 		let bgColor = Array.prototype.reduce.call(preferredUsername, (cur, next) => cur + next.charCodeAt(), 0); | ||||
| 		bgColor = iconBackgrounds[bgColor % iconBackgrounds.length]; | ||||
|  | ||||
| 		const backgroundImage = !icon || typeof icon === 'string' ? icon : icon.url; | ||||
|  | ||||
| 		// Replace emoji in summary | ||||
| 		if (tag && Array.isArray(tag)) { | ||||
| 			tag | ||||
| @@ -281,10 +283,11 @@ Mocks.category = async (actors) => { | ||||
| 			slug: `${preferredUsername}@${hostname}`, | ||||
| 			description: summary, | ||||
| 			descriptionParsed: posts.sanitize(summary), | ||||
| 			icon: 'fa-comments', | ||||
| 			icon: backgroundImage ? 'fa-none' : 'fa-comments', | ||||
| 			color: '#fff', | ||||
| 			bgColor, | ||||
| 			backgroundImage: !image || typeof image === 'string' ? image : image.url, | ||||
| 			backgroundImage, | ||||
| 			imageClass: 'cover', | ||||
| 			// followerCount, | ||||
| 			// followingCount, | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user