Skip to content

Node.js based forum software built for the modern web

add icon to rooms based on visibility

Barış Soner Uşaklıf8e30c6d52cb
diff --git a/src/messaging/index.js b/src/messaging/index.js
index 7df98c0afc..4c6d280aaf 100644
--- a/src/messaging/index.js
+++ b/src/messaging/index.js
@@ -134,6 +134,7 @@ Messaging.getPublicRooms = async (callerUid, uid) => {
)
)
);
+
const roomData = allRoomData.filter((room, idx) => room && checks[idx]);
const roomIds = roomData.map(r => r.roomId);
const userReadTimestamps = await db.getObjectFields(
@@ -149,12 +150,16 @@ Messaging.getPublicRooms = async (callerUid, uid) => {
);
return unreadMids.length;
}));
-
+ const globalUserGroups = [
+ 'registered-users', 'verified-users', 'unverified-users', 'banned-users',
+ ];
roomData.forEach((r, idx) => {
const count = unreadCounts[idx];
r.unreadCountText = count > maxUnread ? `${maxUnread}+` : String(count);
r.unreadCount = count;
r.unread = count > 0;
+ const hasGroups = Array.isArray(r.groups) && r.groups.length;
+ r.icon = !hasGroups || r.groups.some(group => globalUserGroups.includes(group)) ? 'fa-hashtag' : 'fa-lock';
});
return roomData;