fix: filter:taskbar.push to use hooks module

main
Julian Lam 3 years ago
parent 671387936e
commit df02630b25

@ -2,7 +2,7 @@
"name": "nodebb-theme-persona", "name": "nodebb-theme-persona",
"version": "11.1.3", "version": "11.1.3",
"nbbpm": { "nbbpm": {
"compatibility": "^1.17.0" "compatibility": "^1.18.0"
}, },
"description": "Persona theme for NodeBB", "description": "Persona theme for NodeBB",
"main": "library.js", "main": "library.js",

@ -95,24 +95,26 @@ $(document).ready(function () {
} }
function setupTaskbar() { function setupTaskbar() {
$(window).on('filter:taskbar.push', function (ev, data) { require(['hooks'], (hooks) => {
data.options.className = 'taskbar-' + data.module; hooks.on('filter:taskbar.push', (data) => {
if (data.module === 'composer') { data.options.className = 'taskbar-' + data.module;
data.options.icon = 'fa-commenting-o'; if (data.module === 'composer') {
} else if (data.module === 'chat') { data.options.icon = 'fa-commenting-o';
if (data.element.length && !data.element.hasClass('active')) { } else if (data.module === 'chat') {
increaseChatCount(data.element); if (data.element.length && !data.element.hasClass('active')) {
increaseChatCount(data.element);
}
} }
} });
}); hooks.on('action:taskbar.pushed', (data) => {
$(window).on('action:taskbar.pushed', function (ev, data) { if (data.module === 'chat') {
if (data.module === 'chat') { createChatIcon(data);
createChatIcon(data); var elData = data.element.data();
var elData = data.element.data(); if (elData && elData.options && !elData.options.isSelf) {
if (elData && elData.options && !elData.options.isSelf) { increaseChatCount(data.element);
increaseChatCount(data.element); }
} }
} });
}); });
socket.on('event:chats.markedAsRead', function (data) { socket.on('event:chats.markedAsRead', function (data) {

Loading…
Cancel
Save