diff --git a/extensions/pusher/js/dist/forum.js b/extensions/pusher/js/dist/forum.js index 379a9279b..c14220c1d 100644 --- a/extensions/pusher/js/dist/forum.js +++ b/extensions/pusher/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var s=t[o]={i:o,l:!1,exports:{}};return e[o].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(o,s,function(t){return e[t]}.bind(null,s));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t){e.exports=flarum.core.compat.app},function(e,t){e.exports=flarum.core.compat.extend},function(e,t){e.exports=flarum.core.compat["components/DiscussionList"]},function(e,t){e.exports=flarum.core.compat["components/IndexPage"]},function(e,t){e.exports=flarum.core.compat["components/DiscussionPage"]},function(e,t){e.exports=flarum.core.compat["components/Button"]},,,function(e,t,n){"use strict";n.r(t);var o=n(1),s=n(0),r=n.n(s),i=n(2),u=n.n(i),a=n(4),c=n.n(a),d=n(3),p=n.n(d),f=n(5),l=n.n(f);r.a.initializers.add("flarum-pusher",(function(){var e=m.deferred();$.getScript("//cdn.jsdelivr.net/npm/pusher-js@3.0.0/dist/pusher.min.js",(function(){var t=new Pusher(r.a.forum.attribute("pusherKey"),{authEndpoint:r.a.forum.attribute("apiUrl")+"/pusher/auth",cluster:r.a.forum.attribute("pusherCluster"),auth:{headers:{"X-CSRF-Token":r.a.session.csrfToken}}});e.resolve({main:t.subscribe("public"),user:r.a.session.user?t.subscribe("private-user"+r.a.session.user.id()):null})})),r.a.pusher=e.promise,r.a.pushedUpdates=[],Object(o.extend)(u.a.prototype,"config",(function(e,t,n){var s=this;t||r.a.pusher.then((function(e){e.main.bind("newPost",(function(e){var t=s.props.params;if(!t.q&&!t.sort&&!t.filter){if(t.tags){var n=r.a.store.getBy("tags","slug",t.tags);if(-1===e.tagIds.indexOf(n.id()))return}var o=String(e.discussionId);r.a.current.discussion&&o===r.a.current.discussion.id()||-1!==r.a.pushedUpdates.indexOf(o)||(r.a.pushedUpdates.push(o),r.a.current instanceof p.a&&r.a.setTitleCount(r.a.pushedUpdates.length),m.redraw())}})),Object(o.extend)(n,"onunload",(function(){return e.main.unbind("newPost")}))}))})),Object(o.extend)(u.a.prototype,"view",(function(e){var t=this;if(r.a.pushedUpdates){var n=r.a.pushedUpdates.length;n&&e.children.unshift(l.a.component({className:"Button Button--block DiscussionList-update",onclick:function(){t.refresh(!1).then((function(){t.loadingUpdated=!1,r.a.pushedUpdates=[],r.a.setTitleCount(0),m.redraw()})),t.loadingUpdated=!0},loading:this.loadingUpdated,children:r.a.translator.transChoice("flarum-pusher.forum.discussion_list.show_updates_text",n,{count:n})}))}})),Object(o.extend)(u.a.prototype,"addDiscussion",(function(e,t){var n=r.a.pushedUpdates.indexOf(t.id());-1!==n&&r.a.pushedUpdates.splice(n,1),r.a.current instanceof p.a&&r.a.setTitleCount(r.a.pushedUpdates.length),m.redraw()})),Object(o.extend)(c.a.prototype,"config",(function(e,t,n){var s=this;t||r.a.pusher.then((function(e){e.main.bind("newPost",(function(e){var t=String(e.discussionId);if(s.discussion&&s.discussion.id()===t&&s.stream){var n=s.discussion.commentCount();r.a.store.find("discussions",s.discussion.id()).then((function(){s.stream.update(),document.hasFocus()||(r.a.setTitleCount(Math.max(0,s.discussion.commentCount()-n)),$(window).one("focus",(function(){return r.a.setTitleCount(0)})))}))}})),Object(o.extend)(n,"onunload",(function(){return e.main.unbind("newPost")}))}))})),Object(o.extend)(p.a.prototype,"actionItems",(function(e){e.remove("refresh")})),r.a.pusher.then((function(e){e.user&&e.user.bind("notification",(function(){r.a.session.user.pushAttributes({unreadNotificationCount:r.a.session.user.unreadNotificationCount()+1,newNotificationCount:r.a.session.user.newNotificationCount()+1}),delete r.a.cache.notifications,m.redraw()}))}))}))}]); +module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(s,o,function(t){return e[t]}.bind(null,o));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t){e.exports=flarum.core.compat.app},function(e,t){e.exports=flarum.core.compat.extend},function(e,t){e.exports=flarum.core.compat["components/DiscussionList"]},function(e,t){e.exports=flarum.core.compat["components/IndexPage"]},function(e,t){e.exports=flarum.core.compat["components/DiscussionPage"]},function(e,t){e.exports=flarum.core.compat["components/Button"]},,,function(e,t,n){"use strict";n.r(t);var s=n(1),o=n(0),r=n.n(o),i=n(2),u=n.n(i),a=n(4),c=n.n(a),d=n(3),p=n.n(d),f=n(5),l=n.n(f);r.a.initializers.add("flarum-pusher",(function(){var e=m.deferred();$.getScript("//cdn.jsdelivr.net/npm/pusher-js@3.0.0/dist/pusher.min.js",(function(){var t=new Pusher(r.a.forum.attribute("pusherKey"),{authEndpoint:r.a.forum.attribute("apiUrl")+"/pusher/auth",cluster:r.a.forum.attribute("pusherCluster"),auth:{headers:{"X-CSRF-Token":r.a.session.csrfToken}}});e.resolve({main:t.subscribe("public"),user:r.a.session.user?t.subscribe("private-user"+r.a.session.user.id()):null})})),r.a.pusher=e.promise,r.a.pushedUpdates=[],Object(s.extend)(u.a.prototype,"config",(function(e,t,n){t||r.a.pusher.then((function(e){e.main.bind("newPost",(function(e){var t=r.a.discussions.getParams();if(!t.q&&!t.sort&&!t.filter){if(t.tags){var n=r.a.store.getBy("tags","slug",t.tags);if(-1===e.tagIds.indexOf(n.id()))return}var s=String(e.discussionId);r.a.current.get("discussion")&&s===r.a.current.get("discussion").id()||-1!==r.a.pushedUpdates.indexOf(s)||(r.a.pushedUpdates.push(s),r.a.current.matches(p.a)&&r.a.setTitleCount(r.a.pushedUpdates.length),m.redraw())}})),Object(s.extend)(n,"onunload",(function(){return e.main.unbind("newPost")}))}))})),Object(s.extend)(u.a.prototype,"view",(function(e){var t=this;if(r.a.pushedUpdates){var n=r.a.pushedUpdates.length;n&&e.children.unshift(l.a.component({className:"Button Button--block DiscussionList-update",onclick:function(){t.refresh(!1).then((function(){t.loadingUpdated=!1,r.a.pushedUpdates=[],r.a.setTitleCount(0),m.redraw()})),t.loadingUpdated=!0},loading:this.loadingUpdated,children:r.a.translator.transChoice("flarum-pusher.forum.discussion_list.show_updates_text",n,{count:n})}))}})),Object(s.extend)(u.a.prototype,"addDiscussion",(function(e,t){var n=r.a.pushedUpdates.indexOf(t.id());-1!==n&&r.a.pushedUpdates.splice(n,1),r.a.current.matches(p.a)&&r.a.setTitleCount(r.a.pushedUpdates.length),m.redraw()})),Object(s.extend)(c.a.prototype,"config",(function(e,t,n){var o=this;t||r.a.pusher.then((function(e){e.main.bind("newPost",(function(e){var t=String(e.discussionId);if(o.discussion&&o.discussion.id()===t&&o.stream){var n=o.discussion.commentCount();r.a.store.find("discussions",o.discussion.id()).then((function(){o.stream.update(),document.hasFocus()||(r.a.setTitleCount(Math.max(0,o.discussion.commentCount()-n)),$(window).one("focus",(function(){return r.a.setTitleCount(0)})))}))}})),Object(s.extend)(n,"onunload",(function(){return e.main.unbind("newPost")}))}))})),Object(s.extend)(p.a.prototype,"actionItems",(function(e){e.remove("refresh")})),r.a.pusher.then((function(e){e.user&&e.user.bind("notification",(function(){r.a.session.user.pushAttributes({unreadNotificationCount:r.a.session.user.unreadNotificationCount()+1,newNotificationCount:r.a.session.user.newNotificationCount()+1}),r.a.notifications.clear(),m.redraw()}))}))}))}]); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/pusher/js/dist/forum.js.map b/extensions/pusher/js/dist/forum.js.map index b0dea14cf..dcb3509b3 100644 --- a/extensions/pusher/js/dist/forum.js.map +++ b/extensions/pusher/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@flarum/pusher/webpack/bootstrap","webpack://@flarum/pusher/external \"flarum.core.compat['app']\"","webpack://@flarum/pusher/external \"flarum.core.compat['extend']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/DiscussionList']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/IndexPage']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/DiscussionPage']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/Button']\"","webpack://@flarum/pusher/./src/forum/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","app","initializers","add","loadPusher","deferred","$","getScript","socket","Pusher","forum","attribute","authEndpoint","cluster","auth","headers","session","csrfToken","resolve","main","subscribe","user","id","pusher","promise","pushedUpdates","extend","DiscussionList","x","isInitialized","context","then","channels","data","params","props","q","sort","filter","tags","tag","store","getBy","tagIds","indexOf","String","discussionId","current","discussion","push","IndexPage","setTitleCount","length","redraw","unbind","vdom","count","children","unshift","Button","component","className","onclick","refresh","loadingUpdated","loading","this","translator","transChoice","returned","index","splice","DiscussionPage","stream","oldCount","commentCount","find","update","document","hasFocus","Math","max","window","one","items","remove","pushAttributes","unreadNotificationCount","newNotificationCount","cache","notifications"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GA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AcmB,QAAQI,EAAW1B,OAEpC,IAAXgD,GACFrE,IAAIwB,cAAc8C,OAAOD,EAAO,GAG9BrE,IAAI8C,mBAAmBG,KACzBjD,IAAIkD,cAAclD,IAAIwB,cAAc2B,QAGtClF,EAAEmF,YAGJ3B,iBAAO8C,IAAe9E,UAAW,UAAU,SAASkC,EAAGC,EAAeC,GAAS,WACzED,GAEJ5B,IAAIsB,OAAOQ,MAAK,SAAAC,GACdA,EAASb,KAAK7B,KAAK,WAAW,SAAA2C,GAC5B,IAAMX,EAAKuB,OAAOZ,EAAKa,cAEvB,GAAI,EAAKE,YAAc,EAAKA,WAAW1B,OAASA,GAAM,EAAKmD,OAAQ,CACjE,IAAMC,EAAW,EAAK1B,WAAW2B,eAEjC1E,IAAIwC,MAAMmC,KAAK,cAAe,EAAK5B,WAAW1B,MAAMS,MAAK,WACvD,EAAK0C,OAAOI,SAEPC,SAASC,aACZ9E,IAAIkD,cAAc6B,KAAKC,IAAI,EAAG,EAAKjC,WAAW2B,eAAiBD,IAE/DpE,EAAE4E,QAAQC,IAAI,SAAS,kBAAMlF,IAAIkD,cAAc,cAMvDzB,iBAAOI,EAAS,YAAY,kBAAME,EAASb,KAAKmC,OAAO,oBAI3D5B,iBAAOwB,IAAUxD,UAAW,eAAe,SAAA0F,GACzCA,EAAMC,OAAO,cAGfpF,IAAIsB,OAAOQ,MAAK,SAAAC,GACVA,EAASX,MACXW,EAASX,KAAK/B,KAAK,gBAAgB,WACjCW,IAAIe,QAAQK,KAAKiE,eAAe,CAC9BC,wBAAyBtF,IAAIe,QAAQK,KAAKkE,0BAA4B,EACtEC,qBAAsBvF,IAAIe,QAAQK,KAAKmE,uBAAyB,WAE3DvF,IAAIwF,MAAMC,cACjBxH,EAAEmF","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/DiscussionList'];","module.exports = flarum.core.compat['components/IndexPage'];","module.exports = flarum.core.compat['components/DiscussionPage'];","module.exports = flarum.core.compat['components/Button'];","/*global Pusher*/\n\nimport { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport DiscussionList from 'flarum/components/DiscussionList';\nimport DiscussionPage from 'flarum/components/DiscussionPage';\nimport IndexPage from 'flarum/components/IndexPage';\nimport Button from 'flarum/components/Button';\n\napp.initializers.add('flarum-pusher', () => {\n const loadPusher = m.deferred();\n\n $.getScript('//cdn.jsdelivr.net/npm/pusher-js@3.0.0/dist/pusher.min.js', () => {\n const socket = new Pusher(app.forum.attribute('pusherKey'), {\n authEndpoint: app.forum.attribute('apiUrl') + '/pusher/auth',\n cluster: app.forum.attribute('pusherCluster'),\n auth: {\n headers: {\n 'X-CSRF-Token': app.session.csrfToken\n }\n }\n });\n\n loadPusher.resolve({\n main: socket.subscribe('public'),\n user: app.session.user ? socket.subscribe('private-user' + app.session.user.id()) : null\n });\n });\n\n app.pusher = loadPusher.promise;\n app.pushedUpdates = [];\n\n extend(DiscussionList.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const params = this.props.params;\n\n if (!params.q && !params.sort && !params.filter) {\n if (params.tags) {\n const tag = app.store.getBy('tags', 'slug', params.tags);\n\n if (data.tagIds.indexOf(tag.id()) === -1) return;\n }\n\n const id = String(data.discussionId);\n\n if ((!app.current.discussion || id !== app.current.discussion.id()) && app.pushedUpdates.indexOf(id) === -1) {\n app.pushedUpdates.push(id);\n\n if (app.current instanceof IndexPage) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n }\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(DiscussionList.prototype, 'view', function(vdom) {\n if (app.pushedUpdates) {\n const count = app.pushedUpdates.length;\n\n if (count) {\n vdom.children.unshift(\n Button.component({\n className: 'Button Button--block DiscussionList-update',\n onclick: () => {\n this.refresh(false).then(() => {\n this.loadingUpdated = false;\n app.pushedUpdates = [];\n app.setTitleCount(0);\n m.redraw();\n });\n this.loadingUpdated = true;\n },\n loading: this.loadingUpdated,\n children: app.translator.transChoice('flarum-pusher.forum.discussion_list.show_updates_text', count, {count})\n })\n );\n }\n }\n });\n\n // Prevent any newly-created discussions from triggering the discussion list\n // update button showing.\n // TODO: Might be better pause the response to the push updates while the\n // composer is loading? idk\n extend(DiscussionList.prototype, 'addDiscussion', function(returned, discussion) {\n const index = app.pushedUpdates.indexOf(discussion.id());\n\n if (index !== -1) {\n app.pushedUpdates.splice(index, 1);\n }\n\n if (app.current instanceof IndexPage) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n });\n\n extend(DiscussionPage.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const id = String(data.discussionId);\n\n if (this.discussion && this.discussion.id() === id && this.stream) {\n const oldCount = this.discussion.commentCount();\n\n app.store.find('discussions', this.discussion.id()).then(() => {\n this.stream.update();\n\n if (!document.hasFocus()) {\n app.setTitleCount(Math.max(0, this.discussion.commentCount() - oldCount));\n\n $(window).one('focus', () => app.setTitleCount(0));\n }\n });\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(IndexPage.prototype, 'actionItems', items => {\n items.remove('refresh');\n });\n\n app.pusher.then(channels => {\n if (channels.user) {\n channels.user.bind('notification', () => {\n app.session.user.pushAttributes({\n unreadNotificationCount: app.session.user.unreadNotificationCount() + 1,\n newNotificationCount: app.session.user.newNotificationCount() + 1\n });\n delete app.cache.notifications;\n m.redraw();\n });\n }\n });\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@flarum/pusher/webpack/bootstrap","webpack://@flarum/pusher/external \"flarum.core.compat['app']\"","webpack://@flarum/pusher/external \"flarum.core.compat['extend']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/DiscussionList']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/IndexPage']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/DiscussionPage']\"","webpack://@flarum/pusher/external \"flarum.core.compat['components/Button']\"","webpack://@flarum/pusher/./src/forum/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","app","initializers","add","loadPusher","deferred","$","getScript","socket","Pusher","forum","attribute","authEndpoint","cluster","auth","headers","session","csrfToken","resolve","main","subscribe","user","id","pusher","promise","pushedUpdates","extend","DiscussionList","x","isInitialized","context","then","channels","data","params","discussions","getParams","q","sort","filter","tags","tag","store","getBy","tagIds","indexOf","String","discussionId","current","push","matches","IndexPage","setTitleCount","length","redraw","unbind","vdom","count","children","unshift","Button","component","className","onclick","refresh","loadingUpdated","loading","this","translator","transChoice","returned","discussion","index","splice","DiscussionPage","stream","oldCount","commentCount","find","update","document","hasFocus","Math","max","window","one","items","remove","pushAttributes","unreadNotificationCount","newNotificationCount","notifications","clear"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,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,EAAKL,WAAWM,eAEjC5E,IAAIyC,MAAMoC,KAAK,cAAe,EAAKP,WAAWjD,MAAMS,MAAK,WACvD,EAAK4C,OAAOI,SAEPC,SAASC,aACZhF,IAAImD,cAAc8B,KAAKC,IAAI,EAAG,EAAKZ,WAAWM,eAAiBD,IAE/DtE,EAAE8E,QAAQC,IAAI,SAAS,kBAAMpF,IAAImD,cAAc,cAMvD1B,iBAAOI,EAAS,YAAY,kBAAME,EAASb,KAAKoC,OAAO,oBAI3D7B,iBAAOyB,IAAUzD,UAAW,eAAe,SAAA4F,GACzCA,EAAMC,OAAO,cAGftF,IAAIsB,OAAOQ,MAAK,SAAAC,GACVA,EAASX,MACXW,EAASX,KAAK/B,KAAK,gBAAgB,WACjCW,IAAIe,QAAQK,KAAKmE,eAAe,CAC9BC,wBAAyBxF,IAAIe,QAAQK,KAAKoE,0BAA4B,EACtEC,qBAAsBzF,IAAIe,QAAQK,KAAKqE,uBAAyB,IAElEzF,IAAI0F,cAAcC,QAClB1H,EAAEoF","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/DiscussionList'];","module.exports = flarum.core.compat['components/IndexPage'];","module.exports = flarum.core.compat['components/DiscussionPage'];","module.exports = flarum.core.compat['components/Button'];","/*global Pusher*/\n\nimport { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport DiscussionList from 'flarum/components/DiscussionList';\nimport DiscussionPage from 'flarum/components/DiscussionPage';\nimport IndexPage from 'flarum/components/IndexPage';\nimport Button from 'flarum/components/Button';\n\napp.initializers.add('flarum-pusher', () => {\n const loadPusher = m.deferred();\n\n $.getScript('//cdn.jsdelivr.net/npm/pusher-js@3.0.0/dist/pusher.min.js', () => {\n const socket = new Pusher(app.forum.attribute('pusherKey'), {\n authEndpoint: app.forum.attribute('apiUrl') + '/pusher/auth',\n cluster: app.forum.attribute('pusherCluster'),\n auth: {\n headers: {\n 'X-CSRF-Token': app.session.csrfToken\n }\n }\n });\n\n loadPusher.resolve({\n main: socket.subscribe('public'),\n user: app.session.user ? socket.subscribe('private-user' + app.session.user.id()) : null\n });\n });\n\n app.pusher = loadPusher.promise;\n app.pushedUpdates = [];\n\n extend(DiscussionList.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const params = app.discussions.getParams();\n\n if (!params.q && !params.sort && !params.filter) {\n if (params.tags) {\n const tag = app.store.getBy('tags', 'slug', params.tags);\n\n if (data.tagIds.indexOf(tag.id()) === -1) return;\n }\n\n const id = String(data.discussionId);\n\n if ((!app.current.get('discussion') || id !== app.current.get('discussion').id()) && app.pushedUpdates.indexOf(id) === -1) {\n app.pushedUpdates.push(id);\n\n if (app.current.matches(IndexPage)) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n }\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(DiscussionList.prototype, 'view', function(vdom) {\n if (app.pushedUpdates) {\n const count = app.pushedUpdates.length;\n\n if (count) {\n vdom.children.unshift(\n Button.component({\n className: 'Button Button--block DiscussionList-update',\n onclick: () => {\n this.refresh(false).then(() => {\n this.loadingUpdated = false;\n app.pushedUpdates = [];\n app.setTitleCount(0);\n m.redraw();\n });\n this.loadingUpdated = true;\n },\n loading: this.loadingUpdated,\n children: app.translator.transChoice('flarum-pusher.forum.discussion_list.show_updates_text', count, {count})\n })\n );\n }\n }\n });\n\n // Prevent any newly-created discussions from triggering the discussion list\n // update button showing.\n // TODO: Might be better pause the response to the push updates while the\n // composer is loading? idk\n extend(DiscussionList.prototype, 'addDiscussion', function(returned, discussion) {\n const index = app.pushedUpdates.indexOf(discussion.id());\n\n if (index !== -1) {\n app.pushedUpdates.splice(index, 1);\n }\n\n if (app.current.matches(IndexPage)) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n });\n\n extend(DiscussionPage.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const id = String(data.discussionId);\n\n if (this.discussion && this.discussion.id() === id && this.stream) {\n const oldCount = this.discussion.commentCount();\n\n app.store.find('discussions', this.discussion.id()).then(() => {\n this.stream.update();\n\n if (!document.hasFocus()) {\n app.setTitleCount(Math.max(0, this.discussion.commentCount() - oldCount));\n\n $(window).one('focus', () => app.setTitleCount(0));\n }\n });\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(IndexPage.prototype, 'actionItems', items => {\n items.remove('refresh');\n });\n\n app.pusher.then(channels => {\n if (channels.user) {\n channels.user.bind('notification', () => {\n app.session.user.pushAttributes({\n unreadNotificationCount: app.session.user.unreadNotificationCount() + 1,\n newNotificationCount: app.session.user.newNotificationCount() + 1\n });\n app.notifications.clear();\n m.redraw();\n });\n }\n });\n});\n"],"sourceRoot":""} \ No newline at end of file