Skip to content

Node.js based forum software built for the modern web

add roomId class to body

Barış Soner Uşaklıbc8dbc20847d
diff --git a/src/middleware/helpers.js b/src/middleware/helpers.js
index dde0c3b749..de2669bd84 100644
--- a/src/middleware/helpers.js
+++ b/src/middleware/helpers.js
@@ -41,16 +41,20 @@ helpers.buildBodyClass = function (req, res, templateData = {}) {
p = validator.escape(String(p));
parts[index] = index ? `${parts[0]}-${p}` : `page-${p || 'home'}`;
});
-
- if (templateData.template) {
- parts.push(`template-${templateData.template.name.split('/').join('-')}`);
+ const { template } = templateData;
+ if (template) {
+ parts.push(`template-${template.name.split('/').join('-')}`);
}
- if (templateData.template && templateData.template.topic) {
+ if (template && template.topic) {
parts.push(`page-topic-category-${templateData.category.cid}`);
parts.push(`page-topic-category-${slugify(templateData.category.name)}`);
}
+ if (template && template.chats && templateData.roomId) {
+ parts.push(`page-user-chats-${templateData.roomId}`);
+ }
+
if (Array.isArray(templateData.breadcrumbs)) {
templateData.breadcrumbs.forEach((crumb) => {
if (crumb && crumb.hasOwnProperty('cid')) {