From e3f969588c5e1f5127aada90b67431fcd480b84a Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sat, 19 Oct 2024 16:53:04 +0000 Subject: [PATCH] Bundled output for commit e9be7b9aea70a3a86fd649c316c1bd863cc09608 Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- .../messages/js/dist/forum/components/MessageComposer.js.map | 2 +- extensions/messages/js/dist/forum/components/MessagesPage.js | 2 +- .../messages/js/dist/forum/components/MessagesPage.js.map | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/messages/js/dist/forum/components/MessageComposer.js.map b/extensions/messages/js/dist/forum/components/MessageComposer.js.map index 92286c1e0..71a70c51a 100644 --- a/extensions/messages/js/dist/forum/components/MessageComposer.js.map +++ b/extensions/messages/js/dist/forum/components/MessageComposer.js.map @@ -1 +1 @@ -{"version":3,"file":"forum/components/MessageComposer.js","mappings":"ySAce,MAAMA,UAAwB,KAC3C,WAAAC,GACEC,SAASC,YACT,OAAgBC,KAAM,kBAAc,EACtC,CACA,gBAAOC,CAAUC,GACfJ,MAAMG,UAAUC,GAChBA,EAAMC,YAAcD,EAAMC,aAAe,IAAY,eAAeC,MAAM,6CAA8C,CAAC,GAAG,IAC5HF,EAAMG,YAAcH,EAAMG,aAAe,eAAeD,MAAM,+CAAgD,CAAC,GAAG,GAClHF,EAAMI,YAAcJ,EAAMI,aAAe,IAAY,eAAeF,MAAM,sDAAuD,CAAC,GAAG,IACrIF,EAAMK,UAAY,uBACpB,CACA,MAAAC,CAAOC,GACL,IAAIC,EACJZ,MAAMU,OAAOC,GACb,IAAIE,GAA4D,OAAlDD,EAAwBV,KAAKE,MAAMU,iBAAsB,EAASF,EAAsBC,UAAYX,KAAKE,MAAMW,YAAc,GACvIF,IACFA,EAAQA,EAAMG,QAAOC,GAAQA,GAAQA,EAAKC,OAAS,YAAYD,KAAKC,QAEtEhB,KAAKiB,SAASC,OAAOL,WAAab,KAAKiB,SAASC,OAAOL,YAAc,IAAOF,GA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BlC,GAAI6B,EAAQV,KAAKE,cAAcC,OAAOH,KAAKnB,MAEmB,OAA/D8B,GAAwBC,EAAc/C,KAAKE,OAAO4B,WAAqBgB,EAAqBK,KAAKJ,EAAaF,EAAQ,GACtH7C,KAAKoD,OAAOC,KAAKrD,MACtB,GAEF,OAAgBJ,EAAiB,mBAAmB,IAAM,uBAC1D0D,OAAOC,IAAIlC,IAAI,kBAAmB,mCAAoCzB,E","sources":["webpack://@flarum/messages/./src/forum/components/MessageComposer.tsx"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/forum/app';\nimport ComposerBody from 'flarum/forum/components/ComposerBody';\nimport extractText from 'flarum/common/utils/extractText';\nimport Stream from 'flarum/common/utils/Stream';\nimport Button from 'flarum/common/components/Button';\nimport UserSelectionModal from 'flarum/common/components/UserSelectionModal';\nimport Avatar from 'flarum/common/components/Avatar';\nimport Tooltip from 'flarum/common/components/Tooltip';\n/**\n * The `MessageComposer` component displays the composer content for sending\n * a new message. It adds a selection field as a header control so the user can\n * enter the recipient(s) of their message.\n */\nexport default class MessageComposer extends ComposerBody {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"recipients\", void 0);\n }\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n attrs.placeholder = attrs.placeholder || extractText(app.translator.trans('flarum-messages.forum.composer.placeholder', {}, true));\n attrs.submitLabel = attrs.submitLabel || app.translator.trans('flarum-messages.forum.composer.submit_button', {}, true);\n attrs.confirmExit = attrs.confirmExit || extractText(app.translator.trans('flarum-messages.forum.composer.discard_confirmation', {}, true));\n attrs.className = 'ComposerBody--message';\n }\n oninit(vnode) {\n var _this$attrs$replyingT;\n super.oninit(vnode);\n let users = ((_this$attrs$replyingT = this.attrs.replyingTo) == null ? void 0 : _this$attrs$replyingT.users()) || this.attrs.recipients || [];\n if (users) {\n users = users.filter(user => user && user.id() !== app.session.user.id());\n }\n this.composer.fields.recipients = this.composer.fields.recipients || Stream(users);\n this.recipients = this.composer.fields.recipients;\n }\n headerItems() {\n const items = super.headerItems();\n items.add('recipients', m(\"div\", {\n className: \"MessageComposer-recipients\"\n }, !this.attrs.replyingTo && m(Button, {\n type: \"button\",\n className: \"Button Button--outline Button--compact\",\n onclick: () => app.modal.show(UserSelectionModal, {\n title: app.translator.trans('flarum-messages.forum.recipient_selection_modal.title', {}, true),\n selected: this.recipients(),\n maxItems: 1,\n excluded: [app.session.user.id()],\n onsubmit: users => {\n this.recipients(users);\n }\n })\n }, app.translator.trans('flarum-messages.forum.composer.recipients')), !!this.recipients().length && m(\"div\", {\n className: \"MessageComposer-recipients-label\"\n }, app.translator.trans('flarum-messages.forum.composer.to')), m(\"ul\", {\n className: \"MessageComposer-recipients-list\"\n }, this.recipients().map(user => m(\"li\", null, m(Tooltip, {\n text: user.username()\n }, m(Avatar, {\n user: user\n })))))), 100);\n return items;\n }\n\n /**\n * Get the data to submit to the server when the discussion is saved.\n */\n data() {\n const data = {\n content: this.composer.fields.content()\n };\n if (this.attrs.replyingTo) {\n data.relationships = {\n dialog: {\n data: {\n id: this.attrs.replyingTo.id(),\n type: 'dialogs'\n }\n }\n };\n } else {\n data.users = this.recipients().map(user => ({\n id: user.id()\n }));\n }\n return data;\n }\n onsubmit() {\n this.loading = true;\n const data = this.data();\n app.store.createRecord('dialog-messages').save(data, {\n params: {\n include: ['dialog']\n }\n }).then(message => {\n var _this$attrs$onsubmit, _this$attrs;\n this.composer.hide();\n // @todo: app.dialogs.refresh();\n // @ts-ignore\n m.route.set(app.route('dialog', {\n id: message.data.relationships.dialog.data.id\n }));\n (_this$attrs$onsubmit = (_this$attrs = this.attrs).onsubmit) == null || _this$attrs$onsubmit.call(_this$attrs, message);\n }, this.loaded.bind(this));\n }\n}\n_defineProperty(MessageComposer, \"focusOnSelector\", () => '.TextEditor-editor');\nflarum.reg.add('flarum-messages', 'forum/components/MessageComposer', MessageComposer);"],"names":["MessageComposer","constructor","super","arguments","this","initAttrs","attrs","placeholder","trans","submitLabel","confirmExit","className","oninit","vnode","_this$attrs$replyingT","users","replyingTo","recipients","filter","user","id","composer","fields","headerItems","items","add","m","type","onclick","show","title","selected","maxItems","excluded","onsubmit","length","map","text","username","data","content","relationships","dialog","loading","createRecord","save","params","include","then","message","_this$attrs$onsubmit","_this$attrs","hide","route","set","call","loaded","bind","flarum","reg"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum/components/MessageComposer.js","mappings":"ySAce,MAAMA,UAAwB,KAC3C,WAAAC,GACEC,SAASC,YACT,OAAgBC,KAAM,kBAAc,EACtC,CACA,gBAAOC,CAAUC,GACfJ,MAAMG,UAAUC,GAChBA,EAAMC,YAAcD,EAAMC,aAAe,IAAY,eAAeC,MAAM,6CAA8C,CAAC,GAAG,IAC5HF,EAAMG,YAAcH,EAAMG,aAAe,eAAeD,MAAM,+CAAgD,CAAC,GAAG,GAClHF,EAAMI,YAAcJ,EAAMI,aAAe,IAAY,eAAeF,MAAM,sDAAuD,CAAC,GAAG,IACrIF,EAAMK,UAAY,uBACpB,CACA,MAAAC,CAAOC,GACL,IAAIC,EACJZ,MAAMU,OAAOC,GACb,IAAIE,GAA4D,OAAlDD,EAAwBV,KAAKE,MAAMU,iBAAsB,EAASF,EAAsBC,UAAYX,KAAKE,MAAMW,YAAc,GACvIF,IACFA,EAAQA,EAAMG,QAAOC,GAAQA,GAAQA,EAAKC,OAAS,YAAYD,KAAKC,QAEtEhB,KAAKiB,SAASC,OAAOL,WAAab,KAAKiB,SAASC,OAAOL,YAAc,IAAOF,GAC5EX,KAAKa,WAAab,KAAKiB,SAASC,OAAOL,UACzC,CACA,WAAAM,GACE,MAAMC,EAAQtB,MAAMqB,cAwBpB,OAvBAC,EAAMC,IAAI,aAAcC,EAAE,MAAO,CAC/Bf,UAAW,+BACTP,KAAKE,MAAMU,YAAcU,EAAE,IAAQ,CACrCC,KAAM,SACNhB,UAAW,yCACXiB,QAAS,IAAM,UAAUC,KAAK,IAAoB,CAChDC,MAAO,eAAetB,MAAM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ages/./src/forum/components/MessageComposer.tsx"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/forum/app';\nimport ComposerBody from 'flarum/forum/components/ComposerBody';\nimport extractText from 'flarum/common/utils/extractText';\nimport Stream from 'flarum/common/utils/Stream';\nimport Button from 'flarum/common/components/Button';\nimport UserSelectionModal from 'flarum/common/components/UserSelectionModal';\nimport Avatar from 'flarum/common/components/Avatar';\nimport Tooltip from 'flarum/common/components/Tooltip';\n/**\n * The `MessageComposer` component displays the composer content for sending\n * a new message. It adds a selection field as a header control so the user can\n * enter the recipient(s) of their message.\n */\nexport default class MessageComposer extends ComposerBody {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"recipients\", void 0);\n }\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n attrs.placeholder = attrs.placeholder || extractText(app.translator.trans('flarum-messages.forum.composer.placeholder', {}, true));\n attrs.submitLabel = attrs.submitLabel || app.translator.trans('flarum-messages.forum.composer.submit_button', {}, true);\n attrs.confirmExit = attrs.confirmExit || extractText(app.translator.trans('flarum-messages.forum.composer.discard_confirmation', {}, true));\n attrs.className = 'ComposerBody--message';\n }\n oninit(vnode) {\n var _this$attrs$replyingT;\n super.oninit(vnode);\n let users = ((_this$attrs$replyingT = this.attrs.replyingTo) == null ? void 0 : _this$attrs$replyingT.users()) || this.attrs.recipients || [];\n if (users) {\n users = users.filter(user => user && user.id() !== app.session.user.id());\n }\n this.composer.fields.recipients = this.composer.fields.recipients || Stream(users);\n this.recipients = this.composer.fields.recipients;\n }\n headerItems() {\n const items = super.headerItems();\n items.add('recipients', m(\"div\", {\n className: \"MessageComposer-recipients\"\n }, !this.attrs.replyingTo && m(Button, {\n type: \"button\",\n className: \"Button Button--outline Button--compact\",\n onclick: () => app.modal.show(UserSelectionModal, {\n title: app.translator.trans('flarum-messages.forum.recipient_selection_modal.title', {}, true),\n selected: this.recipients(),\n maxItems: 1,\n excluded: [app.session.user.id()],\n onsubmit: users => {\n this.recipients(users);\n }\n })\n }, app.translator.trans('flarum-messages.forum.composer.recipients')), !!this.recipients().length && m(\"div\", {\n className: \"MessageComposer-recipients-label\"\n }, app.translator.trans('flarum-messages.forum.composer.to')), m(\"ul\", {\n className: \"MessageComposer-recipients-list\"\n }, this.recipients().map(user => m(\"li\", null, m(Tooltip, {\n text: user.username()\n }, m(Avatar, {\n user: user\n })))))), 100);\n return items;\n }\n\n /**\n * Get the data to submit to the server when the discussion is saved.\n */\n data() {\n const data = {\n content: this.composer.fields.content()\n };\n if (this.attrs.replyingTo) {\n data.relationships = {\n dialog: {\n data: {\n id: this.attrs.replyingTo.id(),\n type: 'dialogs'\n }\n }\n };\n } else {\n data.users = this.recipients().map(user => ({\n id: user.id()\n }));\n }\n return data;\n }\n onsubmit() {\n this.loading = true;\n const data = this.data();\n app.store.createRecord('dialog-messages').save(data, {\n params: {\n include: ['dialog']\n }\n }).then(message => {\n var _this$attrs$onsubmit, _this$attrs;\n this.composer.hide();\n // @ts-ignore\n m.route.set(app.route('dialog', {\n id: message.data.relationships.dialog.data.id\n }));\n (_this$attrs$onsubmit = (_this$attrs = this.attrs).onsubmit) == null || _this$attrs$onsubmit.call(_this$attrs, message);\n }, this.loaded.bind(this));\n }\n}\n_defineProperty(MessageComposer, \"focusOnSelector\", () => '.TextEditor-editor');\nflarum.reg.add('flarum-messages', 'forum/components/MessageComposer', MessageComposer);"],"names":["MessageComposer","constructor","super","arguments","this","initAttrs","attrs","placeholder","trans","submitLabel","confirmExit","className","oninit","vnode","_this$attrs$replyingT","users","replyingTo","recipients","filter","user","id","composer","fields","headerItems","items","add","m","type","onclick","show","title","selected","maxItems","excluded","onsubmit","length","map","text","username","data","content","relationships","dialog","loading","createRecord","save","params","include","then","message","_this$attrs$onsubmit","_this$attrs","hide","route","set","call","loaded","bind","flarum","reg"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/messages/js/dist/forum/components/MessagesPage.js b/extensions/messages/js/dist/forum/components/MessagesPage.js index 06d43238d..4fccc3547 100644 --- a/extensions/messages/js/dist/forum/components/MessagesPage.js +++ b/extensions/messages/js/dist/forum/components/MessagesPage.js @@ -1,2 +1,2 @@ -"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[301],{684:(e,s,t)=>{t.d(s,{A:()=>y});var a=t(488),r=t.n(a),o=t(950),i=t.n(o),l=t(336),n=t.n(l),d=t(443),c=t.n(d),u=t(88),g=t.n(u),h=t(917),p=t.n(h),f=t(521),v=t.n(f),b=t(167),N=t.n(b),_=t(906),M=t.n(_);class A extends(i()){view(e){var s;const t=this.attrs.dialog,a=t.recipient(),o=t.lastMessage();return m("li",{className:c()("DialogListItem",{"DialogListItem--unread":t.unreadCount(),active:this.attrs.active})},m(g(),{href:r().route.dialog(t),className:c()("DialogListItem-button",{active:this.attrs.active})},m("div",{className:"DialogListItem-avatar"},m(p(),{user:a}),!!t.unreadCount()&&m("div",{className:"Bubble Bubble--primary"},t.unreadCount())),m("div",{className:"DialogListItem-content"},m("div",{className:"DialogListItem-title"},v()(a),N()(t.lastMessageAt()),this.attrs.actions&&m("div",{className:"DialogListItem-actions"},this.actionItems().toArray())),m("div",{className:"DialogListItem-lastMessage"},o?null==(s=o.contentPlain())?void 0:s.slice(0,80):""))))}actionItems(){const e=new(M());return e.add("markAsRead",m(n(),{className:"Notification-action Button Button--link",icon:"fas fa-check","aria-label":r().translator.trans("flarum-messages.forum.dialog_list.mark_as_read_tooltip"),onclick:e=>{var s;e.preventDefault(),e.stopPropagation(),this.attrs.dialog.save({lastReadMessageId:(null==(s=this.attrs.dialog.data.relationships)?void 0:s.lastMessage.data).id}).finally((()=>{var e;0===this.attrs.dialog.unreadCount()&&r().session.user.pushAttributes({messageCount:(null!=(e=r().session.user.attribute("messageCount"))?e:1)-1}),m.redraw()}))}}),100),e}}flarum.reg.add("flarum-messages","forum/components/DialogListItem",A);class y extends(i()){oninit(e){super.oninit(e)}oncreate(e){super.oncreate(e)}onupdate(e){super.onupdate(e)}view(){return m("div",{className:"DialogList"},m("ul",{className:"DialogList-list"},this.attrs.state.getAllItems().map((e=>{var s;return m(A,{dialog:e,active:(null==(s=this.attrs.activeDialog)?void 0:s.id())===e.id(),actions:this.attrs.itemActions})}))),this.attrs.state.hasNext()&&!this.attrs.hideMore&&m("div",{className:"DialogList-loadMore"},m(n(),{className:"Button",onclick:this.attrs.state.loadNext.bind(this.attrs.state)},r().translator.trans("flarum-messages.forum.dialog_list.load_more_button"))))}}flarum.reg.add("flarum-messages","forum/components/DialogList",y)},654:(e,s,t)=>{t.r(s),t.d(s,{default:()=>me});var a=t(805),r=t(488),o=t.n(r),i=t(859),l=t.n(i),n=t(314),d=t.n(n),c=t(801),u=t.n(c),g=t(684),h=t(661),p=t.n(h),f=t(821),v=t.n(f),b=t(500),N=t.n(b),_=t(402),M=t.n(_),A=t(336),y=t.n(A);class I extends(M()){static initAttrs(e){e.className="MessagesPage-nav"}items(){const e=super.items(),s=o().session.user.attribute("canSendAnyMessage");return e.remove("newDiscussion"),e.add("newMessage",m(y(),{icon:"fas fa-edit",className:"Button Button--primary IndexPage-newDiscussion MessagesPage-newMessage",itemClassName:"App-primaryControl",onclick:()=>this.newMessageAction(),disabled:!s},o().translator.trans("flarum-messages.forum.messages_page.new_message_button")),10),e}newMessageAction(){return flarum.reg.asyncModuleImport("flarum/forum/components/ComposerBody").then((()=>(o().composer.load((()=>t.e(451).then(t.bind(t,761))),{user:o().session.user,onsubmit:()=>{o().dialogs.refresh()}}).then((()=>o().composer.show())),o().composer)))}}flarum.reg.add("flarum-messages","forum/components/MessagesSidebar",I);var k=t(950),D=t.n(k),w=t(476),P=t.n(w),S=t(906),T=t.n(S),B=t(154),L=t.n(B),x=t(917),C=t.n(x),R=t(3),H=t.n(R),j=t(651),q=t.n(j),G=t(301),O=t.n(G),E=t(443),F=t.n(E);class V extends(L()){oninit(e){super.oninit(e)}user(){return this.attrs.message.user()}controls(){return[]}freshness(){return this.attrs.message.freshness}createdByStarter(){return!1}onbeforeupdate(e){return super.onbeforeupdate(e)}onupdate(e){super.onupdate(e)}elementAttrs(){const e=this.attrs.message,s=super.elementAttrs();return s.className=F()(s.className||null,"Message",{"Post--renderFailed":e.renderFailed(),revealContent:!1,editing:!1}),s}header(){return super.header()}content(){return super.content().concat([m(H(),{headerItems:this.headerItems(),cardVisible:!1,isEditing:!1,isHidden:!1,contentHtml:this.attrs.message.contentHtml(),user:this.attrs.message.user()})])}classes(e){return super.classes(e)}actionItems(){return super.actionItems()}footerItems(){return super.footerItems()}sideItems(){return super.sideItems()}avatar(){return this.attrs.message.user()?m(C(),{user:this.attrs.message.user()}):""}headerItems(){const e=new(T()),s=this.attrs.message;return e.add("user",m(q(),{post:s}),100),e.add("meta",m(O(),{post:s})),e}}flarum.reg.add("flarum-messages","forum/components/Message",V);class z extends(D()){constructor(){super(...arguments),(0,a.A)(this,"replyPlaceholderComponent",v()(null)),(0,a.A)(this,"loadingPostComponent",v()(null)),(0,a.A)(this,"scrollListener",void 0),(0,a.A)(this,"initialToBottomScroll",!1),(0,a.A)(this,"lastTime",null),(0,a.A)(this,"checkedRead",!1),(0,a.A)(this,"markingAsRead",!1)}oninit(e){super.oninit(e),Promise.all([flarum.reg.asyncModuleImport("flarum/forum/components/ReplyPlaceholder"),flarum.reg.asyncModuleImport("flarum/forum/components/LoadingPost")]).then((e=>{let[s,t]=e;this.replyPlaceholderComponent(s.default),this.loadingPostComponent(t.default)}))}oncreate(e){super.oncreate(e),this.scrollListener=new(P())(this.onscroll.bind(this),this.element),setTimeout((()=>{this.scrollListener.start(),this.element.addEventListener("scrollend",this.markAsRead.bind(this))}))}onupdate(e){super.onupdate(e),this.initialToBottomScroll||this.attrs.state.isLoading()||(this.scrollToBottom(),this.initialToBottomScroll=!0),this.initialToBottomScroll&&!this.checkedRead&&(this.markAsRead(),this.checkedRead=!0)}onremove(e){super.onremove(e),this.scrollListener.stop()}view(){return m("div",{className:"MessageStream"},this.attrs.state.isLoading()?m(p(),null):this.content())}content(){var e;const s=[],a=this.attrs.state.getAllItems().sort(((e,s)=>e.createdAt().getTime()-s.createdAt().getTime())),r=this.replyPlaceholderComponent(),i=this.loadingPostComponent();return a[0].id()!==(null==(e=this.attrs.dialog.data.relationships)?void 0:e.firstMessage.data).id&&(s.push(m("div",{className:"MessageStream-item",key:"loadPrevious"},m(y(),{onclick:()=>this.whileMaintainingScroll((()=>this.attrs.state.loadNext())),type:"button",className:"Button Button--block MessageStream-loadPrev"},o().translator.trans("flarum-messages.forum.messages_page.stream.load_previous_button")))),i&&s.push(m("div",{className:"MessageStream-item",key:"loading-prev"},m(i,null)))),a.forEach(((e,t)=>s.push(this.messageItem(e,t)))),r&&s.push(m("div",{className:"MessageStream-item",key:"reply"},m(r,{discussion:this.attrs.dialog,onclick:()=>{flarum.reg.asyncModuleImport("flarum/forum/components/ComposerBody").then((()=>{o().composer.load((()=>t.e(451).then(t.bind(t,761))),{user:o().session.user,replyingTo:this.attrs.dialog,onsubmit:e=>{this.attrs.state.push(e),setTimeout((()=>this.scrollToBottom()),50)}}).then((()=>o().composer.show()))}))},composingReply:()=>o().composer.composingMessageTo(this.attrs.dialog)}))),s}messageItem(e,s){return m("div",{className:"MessageStream-item",key:s,"data-id":e.id()},this.timeGap(e),m(V,{message:e}))}timeGap(e){var s;if(e.id()===(null==(s=this.attrs.dialog.data.relationships)?void 0:s.firstMessage.data).id)return this.lastTime=e.createdAt(),m("div",{class:"PostStream-timeGap"},m("span",null,o().translator.trans("flarum-messages.forum.messages_page.stream.start_of_the_conversation")));const t=this.lastTime,a=e.createdAt().getTime()-((null==t?void 0:t.getTime())||0);return this.lastTime=e.createdAt(),t&&a>3456e5?m("div",{className:"PostStream-timeGap"},m("span",null,o().translator.trans("flarum-messages.forum.messages_page.stream.time_lapsed_text",{period:dayjs().add(a,"ms").fromNow(!0)}))):null}onscroll(){this.whileMaintainingScroll((()=>this.element.scrollTop<=80&&this.attrs.state.hasNext()?this.attrs.state.loadNext():this.element.scrollTop+this.element.clientHeight===this.element.scrollHeight&&this.attrs.state.hasPrev()?this.attrs.state.loadPrev():null))}scrollToBottom(){this.element.scrollTop=this.element.scrollHeight}whileMaintainingScroll(e){const s=this.element.scrollTop,t=this.element.scrollHeight,a=e();a instanceof Promise&&a.then((()=>{requestAnimationFrame((()=>{this.element.scrollTop=this.element.scrollHeight-t+s}))}))}markAsRead(){const e=Number(this.$(".MessageStream-item[data-id]").filter(((e,s)=>this.element.scrollHeight<=this.element.clientHeight||this.$().offset().top+this.element.clientHeight>$(s).offset().top)).last().data("id"));e&&o().session.user&&e>(this.attrs.dialog.lastReadMessageId()||0)&&!this.markingAsRead&&(this.markingAsRead=!0,this.attrs.dialog.save({lastReadMessageId:e}).finally((()=>{var e;this.markingAsRead=!1,0===this.attrs.dialog.unreadCount()&&o().session.user.pushAttributes({messageCount:(null!=(e=o().session.user.attribute("messageCount"))?e:1)-1}),m.redraw()})))}}flarum.reg.add("flarum-messages","forum/components/MessageStream",z);var J=t(521),K=t.n(J),Q=t(662),U=t.n(Q);class W extends(U()){constructor(e,s){void 0===s&&(s=1),super(e,s,null)}get type(){return"dialog-messages"}getAllItems(){return super.getAllItems()}}flarum.reg.add("flarum-messages","forum/states/MessageStreamState",W);var X=t(88),Y=t.n(X),Z=t(741),ee=t.n(Z),se=t(533),te=t.n(se),ae=t(653),re=t.n(ae),oe=t(819),ie=t.n(oe);class le extends(te()){className(){return"Modal--small Modal--flat DetailsModal"}title(){return o().translator.trans("flarum-messages.forum.dialog_section.details_modal.title")}content(){let e=(this.attrs.dialog.users()||[]).filter(Boolean);return m("div",{className:"Modal-body DetailsModal-infoGroups"},m("div",{className:"DetailsModal-recipients DetailsModal-info"},m("div",{className:"DetailsModal-info-title"},o().translator.trans("flarum-messages.forum.dialog_section.details_modal.recipients")),m("div",{className:"DetailsModal-recipients-list"},null==e?void 0:e.map((e=>m("div",{className:"DetailsModal-recipient"},m(C(),{user:e}),m(Y(),{href:o().route("user",{username:e.slug()})},m("span",{className:"DetailsModal-recipient-username"},K()(e))),m("div",{className:"badges"},ie()(e.badges().toArray()))))))),this.infoItems().toArray())}infoItems(){const e=new(T());return e.add("created",m("div",{className:"DetailsModal-createdAt DetailsModal-info"},m("div",{className:"DetailsModal-info-title"},o().translator.trans("flarum-messages.forum.dialog_section.details_modal.created_at")),m("div",{className:"DetailsModal-info-content"},re()(this.attrs.dialog.createdAt())))),e}}flarum.reg.add("flarum-messages","forum/components/DetailsModal",le);class ne extends(D()){constructor(){super(...arguments),(0,a.A)(this,"loading",!1),(0,a.A)(this,"messages",void 0)}oninit(e){super.oninit(e),this.messages=new W({filter:{dialog:this.attrs.dialog.id()},sort:"-createdAt"}),this.messages.refresh()}view(){const e=this.attrs.dialog.recipient();return m("div",{className:"DialogSection"},m("div",{className:"DialogSection-header"},m(C(),{user:e}),m("div",{className:"DialogSection-header-info"},e&&m(Y(),{href:o().route.user(e)},m("h2",null,K()(e)))||m("h2",null,K()(e)),m("div",{className:"badges"},ie()((null==e?void 0:e.badges().toArray())||[]))),m("div",{className:"DialogSection-header-actions"},this.actionItems().toArray())),m(z,{dialog:this.attrs.dialog,state:this.messages}))}actionItems(){const e=new(T());return e.add("details",m(ee(),{icon:"fas fa-ellipsis-h",className:"DialogSection-controls",buttonClassName:"Button Button--icon",accessibleToggleLabel:o().translator.trans("flarum-messages.forum.dialog_section.controls_toggle_label"),label:o().translator.trans("flarum-messages.forum.dialog_section.controls_toggle_label")},this.controlItems().toArray())),e}controlItems(){const e=new(T());return e.add("details",m(y(),{icon:"fas fa-info-circle",onclick:()=>o().modal.show(le,{dialog:this.attrs.dialog})},o().translator.trans("flarum-messages.forum.dialog_section.controls.details_button"))),e}}flarum.reg.add("flarum-messages","forum/components/DialogSection",ne);class me extends(l()){constructor(){super(...arguments),(0,a.A)(this,"selectedDialog",v()(null))}oninit(e){super.oninit(e),o().session.user?(o().current.set("noTagsList",!0),o().dialogs.hasItems()?this.initDialog():o().dialogs.refresh().then((async()=>{o().dialogs.hasItems()&&await this.initDialog()}))):m.route.set(o().route("index"))}dialogRequestParams(){return{include:"users.groups"}}async initDialog(){const e=m.route.param("id"),s=o().translator.trans("flarum-messages.forum.messages_page.title",{},!0);let t;t=e?o().store.getById("dialogs",e)||await o().store.find("dialogs",e,this.dialogRequestParams()):o().dialogs.getAllItems()[0],this.selectedDialog(t),t?(o().setTitle(t.title()),o().history.push("dialog",t.title())):(o().setTitle(s),o().history.push("messages",s)),m.redraw()}onupdate(e){super.onupdate(e);const s=this.element.querySelector(".DialogListItem.active"),t=this.element.querySelector(".DialogList");s&&$(t).offset().top+t.clientHeight<=$(s).offset().top&&s.scrollIntoView()}view(){return m(d(),{className:"MessagesPage Page--vertical",loading:!1,hero:this.hero.bind(this),sidebar:()=>m(I,null)},o().dialogs.isLoading()?m(p(),null):o().dialogs.hasItems()?m("div",{className:"MessagesPage-content"},m("div",{className:"MessagesPage-sidebar",key:"sidebar"},m("div",{className:"IndexPage-toolbar",key:"toolbar"},m("ul",{className:"IndexPage-toolbar-view"},ie()(this.viewItems().toArray())),m("ul",{className:"IndexPage-toolbar-action"},ie()(this.actionItems().toArray()))),m(g.A,{key:"list",state:o().dialogs,activeDialog:this.selectedDialog()})),this.selectedDialog()?m(ne,{key:"dialog",dialog:this.selectedDialog()}):m(p(),{key:"loading",display:"block"})):m(N(),{icon:"far fa-envelope-open"},o().translator.trans("flarum-messages.forum.messages_page.empty_text")))}hero(){return m("header",{className:"Hero MessagesPageHero"},m("div",{className:"container"},m("div",{className:"containerNarrow"},m("h1",{className:"Hero-title"},m(u(),{name:"fas fa-envelope"})," ",o().translator.trans("flarum-messages.forum.messages_page.hero.title")),m("div",{className:"Hero-subtitle"},o().translator.trans("flarum-messages.forum.messages_page.hero.subtitle")))))}viewItems(){var e;const s=new(T()),t=o().dialogs.sortMap(),a=Object.keys(t).reduce(((e,s)=>{const a=t[s];return e[s]="string"!=typeof a?a.label:o().translator.trans("flarum-messages.forum.index_sort.".concat(s,"_button")),e}),{});return s.add("sort",m(ee(),{buttonClassName:"Button",label:a[(null==(e=o().dialogs.getParams())?void 0:e.sort)||0]||Object.values(a)[0],accessibleToggleLabel:o().translator.trans("core.forum.index_sort.toggle_dropdown_accessible_label")},Object.keys(a).map((e=>{const s=a[e],r=(o().dialogs.getParams().sort||Object.keys(t)[0])===e;return m(y(),{icon:!r||"fas fa-check",onclick:()=>o().dialogs.changeSort(e),active:r},s)})))),s}actionItems(){const e=new(T());return e.add("refresh",m(y(),{title:o().translator.trans("flarum-messages.forum.messages_page.refresh_tooltip"),"aria-label":o().translator.trans("flarum-messages.forum.messages_page.refresh_tooltip"),icon:"fas fa-sync",className:"Button Button--icon",onclick:()=>{o().dialogs.refresh()}})),o().session.user&&e.add("markAllAsRead",m(y(),{title:o().translator.trans("flarum-messages.forum.messages_page.mark_all_as_read_tooltip"),"aria-label":o().translator.trans("flarum-messages.forum.messages_page.mark_all_as_read_tooltip"),icon:"fas fa-check",className:"Button Button--icon",onclick:()=>o().dialogs.markAllAsRead()})),e}}flarum.reg.add("flarum-messages","forum/components/MessagesPage",me)}}]); +"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[301],{684:(e,s,t)=>{t.d(s,{A:()=>y});var a=t(488),r=t.n(a),o=t(950),i=t.n(o),l=t(336),n=t.n(l),d=t(443),c=t.n(d),u=t(88),g=t.n(u),h=t(917),p=t.n(h),f=t(521),v=t.n(f),b=t(167),N=t.n(b),_=t(906),M=t.n(_);class A extends(i()){view(e){var s;const t=this.attrs.dialog,a=t.recipient(),o=t.lastMessage();return m("li",{className:c()("DialogListItem",{"DialogListItem--unread":t.unreadCount(),active:this.attrs.active})},m(g(),{href:r().route.dialog(t),className:c()("DialogListItem-button",{active:this.attrs.active})},m("div",{className:"DialogListItem-avatar"},m(p(),{user:a}),!!t.unreadCount()&&m("div",{className:"Bubble Bubble--primary"},t.unreadCount())),m("div",{className:"DialogListItem-content"},m("div",{className:"DialogListItem-title"},v()(a),N()(t.lastMessageAt()),this.attrs.actions&&m("div",{className:"DialogListItem-actions"},this.actionItems().toArray())),m("div",{className:"DialogListItem-lastMessage"},o?null==(s=o.contentPlain())?void 0:s.slice(0,80):""))))}actionItems(){const e=new(M());return e.add("markAsRead",m(n(),{className:"Notification-action Button Button--link",icon:"fas fa-check","aria-label":r().translator.trans("flarum-messages.forum.dialog_list.mark_as_read_tooltip"),onclick:e=>{var s;e.preventDefault(),e.stopPropagation(),this.attrs.dialog.save({lastReadMessageId:(null==(s=this.attrs.dialog.data.relationships)?void 0:s.lastMessage.data).id}).finally((()=>{var e;0===this.attrs.dialog.unreadCount()&&r().session.user.pushAttributes({messageCount:(null!=(e=r().session.user.attribute("messageCount"))?e:1)-1}),m.redraw()}))}}),100),e}}flarum.reg.add("flarum-messages","forum/components/DialogListItem",A);class y extends(i()){oninit(e){super.oninit(e)}oncreate(e){super.oncreate(e)}onupdate(e){super.onupdate(e)}view(){return m("div",{className:"DialogList"},m("ul",{className:"DialogList-list"},this.attrs.state.getAllItems().map((e=>{var s;return m(A,{dialog:e,active:(null==(s=this.attrs.activeDialog)?void 0:s.id())===e.id(),actions:this.attrs.itemActions})}))),this.attrs.state.hasNext()&&!this.attrs.hideMore&&m("div",{className:"DialogList-loadMore"},m(n(),{className:"Button",onclick:this.attrs.state.loadNext.bind(this.attrs.state)},r().translator.trans("flarum-messages.forum.dialog_list.load_more_button"))))}}flarum.reg.add("flarum-messages","forum/components/DialogList",y)},654:(e,s,t)=>{t.r(s),t.d(s,{default:()=>me});var a=t(805),r=t(488),o=t.n(r),i=t(859),l=t.n(i),n=t(314),d=t.n(n),c=t(801),u=t.n(c),g=t(684),h=t(661),p=t.n(h),f=t(821),v=t.n(f),b=t(500),N=t.n(b),_=t(402),M=t.n(_),A=t(336),y=t.n(A);class I extends(M()){static initAttrs(e){e.className="MessagesPage-nav"}items(){const e=super.items(),s=o().session.user.attribute("canSendAnyMessage");return e.remove("newDiscussion"),e.add("newMessage",m(y(),{icon:"fas fa-edit",className:"Button Button--primary IndexPage-newDiscussion MessagesPage-newMessage",itemClassName:"App-primaryControl",onclick:()=>this.newMessageAction(),disabled:!s},o().translator.trans("flarum-messages.forum.messages_page.new_message_button")),10),e}newMessageAction(){return flarum.reg.asyncModuleImport("flarum/forum/components/ComposerBody").then((()=>(o().composer.load((()=>t.e(451).then(t.bind(t,761))),{user:o().session.user,onsubmit:()=>{o().dialogs.refresh()}}).then((()=>o().composer.show())),o().composer)))}}flarum.reg.add("flarum-messages","forum/components/MessagesSidebar",I);var k=t(950),D=t.n(k),w=t(476),P=t.n(w),S=t(906),T=t.n(S),B=t(154),L=t.n(B),x=t(917),C=t.n(x),R=t(3),H=t.n(R),j=t(651),q=t.n(j),G=t(301),O=t.n(G),E=t(443),F=t.n(E);class V extends(L()){oninit(e){super.oninit(e)}user(){return this.attrs.message.user()}controls(){return[]}freshness(){return this.attrs.message.freshness}createdByStarter(){return!1}onbeforeupdate(e){return super.onbeforeupdate(e)}onupdate(e){super.onupdate(e)}elementAttrs(){const e=this.attrs.message,s=super.elementAttrs();return s.className=F()(s.className||null,"Message",{"Post--renderFailed":e.renderFailed(),revealContent:!1,editing:!1}),s}header(){return super.header()}content(){return super.content().concat([m(H(),{headerItems:this.headerItems(),cardVisible:!1,isEditing:!1,isHidden:!1,contentHtml:this.attrs.message.contentHtml(),user:this.attrs.message.user()})])}classes(e){return super.classes(e)}actionItems(){return super.actionItems()}footerItems(){return super.footerItems()}sideItems(){return super.sideItems()}avatar(){return this.attrs.message.user()?m(C(),{user:this.attrs.message.user()}):""}headerItems(){const e=new(T()),s=this.attrs.message;return e.add("user",m(q(),{post:s}),100),e.add("meta",m(O(),{post:s})),e}}flarum.reg.add("flarum-messages","forum/components/Message",V);class z extends(D()){constructor(){super(...arguments),(0,a.A)(this,"replyPlaceholderComponent",v()(null)),(0,a.A)(this,"loadingPostComponent",v()(null)),(0,a.A)(this,"scrollListener",void 0),(0,a.A)(this,"initialToBottomScroll",!1),(0,a.A)(this,"lastTime",null),(0,a.A)(this,"checkedRead",!1),(0,a.A)(this,"markingAsRead",!1)}oninit(e){super.oninit(e),Promise.all([flarum.reg.asyncModuleImport("flarum/forum/components/ReplyPlaceholder"),flarum.reg.asyncModuleImport("flarum/forum/components/LoadingPost")]).then((e=>{let[s,t]=e;this.replyPlaceholderComponent(s.default),this.loadingPostComponent(t.default)}))}oncreate(e){super.oncreate(e),this.scrollListener=new(P())(this.onscroll.bind(this),this.element),setTimeout((()=>{this.scrollListener.start(),this.element.addEventListener("scrollend",this.markAsRead.bind(this))}))}onupdate(e){super.onupdate(e),this.initialToBottomScroll||this.attrs.state.isLoading()||(this.scrollToBottom(),this.initialToBottomScroll=!0),this.initialToBottomScroll&&!this.checkedRead&&(this.markAsRead(),this.checkedRead=!0)}onremove(e){super.onremove(e),this.scrollListener.stop()}view(){return m("div",{className:"MessageStream"},this.attrs.state.isLoading()?m(p(),null):this.content())}content(){var e;const s=[],a=this.attrs.state.getAllItems().sort(((e,s)=>e.createdAt().getTime()-s.createdAt().getTime())),r=this.replyPlaceholderComponent(),i=this.loadingPostComponent();return a[0].id()!==(null==(e=this.attrs.dialog.data.relationships)?void 0:e.firstMessage.data).id&&(s.push(m("div",{className:"MessageStream-item",key:"loadPrevious"},m(y(),{onclick:()=>this.whileMaintainingScroll((()=>this.attrs.state.loadNext())),type:"button",className:"Button Button--block MessageStream-loadPrev"},o().translator.trans("flarum-messages.forum.messages_page.stream.load_previous_button")))),i&&s.push(m("div",{className:"MessageStream-item",key:"loading-prev"},m(i,null)))),a.forEach(((e,t)=>s.push(this.messageItem(e,t)))),r&&s.push(m("div",{className:"MessageStream-item",key:"reply"},m(r,{discussion:this.attrs.dialog,onclick:()=>{flarum.reg.asyncModuleImport("flarum/forum/components/ComposerBody").then((()=>{o().composer.load((()=>t.e(451).then(t.bind(t,761))),{user:o().session.user,replyingTo:this.attrs.dialog,onsubmit:()=>{this.attrs.state.refresh().then((()=>setTimeout((()=>this.scrollToBottom()),50)))}}).then((()=>o().composer.show()))}))},composingReply:()=>o().composer.composingMessageTo(this.attrs.dialog)}))),s}messageItem(e,s){return m("div",{className:"MessageStream-item",key:s,"data-id":e.id()},this.timeGap(e),m(V,{message:e}))}timeGap(e){var s;if(e.id()===(null==(s=this.attrs.dialog.data.relationships)?void 0:s.firstMessage.data).id)return this.lastTime=e.createdAt(),m("div",{class:"PostStream-timeGap"},m("span",null,o().translator.trans("flarum-messages.forum.messages_page.stream.start_of_the_conversation")));const t=this.lastTime,a=e.createdAt().getTime()-((null==t?void 0:t.getTime())||0);return this.lastTime=e.createdAt(),t&&a>3456e5?m("div",{className:"PostStream-timeGap"},m("span",null,o().translator.trans("flarum-messages.forum.messages_page.stream.time_lapsed_text",{period:dayjs().add(a,"ms").fromNow(!0)}))):null}onscroll(){this.whileMaintainingScroll((()=>this.element.scrollTop<=80&&this.attrs.state.hasNext()?this.attrs.state.loadNext():this.element.scrollTop+this.element.clientHeight===this.element.scrollHeight&&this.attrs.state.hasPrev()?this.attrs.state.loadPrev():null))}scrollToBottom(){this.element.scrollTop=this.element.scrollHeight}whileMaintainingScroll(e){const s=this.element.scrollTop,t=this.element.scrollHeight,a=e();a instanceof Promise&&a.then((()=>{requestAnimationFrame((()=>{this.element.scrollTop=this.element.scrollHeight-t+s}))}))}markAsRead(){const e=Number(this.$(".MessageStream-item[data-id]").filter(((e,s)=>this.element.scrollHeight<=this.element.clientHeight||this.$().offset().top+this.element.clientHeight>$(s).offset().top)).last().data("id"));e&&o().session.user&&e>(this.attrs.dialog.lastReadMessageId()||0)&&!this.markingAsRead&&(this.markingAsRead=!0,this.attrs.dialog.save({lastReadMessageId:e}).finally((()=>{var e;this.markingAsRead=!1,0===this.attrs.dialog.unreadCount()&&o().session.user.pushAttributes({messageCount:(null!=(e=o().session.user.attribute("messageCount"))?e:1)-1}),m.redraw()})))}}flarum.reg.add("flarum-messages","forum/components/MessageStream",z);var J=t(521),K=t.n(J),Q=t(662),U=t.n(Q);class W extends(U()){constructor(e,s){void 0===s&&(s=1),super(e,s,null)}get type(){return"dialog-messages"}getAllItems(){return super.getAllItems()}}flarum.reg.add("flarum-messages","forum/states/MessageStreamState",W);var X=t(88),Y=t.n(X),Z=t(741),ee=t.n(Z),se=t(533),te=t.n(se),ae=t(653),re=t.n(ae),oe=t(819),ie=t.n(oe);class le extends(te()){className(){return"Modal--small Modal--flat DetailsModal"}title(){return o().translator.trans("flarum-messages.forum.dialog_section.details_modal.title")}content(){let e=(this.attrs.dialog.users()||[]).filter(Boolean);return m("div",{className:"Modal-body DetailsModal-infoGroups"},m("div",{className:"DetailsModal-recipients DetailsModal-info"},m("div",{className:"DetailsModal-info-title"},o().translator.trans("flarum-messages.forum.dialog_section.details_modal.recipients")),m("div",{className:"DetailsModal-recipients-list"},null==e?void 0:e.map((e=>m("div",{className:"DetailsModal-recipient"},m(C(),{user:e}),m(Y(),{href:o().route("user",{username:e.slug()})},m("span",{className:"DetailsModal-recipient-username"},K()(e))),m("div",{className:"badges"},ie()(e.badges().toArray()))))))),this.infoItems().toArray())}infoItems(){const e=new(T());return e.add("created",m("div",{className:"DetailsModal-createdAt DetailsModal-info"},m("div",{className:"DetailsModal-info-title"},o().translator.trans("flarum-messages.forum.dialog_section.details_modal.created_at")),m("div",{className:"DetailsModal-info-content"},re()(this.attrs.dialog.createdAt())))),e}}flarum.reg.add("flarum-messages","forum/components/DetailsModal",le);class ne extends(D()){constructor(){super(...arguments),(0,a.A)(this,"loading",!1),(0,a.A)(this,"messages",void 0)}oninit(e){super.oninit(e),this.messages=new W({filter:{dialog:this.attrs.dialog.id()},sort:"-createdAt"}),this.messages.refresh()}view(){const e=this.attrs.dialog.recipient();return m("div",{className:"DialogSection"},m("div",{className:"DialogSection-header"},m(C(),{user:e}),m("div",{className:"DialogSection-header-info"},e&&m(Y(),{href:o().route.user(e)},m("h2",null,K()(e)))||m("h2",null,K()(e)),m("div",{className:"badges"},ie()((null==e?void 0:e.badges().toArray())||[]))),m("div",{className:"DialogSection-header-actions"},this.actionItems().toArray())),m(z,{dialog:this.attrs.dialog,state:this.messages}))}actionItems(){const e=new(T());return e.add("details",m(ee(),{icon:"fas fa-ellipsis-h",className:"DialogSection-controls",buttonClassName:"Button Button--icon",accessibleToggleLabel:o().translator.trans("flarum-messages.forum.dialog_section.controls_toggle_label"),label:o().translator.trans("flarum-messages.forum.dialog_section.controls_toggle_label")},this.controlItems().toArray())),e}controlItems(){const e=new(T());return e.add("details",m(y(),{icon:"fas fa-info-circle",onclick:()=>o().modal.show(le,{dialog:this.attrs.dialog})},o().translator.trans("flarum-messages.forum.dialog_section.controls.details_button"))),e}}flarum.reg.add("flarum-messages","forum/components/DialogSection",ne);class me extends(l()){constructor(){super(...arguments),(0,a.A)(this,"selectedDialog",v()(null))}oninit(e){super.oninit(e),o().session.user?(o().current.set("noTagsList",!0),o().dialogs.hasItems()?this.initDialog():o().dialogs.refresh().then((async()=>{o().dialogs.hasItems()&&await this.initDialog()}))):m.route.set(o().route("index"))}dialogRequestParams(){return{include:"users.groups"}}async initDialog(){const e=m.route.param("id"),s=o().translator.trans("flarum-messages.forum.messages_page.title",{},!0);let t;t=e?o().store.getById("dialogs",e)||await o().store.find("dialogs",e,this.dialogRequestParams()):o().dialogs.getAllItems()[0],this.selectedDialog(t),t?(o().setTitle(t.title()),o().history.push("dialog",t.title())):(o().setTitle(s),o().history.push("messages",s)),m.redraw()}onupdate(e){super.onupdate(e);const s=this.element.querySelector(".DialogListItem.active"),t=this.element.querySelector(".DialogList");s&&$(t).offset().top+t.clientHeight<=$(s).offset().top&&s.scrollIntoView()}view(){return m(d(),{className:"MessagesPage Page--vertical",loading:!1,hero:this.hero.bind(this),sidebar:()=>m(I,null)},o().dialogs.isLoading()?m(p(),null):o().dialogs.hasItems()?m("div",{className:"MessagesPage-content"},m("div",{className:"MessagesPage-sidebar",key:"sidebar"},m("div",{className:"IndexPage-toolbar",key:"toolbar"},m("ul",{className:"IndexPage-toolbar-view"},ie()(this.viewItems().toArray())),m("ul",{className:"IndexPage-toolbar-action"},ie()(this.actionItems().toArray()))),m(g.A,{key:"list",state:o().dialogs,activeDialog:this.selectedDialog()})),this.selectedDialog()?m(ne,{key:"dialog",dialog:this.selectedDialog()}):m(p(),{key:"loading",display:"block"})):m(N(),{icon:"far fa-envelope-open"},o().translator.trans("flarum-messages.forum.messages_page.empty_text")))}hero(){return m("header",{className:"Hero MessagesPageHero"},m("div",{className:"container"},m("div",{className:"containerNarrow"},m("h1",{className:"Hero-title"},m(u(),{name:"fas fa-envelope"})," ",o().translator.trans("flarum-messages.forum.messages_page.hero.title")),m("div",{className:"Hero-subtitle"},o().translator.trans("flarum-messages.forum.messages_page.hero.subtitle")))))}viewItems(){var e;const s=new(T()),t=o().dialogs.sortMap(),a=Object.keys(t).reduce(((e,s)=>{const a=t[s];return e[s]="string"!=typeof a?a.label:o().translator.trans("flarum-messages.forum.index_sort.".concat(s,"_button")),e}),{});return s.add("sort",m(ee(),{buttonClassName:"Button",label:a[(null==(e=o().dialogs.getParams())?void 0:e.sort)||0]||Object.values(a)[0],accessibleToggleLabel:o().translator.trans("core.forum.index_sort.toggle_dropdown_accessible_label")},Object.keys(a).map((e=>{const s=a[e],r=(o().dialogs.getParams().sort||Object.keys(t)[0])===e;return m(y(),{icon:!r||"fas fa-check",onclick:()=>o().dialogs.changeSort(e),active:r},s)})))),s}actionItems(){const e=new(T());return e.add("refresh",m(y(),{title:o().translator.trans("flarum-messages.forum.messages_page.refresh_tooltip"),"aria-label":o().translator.trans("flarum-messages.forum.messages_page.refresh_tooltip"),icon:"fas fa-sync",className:"Button Button--icon",onclick:()=>{o().dialogs.refresh()}})),o().session.user&&e.add("markAllAsRead",m(y(),{title:o().translator.trans("flarum-messages.forum.messages_page.mark_all_as_read_tooltip"),"aria-label":o().translator.trans("flarum-messages.forum.messages_page.mark_all_as_read_tooltip"),icon:"fas fa-check",className:"Button Button--icon",onclick:()=>o().dialogs.markAllAsRead()})),e}}flarum.reg.add("flarum-messages","forum/components/MessagesPage",me)}}]); //# sourceMappingURL=MessagesPage.js.map \ No newline at end of file diff --git a/extensions/messages/js/dist/forum/components/MessagesPage.js.map b/extensions/messages/js/dist/forum/components/MessagesPage.js.map index 44f6530e9..683ce97cb 100644 --- a/extensions/messages/js/dist/forum/components/MessagesPage.js.map +++ b/extensions/messages/js/dist/forum/components/MessagesPage.js.map @@ -1 +1 @@ -{"version":3,"file":"forum/components/MessagesPage.js","mappings":"oSASe,MAAMA,UAAuB,KAC1C,IAAAC,CAAKC,GACH,IAAIC,EACJ,MAAMC,EAASC,KAAKC,MAAMF,OACpBG,EAAYH,EAAOG,YACnBC,EAAcJ,EAAOI,cAC3B,OAAOC,EAAE,KAAM,CACbC,UAAW,IAAU,iBAAkB,CACrC,yBAA0BN,EAAOO,cACjCC,OAAQP,KAAKC,MAAMM,UAEpBH,EAAE,IAAM,CACTI,KAAM,UAAUT,OAAOA,GACvBM,UAAW,IAAU,wBAAyB,CAC5CE,OAAQP,KAAKC,MAAMM,UAEpBH,EAAE,MAAO,CACVC,UAAW,yBACVD,EAAE,IAAQ,CACXK,KAAMP,MACFH,EAAOO,eAAiBF,EAAE,MAAO,CACrCC,UAAW,0BACVN,EAAOO,gBAAiBF,EAAE,MAAO,CAClCC,UAAW,0BACVD,EAAE,MAAO,CACVC,UAAW,wBACV,IAASH,GAAY,IAAUH,EAAOW,iBAAkBV,KAAKC,MAAMU,SAAWP,EAAE,MAAO,CACxFC,UAAW,0BACVL,KAAKY,cAAcC,YAAaT,EAAE,MAAO,CAC1CC,UAAW,8BACVF,EAAsE,OAAvDL,EAAwBK,EAAYW,qBAA0B,EAAShB,EAAsBiB,MAAM,EAAG,IAAM,MAChI,CACA,WAAAH,GACE,MAAMI,EAAQ,IAAI,KAsBlB,OArBAA,EAAMC,IAAI,aAAcb,EAAE,IAAQ,CAChCC,UAAW,0CACXa,KAAM,eACN,aAAc,eAAeC,MAAM,0DACnCC,QAASC,IACP,IAAIC,EACJD,EAAEE,iBACFF,EAAEG,kBACFxB,KAAKC,MAAMF,OAAO0B,KAAK,CACrBC,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SACjBE,MAAO2B,GAAkE,OAApDF,EAAwB,YAAYQ,kBAAuB,EAASR,EAAsBnF,OAAS,IAAMsF,OAAOM,OAAOP,GAAa,GACzJ5B,sBAAuB,eAAezJ,MAAM,2DAC3CsL,OAAOC,KAAKF,GAAa3J,KAAImK,IAC9B,MAAMnC,EAAQ2B,EAAYQ,GACpBzM,GAAU,YAAYuM,YAAY3F,MAAQsF,OAAOC,KAAKH,GAAS,MAAQS,EAC7E,OAAO5M,EAAE,IAAQ,CACfc,MAAMX,GAAS,eACfa,QAAS,IAAM,YAAY6L,WAAWD,GACtCzM,OAAQA,GACPsK,EAAM,MAEJ7J,CACT,CAMA,WAAAJ,GACE,MAAMI,EAAQ,IAAI,KAmBlB,OAlBAA,EAAMC,IAAI,UAAWb,EAAE,IAAQ,CAC7B8J,MAAO,eAAe/I,MAAM,uDAC5B,aAAc,eAAeA,MAAM,uDACnCD,KAAM,cACNb,UAAW,sBACXe,QAAS,KACP,YAAY4C,SAAS,KAGrB,YAAYvD,MACdO,EAAMC,IAAI,gBAAiBb,EAAE,IAAQ,CACnC8J,MAAO,eAAe/I,MAAM,gEAC5B,aAAc,eAAeA,MAAM,gEACnCD,KAAM,eACNb,UAAW,sBACXe,QAAS,IAAM,YAAY8L,mBAGxBlM,CACT,EAEFoB,OAAOC,IAAIpB,IAAI,kBAAmB,gCAAiC8J,G","sources":["webpack://@flarum/messages/./src/forum/components/DialogListItem.tsx","webpack://@flarum/messages/./src/forum/components/DialogList.tsx","webpack://@flarum/messages/./src/forum/components/MessagesSidebar.tsx","webpack://@flarum/messages/./src/forum/components/Message.tsx","webpack://@flarum/messages/./src/forum/components/MessageStream.tsx","webpack://@flarum/messages/./src/forum/states/MessageStreamState.ts","webpack://@flarum/messages/./src/forum/components/DetailsModal.tsx","webpack://@flarum/messages/./src/forum/components/DialogSection.tsx","webpack://@flarum/messages/./src/forum/components/MessagesPage.tsx"],"sourcesContent":["import Component from 'flarum/common/Component';\nimport classList from 'flarum/common/utils/classList';\nimport Link from 'flarum/common/components/Link';\nimport app from 'flarum/forum/app';\nimport Avatar from 'flarum/common/components/Avatar';\nimport username from 'flarum/common/helpers/username';\nimport humanTime from 'flarum/common/helpers/humanTime';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Button from 'flarum/common/components/Button';\nexport default class DialogListItem extends Component {\n view(vnode) {\n var _lastMessage$contentP;\n const dialog = this.attrs.dialog;\n const recipient = dialog.recipient();\n const lastMessage = dialog.lastMessage();\n return m(\"li\", {\n className: classList('DialogListItem', {\n 'DialogListItem--unread': dialog.unreadCount(),\n active: this.attrs.active\n })\n }, m(Link, {\n href: app.route.dialog(dialog),\n className: classList('DialogListItem-button', {\n active: this.attrs.active\n })\n }, m(\"div\", {\n className: \"DialogListItem-avatar\"\n }, m(Avatar, {\n user: recipient\n }), !!dialog.unreadCount() && m(\"div\", {\n className: \"Bubble Bubble--primary\"\n }, dialog.unreadCount())), m(\"div\", {\n className: \"DialogListItem-content\"\n }, m(\"div\", {\n className: \"DialogListItem-title\"\n }, username(recipient), humanTime(dialog.lastMessageAt()), this.attrs.actions && m(\"div\", {\n className: \"DialogListItem-actions\"\n }, this.actionItems().toArray())), m(\"div\", {\n className: \"DialogListItem-lastMessage\"\n }, lastMessage ? (_lastMessage$contentP = lastMessage.contentPlain()) == null ? void 0 : _lastMessage$contentP.slice(0, 80) : ''))));\n }\n actionItems() {\n const items = new ItemList();\n items.add('markAsRead', m(Button, {\n className: \"Notification-action Button Button--link\",\n icon: \"fas fa-check\",\n \"aria-label\": app.translator.trans('flarum-messages.forum.dialog_list.mark_as_read_tooltip'),\n onclick: e => {\n var _this$attrs$dialog$da;\n e.preventDefault();\n e.stopPropagation();\n this.attrs.dialog.save({\n lastReadMessageId: ((_this$attrs$dialog$da = this.attrs.dialog.data.relationships) == null ? void 0 : _this$attrs$dialog$da.lastMessage.data).id\n }).finally(() => {\n if (this.attrs.dialog.unreadCount() === 0) {\n var _attribute;\n app.session.user.pushAttributes({\n messageCount: ((_attribute = app.session.user.attribute('messageCount')) != null ? _attribute : 1) - 1\n });\n }\n m.redraw();\n });\n }\n }), 100);\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DialogListItem', DialogListItem);","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport DialogListItem from './DialogListItem';\nexport default class DialogList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n }\n oncreate(vnode) {\n super.oncreate(vnode);\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n }\n view() {\n return m(\"div\", {\n className: \"DialogList\"\n }, m(\"ul\", {\n className: \"DialogList-list\"\n }, this.attrs.state.getAllItems().map(dialog => {\n var _this$attrs$activeDia;\n return m(DialogListItem, {\n dialog: dialog,\n active: ((_this$attrs$activeDia = this.attrs.activeDialog) == null ? void 0 : _this$attrs$activeDia.id()) === dialog.id(),\n actions: this.attrs.itemActions\n });\n })), this.attrs.state.hasNext() && !this.attrs.hideMore && m(\"div\", {\n className: \"DialogList-loadMore\"\n }, m(Button, {\n className: \"Button\",\n onclick: this.attrs.state.loadNext.bind(this.attrs.state)\n }, app.translator.trans('flarum-messages.forum.dialog_list.load_more_button'))));\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DialogList', DialogList);","import app from 'flarum/forum/app';\nimport IndexSidebar from 'flarum/forum/components/IndexSidebar';\nimport Button from 'flarum/common/components/Button';\nexport default class MessagesSidebar extends IndexSidebar {\n static initAttrs(attrs) {\n attrs.className = 'MessagesPage-nav';\n }\n items() {\n const items = super.items();\n const canSendAnyMessage = app.session.user.attribute('canSendAnyMessage');\n items.remove('newDiscussion');\n items.add('newMessage', m(Button, {\n icon: \"fas fa-edit\",\n className: \"Button Button--primary IndexPage-newDiscussion MessagesPage-newMessage\",\n itemClassName: \"App-primaryControl\",\n onclick: () => {\n return this.newMessageAction();\n },\n disabled: !canSendAnyMessage\n }, app.translator.trans('flarum-messages.forum.messages_page.new_message_button')), 10);\n return items;\n }\n\n /**\n * Open the composer for a new message.\n */\n newMessageAction() {\n return flarum.reg.asyncModuleImport('flarum/forum/components/ComposerBody').then(() => {\n app.composer.load(() => import(/* webpackChunkName: 'forum/components/MessageComposer', webpackMode: 'lazy-once' */ './MessageComposer'), {\n user: app.session.user,\n onsubmit: () => {\n app.dialogs.refresh();\n }\n }).then(() => app.composer.show());\n return app.composer;\n });\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/MessagesSidebar', MessagesSidebar);","import ItemList from 'flarum/common/utils/ItemList';\nimport AbstractPost from 'flarum/forum/components/AbstractPost';\nimport Avatar from 'flarum/common/components/Avatar';\nimport Comment from 'flarum/forum/components/Comment';\nimport PostUser from 'flarum/forum/components/PostUser';\nimport PostMeta from 'flarum/forum/components/PostMeta';\nimport classList from 'flarum/common/utils/classList';\n/**\n * The `Post` component displays a single post. The basic post template just\n * includes a controls dropdown; subclasses must implement `content` and `attrs`\n * methods.\n */\nexport default class Message extends AbstractPost {\n oninit(vnode) {\n super.oninit(vnode);\n }\n user() {\n return this.attrs.message.user();\n }\n controls() {\n return [];\n }\n freshness() {\n return this.attrs.message.freshness;\n }\n createdByStarter() {\n return false;\n }\n onbeforeupdate(vnode) {\n return super.onbeforeupdate(vnode);\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n }\n elementAttrs() {\n const message = this.attrs.message;\n const attrs = super.elementAttrs();\n attrs.className = classList(attrs.className || null, 'Message', {\n 'Post--renderFailed': message.renderFailed(),\n revealContent: false,\n editing: false\n });\n return attrs;\n }\n header() {\n return super.header();\n }\n content() {\n return super.content().concat([m(Comment, {\n headerItems: this.headerItems(),\n cardVisible: false,\n isEditing: false,\n isHidden: false,\n contentHtml: this.attrs.message.contentHtml(),\n user: this.attrs.message.user()\n })]);\n }\n classes(existing) {\n return super.classes(existing);\n }\n actionItems() {\n return super.actionItems();\n }\n footerItems() {\n return super.footerItems();\n }\n sideItems() {\n return super.sideItems();\n }\n avatar() {\n return this.attrs.message.user() ? m(Avatar, {\n user: this.attrs.message.user()\n }) : '';\n }\n headerItems() {\n const items = new ItemList();\n const message = this.attrs.message;\n items.add('user', m(PostUser, {\n post: message\n }), 100);\n items.add('meta', m(PostMeta, {\n post: message\n }));\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/Message', Message);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Stream from 'flarum/common/utils/Stream';\nimport Button from 'flarum/common/components/Button';\nimport ScrollListener from 'flarum/common/utils/ScrollListener';\nimport Message from './Message';\nexport default class MessageStream extends Component {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"replyPlaceholderComponent\", Stream(null));\n _defineProperty(this, \"loadingPostComponent\", Stream(null));\n _defineProperty(this, \"scrollListener\", void 0);\n _defineProperty(this, \"initialToBottomScroll\", false);\n _defineProperty(this, \"lastTime\", null);\n _defineProperty(this, \"checkedRead\", false);\n _defineProperty(this, \"markingAsRead\", false);\n }\n oninit(vnode) {\n super.oninit(vnode);\n\n // We need the lazy ReplyPlaceholder and LoadingPost components to be loaded.\n Promise.all([flarum.reg.asyncModuleImport('flarum/forum/components/ReplyPlaceholder'), flarum.reg.asyncModuleImport('flarum/forum/components/LoadingPost')]).then(_ref => {\n let [ReplyPlaceholder, LoadingPost] = _ref;\n this.replyPlaceholderComponent(ReplyPlaceholder.default);\n this.loadingPostComponent(LoadingPost.default);\n });\n }\n oncreate(vnode) {\n super.oncreate(vnode);\n this.scrollListener = new ScrollListener(this.onscroll.bind(this), this.element);\n setTimeout(() => {\n this.scrollListener.start();\n this.element.addEventListener('scrollend', this.markAsRead.bind(this));\n });\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n\n // @todo: for future versions, consider using the post stream scrubber to scroll through the messages. (big task..)\n // @todo: introduce read status, to jump to the first unread message instead.\n if (!this.initialToBottomScroll && !this.attrs.state.isLoading()) {\n this.scrollToBottom();\n this.initialToBottomScroll = true;\n }\n if (this.initialToBottomScroll && !this.checkedRead) {\n this.markAsRead();\n this.checkedRead = true;\n }\n }\n onremove(vnode) {\n super.onremove(vnode);\n this.scrollListener.stop();\n }\n view() {\n return m(\"div\", {\n className: \"MessageStream\"\n }, this.attrs.state.isLoading() ? m(LoadingIndicator, null) : this.content());\n }\n content() {\n var _this$attrs$dialog$da;\n const items = [];\n const messages = this.attrs.state.getAllItems().sort((a, b) => a.createdAt().getTime() - b.createdAt().getTime());\n const ReplyPlaceholder = this.replyPlaceholderComponent();\n const LoadingPost = this.loadingPostComponent();\n if (messages[0].id() !== ((_this$attrs$dialog$da = this.attrs.dialog.data.relationships) == null ? void 0 : _this$attrs$dialog$da.firstMessage.data).id) {\n items.push(m(\"div\", {\n className: \"MessageStream-item\",\n key: \"loadPrevious\"\n }, m(Button, {\n onclick: () => this.whileMaintainingScroll(() => this.attrs.state.loadNext()),\n type: \"button\",\n className: \"Button Button--block MessageStream-loadPrev\"\n }, app.translator.trans('flarum-messages.forum.messages_page.stream.load_previous_button'))));\n if (LoadingPost) {\n items.push(m(\"div\", {\n className: \"MessageStream-item\",\n key: \"loading-prev\"\n }, m(LoadingPost, null)));\n }\n }\n messages.forEach((message, index) => items.push(this.messageItem(message, index)));\n if (ReplyPlaceholder) {\n items.push(m(\"div\", {\n className: \"MessageStream-item\",\n key: \"reply\" /*data-index={this.attrs.state.count()}*/\n }, m(ReplyPlaceholder, {\n discussion: this.attrs.dialog,\n onclick: () => {\n flarum.reg.asyncModuleImport('flarum/forum/components/ComposerBody').then(() => {\n app.composer.load(() => import(/* webpackChunkName: 'forum/components/MessageComposer', webpackMode: 'lazy-once' */ './MessageComposer'), {\n user: app.session.user,\n replyingTo: this.attrs.dialog,\n onsubmit: message => {\n this.attrs.state.push(message);\n setTimeout(() => this.scrollToBottom(), 50);\n }\n }).then(() => app.composer.show());\n });\n },\n composingReply: () => app.composer.composingMessageTo(this.attrs.dialog)\n })));\n }\n return items;\n }\n messageItem(message, index) {\n return m(\"div\", {\n className: \"MessageStream-item\",\n key: index,\n \"data-id\": message.id()\n }, this.timeGap(message), m(Message, {\n message: message\n }));\n }\n timeGap(message) {\n var _this$attrs$dialog$da2;\n if (message.id() === ((_this$attrs$dialog$da2 = this.attrs.dialog.data.relationships) == null ? void 0 : _this$attrs$dialog$da2.firstMessage.data).id) {\n this.lastTime = message.createdAt();\n return m(\"div\", {\n class: \"PostStream-timeGap\"\n }, m(\"span\", null, app.translator.trans('flarum-messages.forum.messages_page.stream.start_of_the_conversation')));\n }\n const lastTime = this.lastTime;\n const dt = message.createdAt().getTime() - ((lastTime == null ? void 0 : lastTime.getTime()) || 0);\n this.lastTime = message.createdAt();\n if (lastTime && dt > 1000 * 60 * 60 * 24 * 4) {\n return m(\"div\", {\n className: \"PostStream-timeGap\"\n }, m(\"span\", null, app.translator.trans('flarum-messages.forum.messages_page.stream.time_lapsed_text', {\n period: dayjs().add(dt, 'ms').fromNow(true)\n })));\n }\n return null;\n }\n onscroll() {\n this.whileMaintainingScroll(() => {\n if (this.element.scrollTop <= 80 && this.attrs.state.hasNext()) {\n return this.attrs.state.loadNext();\n }\n if (this.element.scrollTop + this.element.clientHeight === this.element.scrollHeight && this.attrs.state.hasPrev()) {\n return this.attrs.state.loadPrev();\n }\n return null;\n });\n }\n scrollToBottom() {\n this.element.scrollTop = this.element.scrollHeight;\n }\n whileMaintainingScroll(callback) {\n const scrollTop = this.element.scrollTop;\n const scrollHeight = this.element.scrollHeight;\n const result = callback();\n if (result instanceof Promise) {\n result.then(() => {\n requestAnimationFrame(() => {\n this.element.scrollTop = this.element.scrollHeight - scrollHeight + scrollTop;\n });\n });\n }\n }\n markAsRead() {\n const lastVisibleId = Number(this.$('.MessageStream-item[data-id]').filter((_, $el) => {\n if (this.element.scrollHeight <= this.element.clientHeight) {\n return true;\n }\n return this.$().offset().top + this.element.clientHeight > $($el).offset().top;\n }).last().data('id'));\n if (lastVisibleId && app.session.user && lastVisibleId > (this.attrs.dialog.lastReadMessageId() || 0) && !this.markingAsRead) {\n this.markingAsRead = true;\n this.attrs.dialog.save({\n lastReadMessageId: lastVisibleId\n }).finally(() => {\n this.markingAsRead = false;\n if (this.attrs.dialog.unreadCount() === 0) {\n var _attribute;\n app.session.user.pushAttributes({\n messageCount: ((_attribute = app.session.user.attribute('messageCount')) != null ? _attribute : 1) - 1\n });\n }\n m.redraw();\n });\n }\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/MessageStream', MessageStream);","import PaginatedListState from 'flarum/common/states/PaginatedListState';\nexport default class MessageStreamState extends PaginatedListState {\n constructor(params, page) {\n if (page === void 0) {\n page = 1;\n }\n super(params, page, null);\n }\n get type() {\n return 'dialog-messages';\n }\n getAllItems() {\n return super.getAllItems();\n }\n}\nflarum.reg.add('flarum-messages', 'forum/states/MessageStreamState', MessageStreamState);","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Avatar from 'flarum/common/components/Avatar';\nimport fullTime from 'flarum/common/helpers/fullTime';\nimport username from 'flarum/common/helpers/username';\nimport Link from 'flarum/common/components/Link';\nimport listItems from 'flarum/common/helpers/listItems';\nexport default class DetailsModal extends Modal {\n className() {\n return 'Modal--small Modal--flat DetailsModal';\n }\n title() {\n return app.translator.trans('flarum-messages.forum.dialog_section.details_modal.title');\n }\n content() {\n let recipients = (this.attrs.dialog.users() || []).filter(Boolean);\n return m(\"div\", {\n className: \"Modal-body DetailsModal-infoGroups\"\n }, m(\"div\", {\n className: \"DetailsModal-recipients DetailsModal-info\"\n }, m(\"div\", {\n className: \"DetailsModal-info-title\"\n }, app.translator.trans('flarum-messages.forum.dialog_section.details_modal.recipients')), m(\"div\", {\n className: \"DetailsModal-recipients-list\"\n }, recipients == null ? void 0 : recipients.map(recipient => {\n return m(\"div\", {\n className: \"DetailsModal-recipient\"\n }, m(Avatar, {\n user: recipient\n }), m(Link, {\n href: app.route('user', {\n username: recipient.slug()\n })\n }, m(\"span\", {\n className: \"DetailsModal-recipient-username\"\n }, username(recipient))), m(\"div\", {\n className: \"badges\"\n }, listItems(recipient.badges().toArray())));\n }))), this.infoItems().toArray());\n }\n infoItems() {\n const items = new ItemList();\n items.add('created', m(\"div\", {\n className: \"DetailsModal-createdAt DetailsModal-info\"\n }, m(\"div\", {\n className: \"DetailsModal-info-title\"\n }, app.translator.trans('flarum-messages.forum.dialog_section.details_modal.created_at')), m(\"div\", {\n className: \"DetailsModal-info-content\"\n }, fullTime(this.attrs.dialog.createdAt()))));\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DetailsModal', DetailsModal);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport Component from 'flarum/common/Component';\nimport MessageStream from './MessageStream';\nimport username from 'flarum/common/helpers/username';\nimport MessageStreamState from '../states/MessageStreamState';\nimport Avatar from 'flarum/common/components/Avatar';\nimport Link from 'flarum/common/components/Link';\nimport app from 'flarum/forum/app';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Button from 'flarum/common/components/Button';\nimport Dropdown from 'flarum/common/components/Dropdown';\nimport DetailsModal from './DetailsModal';\nimport listItems from 'flarum/common/helpers/listItems';\nexport default class DialogSection extends Component {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"loading\", false);\n _defineProperty(this, \"messages\", void 0);\n }\n oninit(vnode) {\n super.oninit(vnode);\n this.messages = new MessageStreamState({\n filter: {\n dialog: this.attrs.dialog.id()\n },\n sort: '-createdAt'\n });\n this.messages.refresh();\n }\n view() {\n const recipient = this.attrs.dialog.recipient();\n return m(\"div\", {\n className: \"DialogSection\"\n }, m(\"div\", {\n className: \"DialogSection-header\"\n }, m(Avatar, {\n user: recipient\n }), m(\"div\", {\n className: \"DialogSection-header-info\"\n }, recipient && m(Link, {\n href: app.route.user(recipient)\n }, m(\"h2\", null, username(recipient))) || m(\"h2\", null, username(recipient)), m(\"div\", {\n className: \"badges\"\n }, listItems((recipient == null ? void 0 : recipient.badges().toArray()) || []))), m(\"div\", {\n className: \"DialogSection-header-actions\"\n }, this.actionItems().toArray())), m(MessageStream, {\n dialog: this.attrs.dialog,\n state: this.messages\n }));\n }\n actionItems() {\n const items = new ItemList();\n items.add('details', m(Dropdown, {\n icon: \"fas fa-ellipsis-h\",\n className: \"DialogSection-controls\",\n buttonClassName: \"Button Button--icon\",\n accessibleToggleLabel: app.translator.trans('flarum-messages.forum.dialog_section.controls_toggle_label'),\n label: app.translator.trans('flarum-messages.forum.dialog_section.controls_toggle_label')\n }, this.controlItems().toArray()));\n return items;\n }\n controlItems() {\n const items = new ItemList();\n items.add('details', m(Button, {\n icon: \"fas fa-info-circle\",\n onclick: () => app.modal.show(DetailsModal, {\n dialog: this.attrs.dialog\n })\n }, app.translator.trans('flarum-messages.forum.dialog_section.controls.details_button')));\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DialogSection', DialogSection);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/forum/app';\nimport Page from 'flarum/common/components/Page';\nimport PageStructure from 'flarum/forum/components/PageStructure';\nimport Icon from 'flarum/common/components/Icon';\nimport DialogList from './DialogList';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Stream from 'flarum/common/utils/Stream';\nimport InfoTile from 'flarum/common/components/InfoTile';\nimport MessagesSidebar from './MessagesSidebar';\nimport DialogSection from './DialogSection';\nimport listItems from 'flarum/common/helpers/listItems';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Dropdown from 'flarum/common/components/Dropdown';\nimport Button from 'flarum/common/components/Button';\nexport default class MessagesPage extends Page {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"selectedDialog\", Stream(null));\n }\n oninit(vnode) {\n super.oninit(vnode);\n if (!app.session.user) {\n m.route.set(app.route('index'));\n return;\n }\n app.current.set('noTagsList', true);\n if (!app.dialogs.hasItems()) {\n app.dialogs.refresh().then(async () => {\n if (app.dialogs.hasItems()) {\n await this.initDialog();\n }\n });\n } else {\n this.initDialog();\n }\n }\n dialogRequestParams() {\n return {\n include: 'users.groups'\n };\n }\n async initDialog() {\n const dialogId = m.route.param('id');\n const title = app.translator.trans('flarum-messages.forum.messages_page.title', {}, true);\n let dialog;\n if (dialogId) {\n dialog = app.store.getById('dialogs', dialogId) || (await app.store.find('dialogs', dialogId, this.dialogRequestParams()));\n } else {\n dialog = app.dialogs.getAllItems()[0];\n }\n this.selectedDialog(dialog);\n if (dialog) {\n app.setTitle(dialog.title());\n app.history.push('dialog', dialog.title());\n } else {\n app.setTitle(title);\n app.history.push('messages', title);\n }\n m.redraw();\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n\n // Scroll the dialog list to the active dialog item if present and not visible.\n const dialogElement = this.element.querySelector('.DialogListItem.active');\n const container = this.element.querySelector('.DialogList');\n if (dialogElement && $(container).offset().top + container.clientHeight <= $(dialogElement).offset().top) {\n dialogElement.scrollIntoView();\n }\n }\n view() {\n return m(PageStructure, {\n className: \"MessagesPage Page--vertical\",\n loading: false,\n hero: this.hero.bind(this),\n sidebar: () => m(MessagesSidebar, null)\n }, app.dialogs.isLoading() ? m(LoadingIndicator, null) : !app.dialogs.hasItems() ? m(InfoTile, {\n icon: \"far fa-envelope-open\"\n }, app.translator.trans('flarum-messages.forum.messages_page.empty_text')) : m(\"div\", {\n className: \"MessagesPage-content\"\n }, m(\"div\", {\n className: \"MessagesPage-sidebar\",\n key: \"sidebar\"\n }, m(\"div\", {\n className: \"IndexPage-toolbar\",\n key: \"toolbar\"\n }, m(\"ul\", {\n className: \"IndexPage-toolbar-view\"\n }, listItems(this.viewItems().toArray())), m(\"ul\", {\n className: \"IndexPage-toolbar-action\"\n }, listItems(this.actionItems().toArray()))), m(DialogList, {\n key: \"list\",\n state: app.dialogs,\n activeDialog: this.selectedDialog()\n })), this.selectedDialog() ? m(DialogSection, {\n key: \"dialog\",\n dialog: this.selectedDialog()\n }) : m(LoadingIndicator, {\n key: \"loading\",\n display: \"block\"\n })));\n }\n hero() {\n return m(\"header\", {\n className: \"Hero MessagesPageHero\"\n }, m(\"div\", {\n className: \"container\"\n }, m(\"div\", {\n className: \"containerNarrow\"\n }, m(\"h1\", {\n className: \"Hero-title\"\n }, m(Icon, {\n name: \"fas fa-envelope\"\n }), \" \", app.translator.trans('flarum-messages.forum.messages_page.hero.title')), m(\"div\", {\n className: \"Hero-subtitle\"\n }, app.translator.trans('flarum-messages.forum.messages_page.hero.subtitle')))));\n }\n\n /**\n * Build an item list for the part of the toolbar which is concerned with how\n * the results are displayed. By default this is just a select box to change\n * the way discussions are sorted.\n */\n viewItems() {\n var _app$dialogs$getParam;\n const items = new ItemList();\n const sortMap = app.dialogs.sortMap();\n const sortOptions = Object.keys(sortMap).reduce((acc, sortId) => {\n const sort = sortMap[sortId];\n acc[sortId] = typeof sort !== 'string' ? sort.label : app.translator.trans(\"flarum-messages.forum.index_sort.\".concat(sortId, \"_button\"));\n return acc;\n }, {});\n items.add('sort', m(Dropdown, {\n buttonClassName: \"Button\",\n label: sortOptions[((_app$dialogs$getParam = app.dialogs.getParams()) == null ? void 0 : _app$dialogs$getParam.sort) || 0] || Object.values(sortOptions)[0],\n accessibleToggleLabel: app.translator.trans('core.forum.index_sort.toggle_dropdown_accessible_label')\n }, Object.keys(sortOptions).map(value => {\n const label = sortOptions[value];\n const active = (app.dialogs.getParams().sort || Object.keys(sortMap)[0]) === value;\n return m(Button, {\n icon: active ? 'fas fa-check' : true,\n onclick: () => app.dialogs.changeSort(value),\n active: active\n }, label);\n })));\n return items;\n }\n\n /**\n * Build an item list for the part of the toolbar which is about taking action\n * on the results. By default this is just a \"mark all as read\" button.\n */\n actionItems() {\n const items = new ItemList();\n items.add('refresh', m(Button, {\n title: app.translator.trans('flarum-messages.forum.messages_page.refresh_tooltip'),\n \"aria-label\": app.translator.trans('flarum-messages.forum.messages_page.refresh_tooltip'),\n icon: \"fas fa-sync\",\n className: \"Button Button--icon\",\n onclick: () => {\n app.dialogs.refresh();\n }\n }));\n if (app.session.user) {\n items.add('markAllAsRead', m(Button, {\n title: app.translator.trans('flarum-messages.forum.messages_page.mark_all_as_read_tooltip'),\n \"aria-label\": app.translator.trans('flarum-messages.forum.messages_page.mark_all_as_read_tooltip'),\n icon: \"fas fa-check\",\n className: \"Button Button--icon\",\n onclick: () => app.dialogs.markAllAsRead()\n }));\n }\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/MessagesPage', MessagesPage);"],"names":["DialogListItem","view","vnode","_lastMessage$contentP","dialog","this","attrs","recipient","lastMessage","m","className","unreadCount","active","href","user","lastMessageAt","actions","actionItems","toArray","contentPlain","slice","items","add","icon","trans","onclick","e","_this$attrs$dialog$da","preventDefault","stopPropagation","save","lastReadMessageId","data","relationships","id","finally","_attribute","pushAttributes","messageCount","attribute","redraw","flarum","reg","DialogList","oninit","super","oncreate","onupdate","state","getAllItems","map","_this$attrs$activeDia","activeDialog","itemActions","hasNext","hideMore","loadNext","bind","MessagesSidebar","initAttrs","canSendAnyMessage","remove","itemClassName","newMessageAction","disabled","asyncModuleImport","then","load","onsubmit","refresh","show","Message","message","controls","freshness","createdByStarter","onbeforeupdate","elementAttrs","renderFailed","revealContent","editing","header","content","concat","headerItems","cardVisible","isEditing","isHidden","contentHtml","classes","existing","footerItems","sideItems","avatar","post","MessageStream","constructor","arguments","Promise","all","_ref","ReplyPlaceholder","LoadingPost","replyPlaceholderComponent","default","loadingPostComponent","scrollListener","onscroll","element","setTimeout","start","addEventListener","markAsRead","initialToBottomScroll","isLoading","scrollToBottom","checkedRead","onremove","stop","messages","sort","a","b","createdAt","getTime","firstMessage","push","key","whileMaintainingScroll","type","forEach","index","messageItem","discussion","replyingTo","composingReply","composingMessageTo","timeGap","_this$attrs$dialog$da2","lastTime","class","dt","period","dayjs","fromNow","scrollTop","clientHeight","scrollHeight","hasPrev","loadPrev","callback","result","requestAnimationFrame","lastVisibleId","Number","$","filter","_","$el","offset","top","last","markingAsRead","MessageStreamState","params","page","DetailsModal","title","recipients","users","Boolean","username","slug","badges","infoItems","DialogSection","buttonClassName","accessibleToggleLabel","label","controlItems","MessagesPage","set","hasItems","initDialog","async","route","dialogRequestParams","include","dialogId","param","getById","find","selectedDialog","dialogElement","querySelector","container","scrollIntoView","loading","hero","sidebar","viewItems","display","name","_app$dialogs$getParam","sortMap","sortOptions","Object","keys","reduce","acc","sortId","getParams","values","value","changeSort","markAllAsRead"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum/components/MessagesPage.js","mappings":"oSASe,MAAMA,UAAuB,KAC1C,IAAAC,CAAKC,GACH,IAAIC,EACJ,MAAMC,EAASC,KAAKC,MAAMF,OACpBG,EAAYH,EAAOG,YACnBC,EAAcJ,EAAOI,cAC3B,OAAOC,EAAE,KAAM,CACbC,UAAW,IAAU,iBAAkB,CACrC,yBAA0BN,EAAOO,cACjCC,OAAQP,KAAKC,MAAMM,UAEpBH,EAAE,IAAM,CACTI,KAAM,UAAUT,OAAOA,GACvBM,UAAW,IAAU,wBAAyB,CAC5CE,OAAQP,KAAKC,MAAMM,UAEpBH,EAAE,MAAO,CACVC,UAAW,yBACVD,EAAE,IAAQ,CACXK,KAAMP,MACFH,EAAOO,eAAiBF,EAAE,MAAO,CACrCC,UAAW,0BACVN,EAAOO,gBAAiBF,EAAE,MAAO,CAClCC,UAAW,0BACVD,EAAE,MAAO,CACVC,UAAW,wBACV,IAASH,GAAY,IAAUH,EAAOW,iBAAkBV,KAAKC,MAAMU,SAAWP,EAAE,MAAO,CACxFC,UAAW,0BACVL,KAAKY,cAAcC,YAAaT,EAAE,MAAO,CAC1CC,UAAW,8BACVF,EAAsE,OAAvDL,EAAwBK,EAAYW,qBAA0B,EAAShB,EAAsBiB,MAAM,EAAG,IAAM,MAChI,CACA,WAAAH,GACE,MAAMI,EAAQ,IAAI,KAsBlB,OArBAA,EAAMC,IAAI,aAAcb,EAAE,IAAQ,CAChCC,UAAW,0CACXa,KAAM,eACN,aAAc,eAAeC,MAAM,0DACnCC,QAASC,IACP,IAA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,GACT,CAAC,GAcJ,OAbA5L,EAAMC,IAAI,OAAQb,EAAE,KAAU,CAC5BuK,gBAAiB,SACjBE,MAAO2B,GAAkE,OAApDF,EAAwB,YAAYQ,kBAAuB,EAASR,EAAsBnF,OAAS,IAAMsF,OAAOM,OAAOP,GAAa,GACzJ5B,sBAAuB,eAAezJ,MAAM,2DAC3CsL,OAAOC,KAAKF,GAAa3J,KAAImK,IAC9B,MAAMnC,EAAQ2B,EAAYQ,GACpBzM,GAAU,YAAYuM,YAAY3F,MAAQsF,OAAOC,KAAKH,GAAS,MAAQS,EAC7E,OAAO5M,EAAE,IAAQ,CACfc,MAAMX,GAAS,eACfa,QAAS,IAAM,YAAY6L,WAAWD,GACtCzM,OAAQA,GACPsK,EAAM,MAEJ7J,CACT,CAMA,WAAAJ,GACE,MAAMI,EAAQ,IAAI,KAmBlB,OAlBAA,EAAMC,IAAI,UAAWb,EAAE,IAAQ,CAC7B8J,MAAO,eAAe/I,MAAM,uDAC5B,aAAc,eAAeA,MAAM,uDACnCD,KAAM,cACNb,UAAW,sBACXe,QAAS,KACP,YAAY4C,SAAS,KAGrB,YAAYvD,MACdO,EAAMC,IAAI,gBAAiBb,EAAE,IAAQ,CACnC8J,MAAO,eAAe/I,MAAM,gEAC5B,aAAc,eAAeA,MAAM,gEACnCD,KAAM,eACNb,UAAW,sBACXe,QAAS,IAAM,YAAY8L,mBAGxBlM,CACT,EAEFoB,OAAOC,IAAIpB,IAAI,kBAAmB,gCAAiC8J,G","sources":["webpack://@flarum/messages/./src/forum/components/DialogListItem.tsx","webpack://@flarum/messages/./src/forum/components/DialogList.tsx","webpack://@flarum/messages/./src/forum/components/MessagesSidebar.tsx","webpack://@flarum/messages/./src/forum/components/Message.tsx","webpack://@flarum/messages/./src/forum/components/MessageStream.tsx","webpack://@flarum/messages/./src/forum/states/MessageStreamState.ts","webpack://@flarum/messages/./src/forum/components/DetailsModal.tsx","webpack://@flarum/messages/./src/forum/components/DialogSection.tsx","webpack://@flarum/messages/./src/forum/components/MessagesPage.tsx"],"sourcesContent":["import Component from 'flarum/common/Component';\nimport classList from 'flarum/common/utils/classList';\nimport Link from 'flarum/common/components/Link';\nimport app from 'flarum/forum/app';\nimport Avatar from 'flarum/common/components/Avatar';\nimport username from 'flarum/common/helpers/username';\nimport humanTime from 'flarum/common/helpers/humanTime';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Button from 'flarum/common/components/Button';\nexport default class DialogListItem extends Component {\n view(vnode) {\n var _lastMessage$contentP;\n const dialog = this.attrs.dialog;\n const recipient = dialog.recipient();\n const lastMessage = dialog.lastMessage();\n return m(\"li\", {\n className: classList('DialogListItem', {\n 'DialogListItem--unread': dialog.unreadCount(),\n active: this.attrs.active\n })\n }, m(Link, {\n href: app.route.dialog(dialog),\n className: classList('DialogListItem-button', {\n active: this.attrs.active\n })\n }, m(\"div\", {\n className: \"DialogListItem-avatar\"\n }, m(Avatar, {\n user: recipient\n }), !!dialog.unreadCount() && m(\"div\", {\n className: \"Bubble Bubble--primary\"\n }, dialog.unreadCount())), m(\"div\", {\n className: \"DialogListItem-content\"\n }, m(\"div\", {\n className: \"DialogListItem-title\"\n }, username(recipient), humanTime(dialog.lastMessageAt()), this.attrs.actions && m(\"div\", {\n className: \"DialogListItem-actions\"\n }, this.actionItems().toArray())), m(\"div\", {\n className: \"DialogListItem-lastMessage\"\n }, lastMessage ? (_lastMessage$contentP = lastMessage.contentPlain()) == null ? void 0 : _lastMessage$contentP.slice(0, 80) : ''))));\n }\n actionItems() {\n const items = new ItemList();\n items.add('markAsRead', m(Button, {\n className: \"Notification-action Button Button--link\",\n icon: \"fas fa-check\",\n \"aria-label\": app.translator.trans('flarum-messages.forum.dialog_list.mark_as_read_tooltip'),\n onclick: e => {\n var _this$attrs$dialog$da;\n e.preventDefault();\n e.stopPropagation();\n this.attrs.dialog.save({\n lastReadMessageId: ((_this$attrs$dialog$da = this.attrs.dialog.data.relationships) == null ? void 0 : _this$attrs$dialog$da.lastMessage.data).id\n }).finally(() => {\n if (this.attrs.dialog.unreadCount() === 0) {\n var _attribute;\n app.session.user.pushAttributes({\n messageCount: ((_attribute = app.session.user.attribute('messageCount')) != null ? _attribute : 1) - 1\n });\n }\n m.redraw();\n });\n }\n }), 100);\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DialogListItem', DialogListItem);","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport DialogListItem from './DialogListItem';\nexport default class DialogList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n }\n oncreate(vnode) {\n super.oncreate(vnode);\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n }\n view() {\n return m(\"div\", {\n className: \"DialogList\"\n }, m(\"ul\", {\n className: \"DialogList-list\"\n }, this.attrs.state.getAllItems().map(dialog => {\n var _this$attrs$activeDia;\n return m(DialogListItem, {\n dialog: dialog,\n active: ((_this$attrs$activeDia = this.attrs.activeDialog) == null ? void 0 : _this$attrs$activeDia.id()) === dialog.id(),\n actions: this.attrs.itemActions\n });\n })), this.attrs.state.hasNext() && !this.attrs.hideMore && m(\"div\", {\n className: \"DialogList-loadMore\"\n }, m(Button, {\n className: \"Button\",\n onclick: this.attrs.state.loadNext.bind(this.attrs.state)\n }, app.translator.trans('flarum-messages.forum.dialog_list.load_more_button'))));\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DialogList', DialogList);","import app from 'flarum/forum/app';\nimport IndexSidebar from 'flarum/forum/components/IndexSidebar';\nimport Button from 'flarum/common/components/Button';\nexport default class MessagesSidebar extends IndexSidebar {\n static initAttrs(attrs) {\n attrs.className = 'MessagesPage-nav';\n }\n items() {\n const items = super.items();\n const canSendAnyMessage = app.session.user.attribute('canSendAnyMessage');\n items.remove('newDiscussion');\n items.add('newMessage', m(Button, {\n icon: \"fas fa-edit\",\n className: \"Button Button--primary IndexPage-newDiscussion MessagesPage-newMessage\",\n itemClassName: \"App-primaryControl\",\n onclick: () => {\n return this.newMessageAction();\n },\n disabled: !canSendAnyMessage\n }, app.translator.trans('flarum-messages.forum.messages_page.new_message_button')), 10);\n return items;\n }\n\n /**\n * Open the composer for a new message.\n */\n newMessageAction() {\n return flarum.reg.asyncModuleImport('flarum/forum/components/ComposerBody').then(() => {\n app.composer.load(() => import(/* webpackChunkName: 'forum/components/MessageComposer', webpackMode: 'lazy-once' */ './MessageComposer'), {\n user: app.session.user,\n onsubmit: () => {\n app.dialogs.refresh();\n }\n }).then(() => app.composer.show());\n return app.composer;\n });\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/MessagesSidebar', MessagesSidebar);","import ItemList from 'flarum/common/utils/ItemList';\nimport AbstractPost from 'flarum/forum/components/AbstractPost';\nimport Avatar from 'flarum/common/components/Avatar';\nimport Comment from 'flarum/forum/components/Comment';\nimport PostUser from 'flarum/forum/components/PostUser';\nimport PostMeta from 'flarum/forum/components/PostMeta';\nimport classList from 'flarum/common/utils/classList';\n/**\n * The `Post` component displays a single post. The basic post template just\n * includes a controls dropdown; subclasses must implement `content` and `attrs`\n * methods.\n */\nexport default class Message extends AbstractPost {\n oninit(vnode) {\n super.oninit(vnode);\n }\n user() {\n return this.attrs.message.user();\n }\n controls() {\n return [];\n }\n freshness() {\n return this.attrs.message.freshness;\n }\n createdByStarter() {\n return false;\n }\n onbeforeupdate(vnode) {\n return super.onbeforeupdate(vnode);\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n }\n elementAttrs() {\n const message = this.attrs.message;\n const attrs = super.elementAttrs();\n attrs.className = classList(attrs.className || null, 'Message', {\n 'Post--renderFailed': message.renderFailed(),\n revealContent: false,\n editing: false\n });\n return attrs;\n }\n header() {\n return super.header();\n }\n content() {\n return super.content().concat([m(Comment, {\n headerItems: this.headerItems(),\n cardVisible: false,\n isEditing: false,\n isHidden: false,\n contentHtml: this.attrs.message.contentHtml(),\n user: this.attrs.message.user()\n })]);\n }\n classes(existing) {\n return super.classes(existing);\n }\n actionItems() {\n return super.actionItems();\n }\n footerItems() {\n return super.footerItems();\n }\n sideItems() {\n return super.sideItems();\n }\n avatar() {\n return this.attrs.message.user() ? m(Avatar, {\n user: this.attrs.message.user()\n }) : '';\n }\n headerItems() {\n const items = new ItemList();\n const message = this.attrs.message;\n items.add('user', m(PostUser, {\n post: message\n }), 100);\n items.add('meta', m(PostMeta, {\n post: message\n }));\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/Message', Message);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Stream from 'flarum/common/utils/Stream';\nimport Button from 'flarum/common/components/Button';\nimport ScrollListener from 'flarum/common/utils/ScrollListener';\nimport Message from './Message';\nexport default class MessageStream extends Component {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"replyPlaceholderComponent\", Stream(null));\n _defineProperty(this, \"loadingPostComponent\", Stream(null));\n _defineProperty(this, \"scrollListener\", void 0);\n _defineProperty(this, \"initialToBottomScroll\", false);\n _defineProperty(this, \"lastTime\", null);\n _defineProperty(this, \"checkedRead\", false);\n _defineProperty(this, \"markingAsRead\", false);\n }\n oninit(vnode) {\n super.oninit(vnode);\n\n // We need the lazy ReplyPlaceholder and LoadingPost components to be loaded.\n Promise.all([flarum.reg.asyncModuleImport('flarum/forum/components/ReplyPlaceholder'), flarum.reg.asyncModuleImport('flarum/forum/components/LoadingPost')]).then(_ref => {\n let [ReplyPlaceholder, LoadingPost] = _ref;\n this.replyPlaceholderComponent(ReplyPlaceholder.default);\n this.loadingPostComponent(LoadingPost.default);\n });\n }\n oncreate(vnode) {\n super.oncreate(vnode);\n this.scrollListener = new ScrollListener(this.onscroll.bind(this), this.element);\n setTimeout(() => {\n this.scrollListener.start();\n this.element.addEventListener('scrollend', this.markAsRead.bind(this));\n });\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n\n // @todo: for future versions, consider using the post stream scrubber to scroll through the messages. (big task..)\n // @todo: introduce read status, to jump to the first unread message instead.\n if (!this.initialToBottomScroll && !this.attrs.state.isLoading()) {\n this.scrollToBottom();\n this.initialToBottomScroll = true;\n }\n if (this.initialToBottomScroll && !this.checkedRead) {\n this.markAsRead();\n this.checkedRead = true;\n }\n }\n onremove(vnode) {\n super.onremove(vnode);\n this.scrollListener.stop();\n }\n view() {\n return m(\"div\", {\n className: \"MessageStream\"\n }, this.attrs.state.isLoading() ? m(LoadingIndicator, null) : this.content());\n }\n content() {\n var _this$attrs$dialog$da;\n const items = [];\n const messages = this.attrs.state.getAllItems().sort((a, b) => a.createdAt().getTime() - b.createdAt().getTime());\n const ReplyPlaceholder = this.replyPlaceholderComponent();\n const LoadingPost = this.loadingPostComponent();\n if (messages[0].id() !== ((_this$attrs$dialog$da = this.attrs.dialog.data.relationships) == null ? void 0 : _this$attrs$dialog$da.firstMessage.data).id) {\n items.push(m(\"div\", {\n className: \"MessageStream-item\",\n key: \"loadPrevious\"\n }, m(Button, {\n onclick: () => this.whileMaintainingScroll(() => this.attrs.state.loadNext()),\n type: \"button\",\n className: \"Button Button--block MessageStream-loadPrev\"\n }, app.translator.trans('flarum-messages.forum.messages_page.stream.load_previous_button'))));\n if (LoadingPost) {\n items.push(m(\"div\", {\n className: \"MessageStream-item\",\n key: \"loading-prev\"\n }, m(LoadingPost, null)));\n }\n }\n messages.forEach((message, index) => items.push(this.messageItem(message, index)));\n if (ReplyPlaceholder) {\n items.push(m(\"div\", {\n className: \"MessageStream-item\",\n key: \"reply\" /*data-index={this.attrs.state.count()}*/\n }, m(ReplyPlaceholder, {\n discussion: this.attrs.dialog,\n onclick: () => {\n flarum.reg.asyncModuleImport('flarum/forum/components/ComposerBody').then(() => {\n app.composer.load(() => import(/* webpackChunkName: 'forum/components/MessageComposer', webpackMode: 'lazy-once' */ './MessageComposer'), {\n user: app.session.user,\n replyingTo: this.attrs.dialog,\n onsubmit: () => {\n this.attrs.state.refresh().then(() => setTimeout(() => this.scrollToBottom(), 50));\n }\n }).then(() => app.composer.show());\n });\n },\n composingReply: () => app.composer.composingMessageTo(this.attrs.dialog)\n })));\n }\n return items;\n }\n messageItem(message, index) {\n return m(\"div\", {\n className: \"MessageStream-item\",\n key: index,\n \"data-id\": message.id()\n }, this.timeGap(message), m(Message, {\n message: message\n }));\n }\n timeGap(message) {\n var _this$attrs$dialog$da2;\n if (message.id() === ((_this$attrs$dialog$da2 = this.attrs.dialog.data.relationships) == null ? void 0 : _this$attrs$dialog$da2.firstMessage.data).id) {\n this.lastTime = message.createdAt();\n return m(\"div\", {\n class: \"PostStream-timeGap\"\n }, m(\"span\", null, app.translator.trans('flarum-messages.forum.messages_page.stream.start_of_the_conversation')));\n }\n const lastTime = this.lastTime;\n const dt = message.createdAt().getTime() - ((lastTime == null ? void 0 : lastTime.getTime()) || 0);\n this.lastTime = message.createdAt();\n if (lastTime && dt > 1000 * 60 * 60 * 24 * 4) {\n return m(\"div\", {\n className: \"PostStream-timeGap\"\n }, m(\"span\", null, app.translator.trans('flarum-messages.forum.messages_page.stream.time_lapsed_text', {\n period: dayjs().add(dt, 'ms').fromNow(true)\n })));\n }\n return null;\n }\n onscroll() {\n this.whileMaintainingScroll(() => {\n if (this.element.scrollTop <= 80 && this.attrs.state.hasNext()) {\n return this.attrs.state.loadNext();\n }\n if (this.element.scrollTop + this.element.clientHeight === this.element.scrollHeight && this.attrs.state.hasPrev()) {\n return this.attrs.state.loadPrev();\n }\n return null;\n });\n }\n scrollToBottom() {\n this.element.scrollTop = this.element.scrollHeight;\n }\n whileMaintainingScroll(callback) {\n const scrollTop = this.element.scrollTop;\n const scrollHeight = this.element.scrollHeight;\n const result = callback();\n if (result instanceof Promise) {\n result.then(() => {\n requestAnimationFrame(() => {\n this.element.scrollTop = this.element.scrollHeight - scrollHeight + scrollTop;\n });\n });\n }\n }\n markAsRead() {\n const lastVisibleId = Number(this.$('.MessageStream-item[data-id]').filter((_, $el) => {\n if (this.element.scrollHeight <= this.element.clientHeight) {\n return true;\n }\n return this.$().offset().top + this.element.clientHeight > $($el).offset().top;\n }).last().data('id'));\n if (lastVisibleId && app.session.user && lastVisibleId > (this.attrs.dialog.lastReadMessageId() || 0) && !this.markingAsRead) {\n this.markingAsRead = true;\n this.attrs.dialog.save({\n lastReadMessageId: lastVisibleId\n }).finally(() => {\n this.markingAsRead = false;\n if (this.attrs.dialog.unreadCount() === 0) {\n var _attribute;\n app.session.user.pushAttributes({\n messageCount: ((_attribute = app.session.user.attribute('messageCount')) != null ? _attribute : 1) - 1\n });\n }\n m.redraw();\n });\n }\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/MessageStream', MessageStream);","import PaginatedListState from 'flarum/common/states/PaginatedListState';\nexport default class MessageStreamState extends PaginatedListState {\n constructor(params, page) {\n if (page === void 0) {\n page = 1;\n }\n super(params, page, null);\n }\n get type() {\n return 'dialog-messages';\n }\n getAllItems() {\n return super.getAllItems();\n }\n}\nflarum.reg.add('flarum-messages', 'forum/states/MessageStreamState', MessageStreamState);","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Avatar from 'flarum/common/components/Avatar';\nimport fullTime from 'flarum/common/helpers/fullTime';\nimport username from 'flarum/common/helpers/username';\nimport Link from 'flarum/common/components/Link';\nimport listItems from 'flarum/common/helpers/listItems';\nexport default class DetailsModal extends Modal {\n className() {\n return 'Modal--small Modal--flat DetailsModal';\n }\n title() {\n return app.translator.trans('flarum-messages.forum.dialog_section.details_modal.title');\n }\n content() {\n let recipients = (this.attrs.dialog.users() || []).filter(Boolean);\n return m(\"div\", {\n className: \"Modal-body DetailsModal-infoGroups\"\n }, m(\"div\", {\n className: \"DetailsModal-recipients DetailsModal-info\"\n }, m(\"div\", {\n className: \"DetailsModal-info-title\"\n }, app.translator.trans('flarum-messages.forum.dialog_section.details_modal.recipients')), m(\"div\", {\n className: \"DetailsModal-recipients-list\"\n }, recipients == null ? void 0 : recipients.map(recipient => {\n return m(\"div\", {\n className: \"DetailsModal-recipient\"\n }, m(Avatar, {\n user: recipient\n }), m(Link, {\n href: app.route('user', {\n username: recipient.slug()\n })\n }, m(\"span\", {\n className: \"DetailsModal-recipient-username\"\n }, username(recipient))), m(\"div\", {\n className: \"badges\"\n }, listItems(recipient.badges().toArray())));\n }))), this.infoItems().toArray());\n }\n infoItems() {\n const items = new ItemList();\n items.add('created', m(\"div\", {\n className: \"DetailsModal-createdAt DetailsModal-info\"\n }, m(\"div\", {\n className: \"DetailsModal-info-title\"\n }, app.translator.trans('flarum-messages.forum.dialog_section.details_modal.created_at')), m(\"div\", {\n className: \"DetailsModal-info-content\"\n }, fullTime(this.attrs.dialog.createdAt()))));\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DetailsModal', DetailsModal);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport Component from 'flarum/common/Component';\nimport MessageStream from './MessageStream';\nimport username from 'flarum/common/helpers/username';\nimport MessageStreamState from '../states/MessageStreamState';\nimport Avatar from 'flarum/common/components/Avatar';\nimport Link from 'flarum/common/components/Link';\nimport app from 'flarum/forum/app';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Button from 'flarum/common/components/Button';\nimport Dropdown from 'flarum/common/components/Dropdown';\nimport DetailsModal from './DetailsModal';\nimport listItems from 'flarum/common/helpers/listItems';\nexport default class DialogSection extends Component {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"loading\", false);\n _defineProperty(this, \"messages\", void 0);\n }\n oninit(vnode) {\n super.oninit(vnode);\n this.messages = new MessageStreamState({\n filter: {\n dialog: this.attrs.dialog.id()\n },\n sort: '-createdAt'\n });\n this.messages.refresh();\n }\n view() {\n const recipient = this.attrs.dialog.recipient();\n return m(\"div\", {\n className: \"DialogSection\"\n }, m(\"div\", {\n className: \"DialogSection-header\"\n }, m(Avatar, {\n user: recipient\n }), m(\"div\", {\n className: \"DialogSection-header-info\"\n }, recipient && m(Link, {\n href: app.route.user(recipient)\n }, m(\"h2\", null, username(recipient))) || m(\"h2\", null, username(recipient)), m(\"div\", {\n className: \"badges\"\n }, listItems((recipient == null ? void 0 : recipient.badges().toArray()) || []))), m(\"div\", {\n className: \"DialogSection-header-actions\"\n }, this.actionItems().toArray())), m(MessageStream, {\n dialog: this.attrs.dialog,\n state: this.messages\n }));\n }\n actionItems() {\n const items = new ItemList();\n items.add('details', m(Dropdown, {\n icon: \"fas fa-ellipsis-h\",\n className: \"DialogSection-controls\",\n buttonClassName: \"Button Button--icon\",\n accessibleToggleLabel: app.translator.trans('flarum-messages.forum.dialog_section.controls_toggle_label'),\n label: app.translator.trans('flarum-messages.forum.dialog_section.controls_toggle_label')\n }, this.controlItems().toArray()));\n return items;\n }\n controlItems() {\n const items = new ItemList();\n items.add('details', m(Button, {\n icon: \"fas fa-info-circle\",\n onclick: () => app.modal.show(DetailsModal, {\n dialog: this.attrs.dialog\n })\n }, app.translator.trans('flarum-messages.forum.dialog_section.controls.details_button')));\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/DialogSection', DialogSection);","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport app from 'flarum/forum/app';\nimport Page from 'flarum/common/components/Page';\nimport PageStructure from 'flarum/forum/components/PageStructure';\nimport Icon from 'flarum/common/components/Icon';\nimport DialogList from './DialogList';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Stream from 'flarum/common/utils/Stream';\nimport InfoTile from 'flarum/common/components/InfoTile';\nimport MessagesSidebar from './MessagesSidebar';\nimport DialogSection from './DialogSection';\nimport listItems from 'flarum/common/helpers/listItems';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Dropdown from 'flarum/common/components/Dropdown';\nimport Button from 'flarum/common/components/Button';\nexport default class MessagesPage extends Page {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"selectedDialog\", Stream(null));\n }\n oninit(vnode) {\n super.oninit(vnode);\n if (!app.session.user) {\n m.route.set(app.route('index'));\n return;\n }\n app.current.set('noTagsList', true);\n if (!app.dialogs.hasItems()) {\n app.dialogs.refresh().then(async () => {\n if (app.dialogs.hasItems()) {\n await this.initDialog();\n }\n });\n } else {\n this.initDialog();\n }\n }\n dialogRequestParams() {\n return {\n include: 'users.groups'\n };\n }\n async initDialog() {\n const dialogId = m.route.param('id');\n const title = app.translator.trans('flarum-messages.forum.messages_page.title', {}, true);\n let dialog;\n if (dialogId) {\n dialog = app.store.getById('dialogs', dialogId) || (await app.store.find('dialogs', dialogId, this.dialogRequestParams()));\n } else {\n dialog = app.dialogs.getAllItems()[0];\n }\n this.selectedDialog(dialog);\n if (dialog) {\n app.setTitle(dialog.title());\n app.history.push('dialog', dialog.title());\n } else {\n app.setTitle(title);\n app.history.push('messages', title);\n }\n m.redraw();\n }\n onupdate(vnode) {\n super.onupdate(vnode);\n\n // Scroll the dialog list to the active dialog item if present and not visible.\n const dialogElement = this.element.querySelector('.DialogListItem.active');\n const container = this.element.querySelector('.DialogList');\n if (dialogElement && $(container).offset().top + container.clientHeight <= $(dialogElement).offset().top) {\n dialogElement.scrollIntoView();\n }\n }\n view() {\n return m(PageStructure, {\n className: \"MessagesPage Page--vertical\",\n loading: false,\n hero: this.hero.bind(this),\n sidebar: () => m(MessagesSidebar, null)\n }, app.dialogs.isLoading() ? m(LoadingIndicator, null) : !app.dialogs.hasItems() ? m(InfoTile, {\n icon: \"far fa-envelope-open\"\n }, app.translator.trans('flarum-messages.forum.messages_page.empty_text')) : m(\"div\", {\n className: \"MessagesPage-content\"\n }, m(\"div\", {\n className: \"MessagesPage-sidebar\",\n key: \"sidebar\"\n }, m(\"div\", {\n className: \"IndexPage-toolbar\",\n key: \"toolbar\"\n }, m(\"ul\", {\n className: \"IndexPage-toolbar-view\"\n }, listItems(this.viewItems().toArray())), m(\"ul\", {\n className: \"IndexPage-toolbar-action\"\n }, listItems(this.actionItems().toArray()))), m(DialogList, {\n key: \"list\",\n state: app.dialogs,\n activeDialog: this.selectedDialog()\n })), this.selectedDialog() ? m(DialogSection, {\n key: \"dialog\",\n dialog: this.selectedDialog()\n }) : m(LoadingIndicator, {\n key: \"loading\",\n display: \"block\"\n })));\n }\n hero() {\n return m(\"header\", {\n className: \"Hero MessagesPageHero\"\n }, m(\"div\", {\n className: \"container\"\n }, m(\"div\", {\n className: \"containerNarrow\"\n }, m(\"h1\", {\n className: \"Hero-title\"\n }, m(Icon, {\n name: \"fas fa-envelope\"\n }), \" \", app.translator.trans('flarum-messages.forum.messages_page.hero.title')), m(\"div\", {\n className: \"Hero-subtitle\"\n }, app.translator.trans('flarum-messages.forum.messages_page.hero.subtitle')))));\n }\n\n /**\n * Build an item list for the part of the toolbar which is concerned with how\n * the results are displayed. By default this is just a select box to change\n * the way discussions are sorted.\n */\n viewItems() {\n var _app$dialogs$getParam;\n const items = new ItemList();\n const sortMap = app.dialogs.sortMap();\n const sortOptions = Object.keys(sortMap).reduce((acc, sortId) => {\n const sort = sortMap[sortId];\n acc[sortId] = typeof sort !== 'string' ? sort.label : app.translator.trans(\"flarum-messages.forum.index_sort.\".concat(sortId, \"_button\"));\n return acc;\n }, {});\n items.add('sort', m(Dropdown, {\n buttonClassName: \"Button\",\n label: sortOptions[((_app$dialogs$getParam = app.dialogs.getParams()) == null ? void 0 : _app$dialogs$getParam.sort) || 0] || Object.values(sortOptions)[0],\n accessibleToggleLabel: app.translator.trans('core.forum.index_sort.toggle_dropdown_accessible_label')\n }, Object.keys(sortOptions).map(value => {\n const label = sortOptions[value];\n const active = (app.dialogs.getParams().sort || Object.keys(sortMap)[0]) === value;\n return m(Button, {\n icon: active ? 'fas fa-check' : true,\n onclick: () => app.dialogs.changeSort(value),\n active: active\n }, label);\n })));\n return items;\n }\n\n /**\n * Build an item list for the part of the toolbar which is about taking action\n * on the results. By default this is just a \"mark all as read\" button.\n */\n actionItems() {\n const items = new ItemList();\n items.add('refresh', m(Button, {\n title: app.translator.trans('flarum-messages.forum.messages_page.refresh_tooltip'),\n \"aria-label\": app.translator.trans('flarum-messages.forum.messages_page.refresh_tooltip'),\n icon: \"fas fa-sync\",\n className: \"Button Button--icon\",\n onclick: () => {\n app.dialogs.refresh();\n }\n }));\n if (app.session.user) {\n items.add('markAllAsRead', m(Button, {\n title: app.translator.trans('flarum-messages.forum.messages_page.mark_all_as_read_tooltip'),\n \"aria-label\": app.translator.trans('flarum-messages.forum.messages_page.mark_all_as_read_tooltip'),\n icon: \"fas fa-check\",\n className: \"Button Button--icon\",\n onclick: () => app.dialogs.markAllAsRead()\n }));\n }\n return items;\n }\n}\nflarum.reg.add('flarum-messages', 'forum/components/MessagesPage', MessagesPage);"],"names":["DialogListItem","view","vnode","_lastMessage$contentP","dialog","this","attrs","recipient","lastMessage","m","className","unreadCount","active","href","user","lastMessageAt","actions","actionItems","toArray","contentPlain","slice","items","add","icon","trans","onclick","e","_this$attrs$dialog$da","preventDefault","stopPropagation","save","lastReadMessageId","data","relationships","id","finally","_attribute","pushAttributes","messageCount","attribute","redraw","flarum","reg","DialogList","oninit","super","oncreate","onupdate","state","getAllItems","map","_this$attrs$activeDia","activeDialog","itemActions","hasNext","hideMore","loadNext","bind","MessagesSidebar","initAttrs","canSendAnyMessage","remove","itemClassName","newMessageAction","disabled","asyncModuleImport","then","load","onsubmit","refresh","show","Message","message","controls","freshness","createdByStarter","onbeforeupdate","elementAttrs","renderFailed","revealContent","editing","header","content","concat","headerItems","cardVisible","isEditing","isHidden","contentHtml","classes","existing","footerItems","sideItems","avatar","post","MessageStream","constructor","arguments","Promise","all","_ref","ReplyPlaceholder","LoadingPost","replyPlaceholderComponent","default","loadingPostComponent","scrollListener","onscroll","element","setTimeout","start","addEventListener","markAsRead","initialToBottomScroll","isLoading","scrollToBottom","checkedRead","onremove","stop","messages","sort","a","b","createdAt","getTime","firstMessage","push","key","whileMaintainingScroll","type","forEach","index","messageItem","discussion","replyingTo","composingReply","composingMessageTo","timeGap","_this$attrs$dialog$da2","lastTime","class","dt","period","dayjs","fromNow","scrollTop","clientHeight","scrollHeight","hasPrev","loadPrev","callback","result","requestAnimationFrame","lastVisibleId","Number","$","filter","_","$el","offset","top","last","markingAsRead","MessageStreamState","params","page","DetailsModal","title","recipients","users","Boolean","username","slug","badges","infoItems","DialogSection","buttonClassName","accessibleToggleLabel","label","controlItems","MessagesPage","set","hasItems","initDialog","async","route","dialogRequestParams","include","dialogId","param","getById","find","selectedDialog","dialogElement","querySelector","container","scrollIntoView","loading","hero","sidebar","viewItems","display","name","_app$dialogs$getParam","sortMap","sortOptions","Object","keys","reduce","acc","sortId","getParams","values","value","changeSort","markAllAsRead"],"sourceRoot":""} \ No newline at end of file