mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-30 11:18:22 +02:00
refactor: generateTopicClass
This commit is contained in:
@@ -125,29 +125,8 @@ module.exports = function (utils, Benchpress, relative_path) {
|
||||
}
|
||||
|
||||
function generateTopicClass(topic) {
|
||||
const style = [];
|
||||
|
||||
if (topic.locked) {
|
||||
style.push('locked');
|
||||
}
|
||||
|
||||
if (topic.pinned) {
|
||||
style.push('pinned');
|
||||
}
|
||||
|
||||
if (topic.deleted) {
|
||||
style.push('deleted');
|
||||
}
|
||||
|
||||
if (topic.unread) {
|
||||
style.push('unread');
|
||||
}
|
||||
|
||||
if (topic.scheduled) {
|
||||
style.push('scheduled');
|
||||
}
|
||||
|
||||
return style.join(' ');
|
||||
const fields = ['locked', 'pinned', 'deleted', 'unread', 'scheduled'];
|
||||
return fields.filter(field => !!topic[field]).join(' ');
|
||||
}
|
||||
|
||||
// Groups helpers
|
||||
|
||||
Reference in New Issue
Block a user