Skip to content

Node.js based forum software built for the modern web

fix: reversed image and icon for remote categories, omit fa icon if remote category has icon property set, #13255

Julian Lamdabcefafd402
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js
index 8ebec0cee8..d3a56866e8 100644
--- a/src/activitypub/mocks.js
+++ b/src/activitypub/mocks.js
@@ -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,