mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +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;
|
const cid = actor.id;
|
||||||
let hostname;
|
let hostname;
|
||||||
let {
|
let {
|
||||||
url, preferredUsername, /* icon, */ image,
|
url, preferredUsername, icon, /* image, */
|
||||||
name, summary, followers, inbox, endpoints, tag,
|
name, summary, followers, inbox, endpoints, tag,
|
||||||
} = actor;
|
} = actor;
|
||||||
preferredUsername = slugify(preferredUsername || name);
|
preferredUsername = slugify(preferredUsername || name);
|
||||||
@@ -256,13 +256,15 @@ Mocks.category = async (actors) => {
|
|||||||
|
|
||||||
// No support for category avatars yet ;(
|
// No support for category avatars yet ;(
|
||||||
// let picture;
|
// let picture;
|
||||||
// if (icon) {
|
// if (image) {
|
||||||
// picture = typeof icon === 'string' ? icon : icon.url;
|
// picture = typeof image === 'string' ? image : image.url;
|
||||||
// }
|
// }
|
||||||
const iconBackgrounds = await user.getIconBackgrounds();
|
const iconBackgrounds = await user.getIconBackgrounds();
|
||||||
let bgColor = Array.prototype.reduce.call(preferredUsername, (cur, next) => cur + next.charCodeAt(), 0);
|
let bgColor = Array.prototype.reduce.call(preferredUsername, (cur, next) => cur + next.charCodeAt(), 0);
|
||||||
bgColor = iconBackgrounds[bgColor % iconBackgrounds.length];
|
bgColor = iconBackgrounds[bgColor % iconBackgrounds.length];
|
||||||
|
|
||||||
|
const backgroundImage = !icon || typeof icon === 'string' ? icon : icon.url;
|
||||||
|
|
||||||
// Replace emoji in summary
|
// Replace emoji in summary
|
||||||
if (tag && Array.isArray(tag)) {
|
if (tag && Array.isArray(tag)) {
|
||||||
tag
|
tag
|
||||||
@@ -281,10 +283,11 @@ Mocks.category = async (actors) => {
|
|||||||
slug: `${preferredUsername}@${hostname}`,
|
slug: `${preferredUsername}@${hostname}`,
|
||||||
description: summary,
|
description: summary,
|
||||||
descriptionParsed: posts.sanitize(summary),
|
descriptionParsed: posts.sanitize(summary),
|
||||||
icon: 'fa-comments',
|
icon: backgroundImage ? 'fa-none' : 'fa-comments',
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
bgColor,
|
bgColor,
|
||||||
backgroundImage: !image || typeof image === 'string' ? image : image.url,
|
backgroundImage,
|
||||||
|
imageClass: 'cover',
|
||||||
// followerCount,
|
// followerCount,
|
||||||
// followingCount,
|
// followingCount,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user