From 51fe1532f17315d718823276068d9c8b1b2a76b2 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Tue, 9 Jul 2024 11:42:21 +0200 Subject: [PATCH] Fix undefined function to load a message --- docs/CHANGELOG.md | 1 + resources/js/humhub.mail.notification.js | 2 +- resources/js/humhub.mail.notification.min.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 36f45eb..11a90e2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,7 @@ Changelog - Fix #389: Fix notification about participant joining - Fix #396: Don't override global styles - Enh #397: Use PHP CS Fixer +- Fix #402: Fix undefined function to load a message 3.2.1 (April 15, 2024) ---------------------- diff --git a/resources/js/humhub.mail.notification.js b/resources/js/humhub.mail.notification.js index f5d8de8..790bc8c 100644 --- a/resources/js/humhub.mail.notification.js +++ b/resources/js/humhub.mail.notification.js @@ -80,7 +80,7 @@ humhub.module('mail.notification', function (module, require, $) { var loadMessage = function (evt) { var root = Widget.instance('#mail-conversation-root'); - if (root) { + if (root && typeof(root.loadMessage) === 'function') { root.loadMessage(evt); root.$.closest('.container').addClass('mail-conversation-single-message'); } else { diff --git a/resources/js/humhub.mail.notification.min.js b/resources/js/humhub.mail.notification.min.js index 33c0183..89f505a 100644 --- a/resources/js/humhub.mail.notification.min.js +++ b/resources/js/humhub.mail.notification.min.js @@ -1 +1 @@ -humhub.module("mail.notification",function(o,e,i){function n(){s.get(o.config.url.count).then(function(e){l(parseInt(e.newMessages))})}var a,s=e("client"),r=e("ui.loader"),t=e("event"),u=e("ui.widget").Widget,c=0,l=(o.initOnPjaxLoad=!0,function(e){var n=i("#badge-messages");e&&0!==parseInt(e)?(c=e,n.empty(),n.append(e),n.fadeIn("fast")):(n.css("display","none"),c=0),t.trigger("humhub:modules:notification:UpdateTitleNotificationCount")});o.export({init:function(e){e||(t.on("humhub:modules:mail:live:NewUserMessage",function(e,n){n=n[n.length-1];l(n.data.count)}).on("humhub:modules:mail:live:UserMessageDeleted",function(e,n){n=n[n.length-1];l(n.data.count)}),i("#icon-messages").click(function(){a&&a.abort();const n=i("#loader_messages"),t=n.parent();n.parent().find(":not(#loader_messages)").remove(),r.set(n.show()),s.get(o.config.url.list,{beforeSend:function(e){a=e}}).then(function(e){a=void 0,t.prepend(i(e.html)),n.hide(),t.niceScroll({cursorwidth:"7",cursorborder:"",cursorcolor:"#555",cursoropacitymax:"0.2",nativeparentscrolling:!1,railpadding:{top:0,right:3,left:0,bottom:0}})})})),n()},loadMessage:function(e){var n=u.instance("#mail-conversation-root");n?(n.loadMessage(e),n.$.closest(".container").addClass("mail-conversation-single-message")):s.redirect(e.url),e.finish()},setMailMessageCount:l,updateCount:n,getNewMessageCount:function(){return c}})}); \ No newline at end of file +humhub.module("mail.notification",function(o,e,i){function n(){s.get(o.config.url.count).then(function(e){l(parseInt(e.newMessages))})}var a,s=e("client"),r=e("ui.loader"),t=e("event"),u=e("ui.widget").Widget,c=0,l=(o.initOnPjaxLoad=!0,function(e){var n=i("#badge-messages");e&&0!==parseInt(e)?(c=e,n.empty(),n.append(e),n.fadeIn("fast")):(n.css("display","none"),c=0),t.trigger("humhub:modules:notification:UpdateTitleNotificationCount")});o.export({init:function(e){e||(t.on("humhub:modules:mail:live:NewUserMessage",function(e,n){n=n[n.length-1];l(n.data.count)}).on("humhub:modules:mail:live:UserMessageDeleted",function(e,n){n=n[n.length-1];l(n.data.count)}),i("#icon-messages").click(function(){a&&a.abort();const n=i("#loader_messages"),t=n.parent();n.parent().find(":not(#loader_messages)").remove(),r.set(n.show()),s.get(o.config.url.list,{beforeSend:function(e){a=e}}).then(function(e){a=void 0,t.prepend(i(e.html)),n.hide(),t.niceScroll({cursorwidth:"7",cursorborder:"",cursorcolor:"#555",cursoropacitymax:"0.2",nativeparentscrolling:!1,railpadding:{top:0,right:3,left:0,bottom:0}})})})),n()},loadMessage:function(e){var n=u.instance("#mail-conversation-root");n&&"function"==typeof n.loadMessage?(n.loadMessage(e),n.$.closest(".container").addClass("mail-conversation-single-message")):s.redirect(e.url),e.finish()},setMailMessageCount:l,updateCount:n,getNewMessageCount:function(){return c}})}); \ No newline at end of file