1
0
mirror of https://github.com/flarum/core.git synced 2025-08-14 12:24:33 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
KyrneDev
8a529d3753 Updates 2021-04-28 15:57:42 -07:00
KyrneDev
f900e1165f Format 2021-04-23 13:54:42 -07:00
KyrneDev
3b2d3dc8bc Registry and webpack 2021-04-23 13:52:42 -07:00
KyrneDev
a18e64c47f Merge branch 'ck/code-splitting' of https://github.com/flarum/core into ck/code-splitting 2021-04-20 17:02:50 -07:00
KyrneDev
5e7a260853 Revert dayjs change 2021-04-20 17:02:30 -07:00
luceos
3a1803ee0f Apply fixes from StyleCI
[ci skip] [skip ci]
2021-04-20 23:51:17 +00:00
KyrneDev
008206738f Code Split 2021-04-20 16:50:40 -07:00
124 changed files with 3196 additions and 6768 deletions

40
js/CustomLoader.js Normal file
View File

@@ -0,0 +1,40 @@
// Hi early reviewer! I'm a temporary file and
// will be moved to the Flarum webpack config soon!
const loaderUtils = require('loader-utils');
// Custom loader logic
module.exports = function (source) {
// Get the type of the module to be exported
const location = loaderUtils.interpolateName(this, '[folder]/', {
context: this.rootContext || this.context,
});
// Get the name of module to be exported
const moduleName = loaderUtils.interpolateName(this, '[name]', {
context: this.rootContext || this.context,
});
// Don't export low level files
if (/.*\/(admin|forum)$/.test(location) || /(index|app|compat|FlarumRegistry)$/.test(moduleName)) {
return source;
}
let addition = "";
// Find the export names
const matches = [...source.matchAll(/export\s+?(?:default\s?|function|abstract\s?|class)+?\s([^(\s<;]*)/gm)];
matches.map(match => {
let name = match[1]
if (!name || name === 'interface') {
return;
}
// Add code at the end of the file to add the file to registry
addition += `\nwindow.flreg.add('${location}${name}', ${name})`
});
return source + addition;
}

View File

@@ -8,4 +8,4 @@
*/
export * from './src/common';
export * from './src/admin';
export * from './src/admin';

26
js/dist/admin.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
js/dist/admin/flarum-core.js vendored Normal file

File diff suppressed because one or more lines are too long

1
js/dist/admin/flarum-core.js.map vendored Normal file

File diff suppressed because one or more lines are too long

2
js/dist/admin/runtime.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(()=>{var e,r={},o={};function t(e){var n=o[e];if(void 0!==n)return n.exports;var l=o[e]={exports:{}};return r[e].call(l.exports,l,l.exports,t),l.exports}t.m=r,e=[],t.O=(r,o,n,l)=>{if(!o){var a=1/0;for(f=0;f<e.length;f++){for(var[o,n,l]=e[f],i=!0,u=0;u<o.length;u++)(!1&l||a>=l)&&Object.keys(t.O).every((e=>t.O[e](o[u])))?o.splice(u--,1):(i=!1,l<a&&(a=l));i&&(e.splice(f--,1),r=n())}return r}l=l||0;for(var f=e.length;f>0&&e[f-1][2]>l;f--)e[f]=e[f-1];e[f]=[o,n,l]},t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={93:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,l,[a,i,u]=o,f=0;for(n in i)t.o(i,n)&&(t.m[n]=i[n]);for(u&&u(t),r&&r(o);f<a.length;f++)l=a[f],t.o(e,l)&&e[l]&&e[l][0](),e[a[f]]=0;t.O()},o=self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})(),t.O()})();
//# sourceMappingURL=runtime.js.map

1
js/dist/admin/runtime.js.map vendored Normal file

File diff suppressed because one or more lines are too long

2
js/dist/common/common.js vendored Normal file

File diff suppressed because one or more lines are too long

1
js/dist/common/common.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

53
js/dist/forum.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[372],{4146:(a,s,t)=>{t.r(s),t.d(s,{default:()=>n});var e=t(1788),o=t(5556),r=t(2587),i=t(1024),n=function(a){function s(){return a.apply(this,arguments)||this}(0,e.Z)(s,a);var t=s.prototype;return t.oninit=function(s){a.prototype.oninit.call(this,s),this.success=!1,this.email=(0,i.Z)(app.session.user.email()),this.password=(0,i.Z)("")},t.className=function(){return"ChangeEmailModal Modal--small"},t.title=function(){return app.translator.trans("core.forum.change_email.title")},t.content=function(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.change_email.confirmation_message",{email:m("strong",null,this.email())})),m("div",{className:"Form-group"},m(r.Z,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},app.translator.trans("core.forum.change_email.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m("input",{type:"email",name:"email",className:"FormControl",placeholder:app.session.user.email(),bidi:this.email,disabled:this.loading})),m("div",{className:"Form-group"},m("input",{type:"password",name:"password",className:"FormControl",placeholder:app.translator.trans("core.forum.change_email.confirm_password_placeholder"),bidi:this.password,disabled:this.loading})),m("div",{className:"Form-group"},r.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.change_email.submit_button")))))},t.onsubmit=function(a){var s=this;a.preventDefault(),this.email()!==app.session.user.email()?(this.loading=!0,this.alertAttrs=null,app.session.user.save({email:this.email()},{errorHandler:this.onerror.bind(this),meta:{password:this.password()}}).then((function(){s.success=!0})).catch((function(){})).then(this.loaded.bind(this))):this.hide()},t.onerror=function(s){401===s.status&&(s.alert.content=app.translator.trans("core.forum.change_email.incorrect_password_message")),a.prototype.onerror.call(this,s)},s}(o.Z);window.flreg.add("components/ChangeEmailModal",n)}}]);
//# sourceMappingURL=ChangeEmailModal.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[503],{22:(t,a,e)=>{e.r(a),e.d(a,{default:()=>s});var o=e(1788),r=e(5556),n=e(2587),s=function(t){function a(){return t.apply(this,arguments)||this}(0,o.Z)(a,t);var e=a.prototype;return e.className=function(){return"ChangePasswordModal Modal--small"},e.title=function(){return app.translator.trans("core.forum.change_password.title")},e.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.change_password.text")),m("div",{className:"Form-group"},n.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.change_password.send_button")))))},e.onsubmit=function(t){t.preventDefault(),this.loading=!0,app.request({method:"POST",url:app.forum.attribute("apiUrl")+"/forgot",body:{email:app.session.user.email()}}).then(this.hide.bind(this),this.loaded.bind(this))},a}(r.Z);window.flreg.add("components/ChangePasswordModal",s)}}]);
//# sourceMappingURL=ChangePasswordModal.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/ChangePasswordModal.js"],"names":["ChangePasswordModal","className","title","app","translator","trans","content","Button","type","loading","this","onsubmit","e","preventDefault","request","method","url","forum","attribute","body","email","session","user","then","hide","bind","loaded","Modal","window","flreg","add"],"mappings":"4JAOqBA,E,sGACnBC,UAAA,WACE,MAAO,oC,EAGTC,MAAA,WACE,OAAOC,IAAIC,WAAWC,MAAM,qC,EAG9BC,QAAA,WACE,OACE,SAAKL,UAAU,cACb,SAAKA,UAAU,uBACb,OAAGA,UAAU,YAAYE,IAAIC,WAAWC,MAAM,oCAC9C,SAAKJ,UAAU,cACZM,cACC,CACEN,UAAW,uCACXO,KAAM,SACNC,QAASC,KAAKD,SAEhBN,IAAIC,WAAWC,MAAM,+C,EAQjCM,SAAA,SAASC,GACPA,EAAEC,iBAEFH,KAAKD,SAAU,EAEfN,IACGW,QAAQ,CACPC,OAAQ,OACRC,IAAKb,IAAIc,MAAMC,UAAU,UAAY,UACrCC,KAAM,CAAEC,MAAOjB,IAAIkB,QAAQC,KAAKF,WAEjCG,KAAKb,KAAKc,KAAKC,KAAKf,MAAOA,KAAKgB,OAAOD,KAAKf,Q,GAxCFiB,KA4CjDC,OAAOC,MAAMC,IAAI,iCAAkC9B","file":"forum/components/ChangePasswordModal.js","sourcesContent":["import Modal from '../../common/components/Modal';\nimport Button from '../../common/components/Button';\n\n/**\n * The `ChangePasswordModal` component shows a modal dialog which allows the\n * user to send themself a password reset email.\n */\nexport default class ChangePasswordModal extends Modal {\n className() {\n return 'ChangePasswordModal Modal--small';\n }\n\n title() {\n return app.translator.trans('core.forum.change_password.title');\n }\n\n content() {\n return (\n <div className=\"Modal-body\">\n <div className=\"Form Form--centered\">\n <p className=\"helpText\">{app.translator.trans('core.forum.change_password.text')}</p>\n <div className=\"Form-group\">\n {Button.component(\n {\n className: 'Button Button--primary Button--block',\n type: 'submit',\n loading: this.loading,\n },\n app.translator.trans('core.forum.change_password.send_button')\n )}\n </div>\n </div>\n </div>\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n app\n .request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/forgot',\n body: { email: app.session.user.email() },\n })\n .then(this.hide.bind(this), this.loaded.bind(this));\n }\n}\n\nwindow.flreg.add('components/ChangePasswordModal', ChangePasswordModal)"],"sourceRoot":""}

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[437],{3406:(t,s,o)=>{o.r(s),o.d(s,{default:()=>a});var e=o(1788),i=o(4810),r=o(5731),n=o(1024),a=function(t){function s(){return t.apply(this,arguments)||this}(0,e.Z)(s,t),s.initAttrs=function(s){t.initAttrs.call(this,s),s.placeholder=s.placeholder||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.body_placeholder")),s.submitLabel=s.submitLabel||app.translator.trans("core.forum.composer_discussion.submit_button"),s.confirmExit=s.confirmExit||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.discard_confirmation")),s.titlePlaceholder=s.titlePlaceholder||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.title_placeholder")),s.className="ComposerBody--discussion"};var o=s.prototype;return o.oninit=function(s){t.prototype.oninit.call(this,s),this.composer.fields.title=this.composer.fields.title||(0,n.Z)(""),this.title=this.composer.fields.title},o.headerItems=function(){var s=t.prototype.headerItems.call(this);return s.add("title",m("h3",null,app.translator.trans("core.forum.composer_discussion.title")),100),s.add("discussionTitle",m("h3",null,m("input",{className:"FormControl",bidi:this.title,placeholder:this.attrs.titlePlaceholder,disabled:!!this.attrs.disabled,onkeydown:this.onkeydown.bind(this)}))),s},o.onkeydown=function(t){13===t.which&&(t.preventDefault(),this.composer.editor.moveCursorTo(0)),t.redraw=!1},o.hasChanges=function(){return this.title()||this.composer.fields.content()},o.data=function(){return{title:this.title(),content:this.composer.fields.content()}},o.onsubmit=function(){var t=this;this.loading=!0;var s=this.data();app.store.createRecord("discussions").save(s).then((function(s){t.composer.hide(),app.discussions.refresh({deferClear:!0}),m.route.set(app.route.discussion(s))}),this.loaded.bind(this))},s}(i.Z);window.flreg.add("components/DiscussionComposer",a)}}]);
//# sourceMappingURL=DiscussionComposer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[799],{5813:(t,e,s)=>{s.a(t,(async t=>{s.r(e),s.d(e,{default:()=>r});var n=s(1788),a=s(486),o=s(2060),r=function(t){function e(){return t.apply(this,arguments)||this}(0,n.Z)(e,t);var s=e.prototype;return s.oninit=function(e){t.prototype.oninit.call(this,e),this.loadUser(m.route.param("username"))},s.show=function(e){t.prototype.show.call(this,e),this.state=new o.Z({q:"author:"+e.username(),sort:"newest"}),this.state.refresh()},s.content=function(){return m("div",{className:"DiscussionsUserPage"},a.Z.component({state:this.state}))},e}((await s.e(251).then(s.bind(s,6068))).default);window.flreg.add("components/DiscussionsUserPage",r),t()}),1)}}]);
//# sourceMappingURL=DiscussionsUserPage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/DiscussionsUserPage.js"],"names":["DiscussionsUserPage","oninit","vnode","this","loadUser","m","route","param","show","user","state","DiscussionListState","q","username","sort","refresh","content","className","DiscussionList","window","flreg","add"],"mappings":"8KASqBA,E,sGACnBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAEbC,KAAKC,SAASC,EAAEC,MAAMC,MAAM,c,EAG9BC,KAAA,SAAKC,GACH,YAAMD,KAAN,UAAWC,GAEXN,KAAKO,MAAQ,IAAIC,IAAoB,CACnCC,EAAG,UAAYH,EAAKI,WACpBC,KAAM,WAGRX,KAAKO,MAAMK,W,EAGbC,QAAA,WACE,OAAO,SAAKC,UAAU,uBAAuBC,cAAyB,CAAER,MAAOP,KAAKO,U,UAzBhE,+BAAP,SA6BjBS,OAAOC,MAAMC,IAAI,iCAAkCrB,G","file":"forum/components/DiscussionsUserPage.js","sourcesContent":["import DiscussionList from './DiscussionList';\nimport DiscussionListState from '../states/DiscussionListState';\n\nconst UserPage = (await import(/* webpackChunkName: \"forum/components/UserPage\" */ './UserPage')).default;\n\n/**\n * The `DiscussionsUserPage` component shows a discussion list inside of a user\n * page.\n */\nexport default class DiscussionsUserPage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadUser(m.route.param('username'));\n }\n\n show(user) {\n super.show(user);\n\n this.state = new DiscussionListState({\n q: 'author:' + user.username(),\n sort: 'newest',\n });\n\n this.state.refresh();\n }\n\n content() {\n return <div className=\"DiscussionsUserPage\">{DiscussionList.component({ state: this.state })}</div>;\n }\n}\n\nwindow.flreg.add('components/DiscussionsUserPage', DiscussionsUserPage)"],"sourceRoot":""}

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[293],{763:(t,o,s)=>{s.r(o),s.d(o,{default:()=>u});var e=s(1788),r=s(4810),n=s(2587),i=s(8046),a=s(9100);function p(t){app.composer.isFullScreen()&&(app.composer.minimize(),t.stopPropagation())}var u=function(t){function o(){return t.apply(this,arguments)||this}(0,e.Z)(o,t),o.initAttrs=function(o){t.initAttrs.call(this,o),o.submitLabel=o.submitLabel||app.translator.trans("core.forum.composer_edit.submit_button"),o.confirmExit=o.confirmExit||app.translator.trans("core.forum.composer_edit.discard_confirmation"),o.originalContent=o.originalContent||o.post.content(),o.user=o.user||o.post.user(),o.post.editedContent=o.originalContent};var s=o.prototype;return s.headerItems=function(){var o=t.prototype.headerItems.call(this),s=this.attrs.post;return o.add("title",m("h3",null,(0,a.Z)("fas fa-pencil-alt")," ",m(i.Z,{href:app.route.discussion(s.discussion(),s.number()),onclick:p},app.translator.trans("core.forum.composer_edit.post_link",{number:s.number(),discussion:s.discussion().title()})))),o},s.jumpToPreview=function(t){p(t),m.route.set(app.route.post(this.attrs.post))},s.data=function(){return{content:this.composer.fields.content()}},s.onsubmit=function(){var t=this,o=this.attrs.post.discussion();this.loading=!0;var s=this.data();this.attrs.post.save(s).then((function(s){if(app.viewingDiscussion(o))app.current.get("stream").goToNumber(s.number());else{var e,r=n.Z.component({className:"Button Button--link",onclick:function(){m.route.set(app.route.post(s)),app.alerts.dismiss(e)}},app.translator.trans("core.forum.composer_edit.view_button"));e=app.alerts.show({type:"success",controls:[r]},app.translator.trans("core.forum.composer_edit.edited_message"))}t.composer.hide()}),this.loaded.bind(this))},o}(r.Z);window.flreg.add("components/EditPostComposer",u)}}]);
//# sourceMappingURL=EditPostComposer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[352],{3089:(s,r,t)=>{t.r(r),t.d(r,{default:()=>p});var e=t(1788),a=t(5556),i=t(2587),n=t(7880),o=t(4032),d=t(5731),u=t(4594),l=t(1024),p=function(s){function r(){return s.apply(this,arguments)||this}(0,e.Z)(r,s);var t=r.prototype;return t.oninit=function(r){var t=this;s.prototype.oninit.call(this,r);var e=this.attrs.user;this.username=(0,l.Z)(e.username()||""),this.email=(0,l.Z)(e.email()||""),this.isEmailConfirmed=(0,l.Z)(e.isEmailConfirmed()||!1),this.setPassword=(0,l.Z)(!1),this.password=(0,l.Z)(e.password()||""),this.groups={},app.store.all("groups").filter((function(s){return-1===[o.Z.GUEST_ID,o.Z.MEMBER_ID].indexOf(s.id())})).forEach((function(s){return t.groups[s.id()]=(0,l.Z)(-1!==e.groups().indexOf(s))}))},t.className=function(){return"EditUserModal Modal--small"},t.title=function(){return app.translator.trans("core.forum.edit_user.title")},t.content=function(){var s=this.fields().toArray();return m("div",{className:"Modal-body"},s.length>1?m("div",{className:"Form"},this.fields().toArray()):app.translator.trans("core.forum.edit_user.nothing_available"))},t.fields=function(){var s=this,r=new u.Z;return app.session.user.canEditCredentials()&&(r.add("username",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.username_heading")),m("input",{className:"FormControl",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.username_label")),bidi:this.username,disabled:this.nonAdminEditingAdmin()})),40),app.session.user!==this.attrs.user&&(r.add("email",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.email_heading")),m("div",null,m("input",{className:"FormControl",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.email_label")),bidi:this.email,disabled:this.nonAdminEditingAdmin()})),!this.isEmailConfirmed()&&this.userIsAdmin(app.session.user)?m("div",null,i.Z.component({className:"Button Button--block",loading:this.loading,onclick:this.activate.bind(this)},app.translator.trans("core.forum.edit_user.activate_button"))):""),30),r.add("password",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.password_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",onchange:function(r){s.setPassword(r.target.checked),m.redraw.sync(),r.target.checked&&s.$("[name=password]").select(),r.redraw=!1},disabled:this.nonAdminEditingAdmin()}),app.translator.trans("core.forum.edit_user.set_password_label")),this.setPassword()?m("input",{className:"FormControl",type:"password",name:"password",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.password_label")),bidi:this.password,disabled:this.nonAdminEditingAdmin()}):"")),20))),app.session.user.canEditGroups()&&r.add("groups",m("div",{className:"Form-group EditUserModal-groups"},m("label",null,app.translator.trans("core.forum.edit_user.groups_heading")),m("div",null,Object.keys(this.groups).map((function(s){return app.store.getById("groups",s)})).map((function(r){return m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:s.groups[r.id()],disabled:r.id()===o.Z.ADMINISTRATOR_ID&&(s.attrs.user===app.session.user||!s.userIsAdmin(app.session.user))}),n.Z.component({group:r,label:""})," ",r.nameSingular())})))),10),r.add("submit",m("div",{className:"Form-group"},i.Z.component({className:"Button Button--primary",type:"submit",loading:this.loading},app.translator.trans("core.forum.edit_user.submit_button"))),-10),r},t.activate=function(){var s=this;this.loading=!0;var r={username:this.username(),isEmailConfirmed:!0};this.attrs.user.save(r,{errorHandler:this.onerror.bind(this)}).then((function(){s.isEmailConfirmed(!0),s.loading=!1,m.redraw()})).catch((function(){s.loading=!1,m.redraw()}))},t.data=function(){var s=this,r={relationships:{}};return this.attrs.user.canEditCredentials()&&!this.nonAdminEditingAdmin()&&(r.username=this.username(),app.session.user!==this.attrs.user&&(r.email=this.email()),this.setPassword()&&(r.password=this.password())),this.attrs.user.canEditGroups()&&(r.relationships.groups=Object.keys(this.groups).filter((function(r){return s.groups[r]()})).map((function(s){return app.store.getById("groups",s)}))),r},t.onsubmit=function(s){var r=this;s.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((function(){r.loading=!1,m.redraw()}))},t.nonAdminEditingAdmin=function(){return this.userIsAdmin(this.attrs.user)&&!this.userIsAdmin(app.session.user)},t.userIsAdmin=function(s){return s.groups().some((function(s){return s.id()===o.Z.ADMINISTRATOR_ID}))},r}(a.Z);window.flreg.add("components/EditUserModal",p)}}]);
//# sourceMappingURL=EditUserModal.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[502],{5833:(t,o,r)=>{r.r(o),r.d(o,{default:()=>l});var a=r(1788),s=r(5556),e=r(2587),n=r(5731),i=r(1024),l=function(t){function o(){return t.apply(this,arguments)||this}(0,a.Z)(o,t);var r=o.prototype;return r.oninit=function(o){t.prototype.oninit.call(this,o),this.email=(0,i.Z)(this.attrs.email||""),this.success=!1},r.className=function(){return"ForgotPasswordModal Modal--small"},r.title=function(){return app.translator.trans("core.forum.forgot_password.title")},r.content=function(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.email_sent_message")),m("div",{className:"Form-group"},m(e.Z,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},app.translator.trans("core.forum.forgot_password.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.text")),m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:(0,n.Z)(app.translator.trans("core.forum.forgot_password.email_placeholder")),bidi:this.email,disabled:this.loading})),m("div",{className:"Form-group"},e.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.forgot_password.submit_button")))))},r.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,app.request({method:"POST",url:app.forum.attribute("apiUrl")+"/forgot",body:{email:this.email()},errorHandler:this.onerror.bind(this)}).then((function(){o.success=!0,o.alert=null})).catch((function(){})).then(this.loaded.bind(this))},r.onerror=function(o){404===o.status&&(o.alert.content=app.translator.trans("core.forum.forgot_password.not_found_message")),t.prototype.onerror.call(this,o)},o}(s.Z);window.flreg.add("components/ForgotPasswordModal",l)}}]);
//# sourceMappingURL=ForgotPasswordModal.js.map

File diff suppressed because one or more lines are too long

2
js/dist/forum/components/IndexPage.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[460],{7527:(t,o,i)=>{i.d(o,{Z:()=>e});var n=i(1788),r=i(8931),a=i(4594),e=function(t){function o(){return t.apply(this,arguments)||this}(0,n.Z)(o,t);var i=o.prototype;return i.view=function(){return m("div",{className:"LogInButtons"},this.items().toArray())},i.items=function(){return new a.Z},o}(r.Z);window.flreg.add("components/LogInButtons",e)},1498:(t,o,i)=>{i.r(o),i.d(o,{default:()=>c});var n=i(1788),r=i(5556),a=i(2587),e=i(7527),s=i(5731),l=i(4594),d=i(1024),c=function(t){function o(){return t.apply(this,arguments)||this}(0,n.Z)(o,t);var r=o.prototype;return r.oninit=function(o){t.prototype.oninit.call(this,o),this.identification=(0,d.Z)(this.attrs.identification||""),this.password=(0,d.Z)(this.attrs.password||""),this.remember=(0,d.Z)(!!this.attrs.remember)},r.className=function(){return"LogInModal Modal--small"},r.title=function(){return app.translator.trans("core.forum.log_in.title")},r.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},r.body=function(){return[m(e.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},r.fields=function(){var t=new l.Z;return t.add("identification",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"identification",type:"text",placeholder:(0,s.Z)(app.translator.trans("core.forum.log_in.username_or_email_placeholder")),bidi:this.identification,disabled:this.loading})),30),t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:(0,s.Z)(app.translator.trans("core.forum.log_in.password_placeholder")),bidi:this.password,disabled:this.loading})),20),t.add("remember",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.remember,disabled:this.loading}),app.translator.trans("core.forum.log_in.remember_me_label")))),10),t.add("submit",m("div",{className:"Form-group"},a.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.log_in.submit_button"))),-10),t},r.footer=function(){return[m("p",{className:"LogInModal-forgotPassword"},m("a",{onclick:this.forgotPassword.bind(this)},app.translator.trans("core.forum.log_in.forgot_password_link"))),app.forum.attribute("allowSignUp")?m("p",{className:"LogInModal-signUp"},app.translator.trans("core.forum.log_in.sign_up_text",{a:m("a",{onclick:this.signUp.bind(this)})})):""]},r.forgotPassword=function(){var t=this.identification(),o=-1!==t.indexOf("@")?{email:t}:void 0;app.modal.show((function(){return i.e(502).then(i.bind(i,5833))}),o)},r.signUp=function(){var t={password:this.password()},o=this.identification();t[-1!==o.indexOf("@")?"email":"username"]=o,app.modal.show((function(){return i.e(395).then(i.bind(i,3235))}),t)},r.onready=function(){this.$("[name="+(this.identification()?"password":"identification")+"]").select()},r.onsubmit=function(t){t.preventDefault(),this.loading=!0;var o=this.identification(),i=this.password(),n=this.remember();app.session.login({identification:o,password:i,remember:n},{errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},r.onerror=function(o){401===o.status&&(o.alert.content=app.translator.trans("core.forum.log_in.invalid_login_message")),t.prototype.onerror.call(this,o)},o}(r.Z);window.flreg.add("components/LogInModal",c)}}]);
//# sourceMappingURL=LogInModal.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[77],{3490:(t,i,n)=>{n.r(i),n.d(i,{default:()=>N});var o=n(1788),a=n(8931),s=n(7473),e=n(2587),c=n(8046),r=n(8726),l=n(8197),u=n(9908),f=n(9100),p=n(6961),d=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.view=function(){var t=this,i=this.attrs.notification,n=this.href();return m(c.Z,{className:"Notification Notification--"+i.contentType()+" "+(i.isRead()?"":"unread"),href:n,external:n.includes("://"),onclick:this.markAsRead.bind(this)},!i.isRead()&&e.Z.component({className:"Notification-action Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_as_read_tooltip"),onclick:function(i){i.preventDefault(),i.stopPropagation(),t.markAsRead()}}),(0,u.Z)(i.fromUser()),(0,f.Z)(this.icon(),{className:"Notification-icon"}),m("span",{className:"Notification-content"},this.content()),(0,p.Z)(i.createdAt()),m("div",{className:"Notification-excerpt"},this.excerpt()))},n.icon=function(){},n.href=function(){},n.content=function(){},n.excerpt=function(){},n.markAsRead=function(){this.attrs.notification.isRead()||(app.session.user.pushAttributes({unreadNotificationCount:app.session.user.unreadNotificationCount()-1}),this.attrs.notification.save({isRead:!0}))},i}(a.Z);window.flreg.add("components/Notification",d);var h=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.icon=function(){return"fas fa-pencil-alt"},n.href=function(){var t=this.attrs.notification;return app.route.discussion(t.subject(),t.content().postNumber)},n.content=function(){return app.translator.trans("core.forum.notifications.discussion_renamed_text",{user:this.attrs.notification.fromUser()})},i}(d);window.flreg.add("components/DiscussionRenamedNotification",h);var N=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.view=function(){var t=this,i=this.attrs.state,n=i.getNotificationPages();return m("div",{className:"NotificationList"},m("div",{className:"NotificationList-header"},m("div",{className:"App-primaryControl"},e.Z.component({className:"Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_all_as_read_tooltip"),onclick:i.markAllAsRead.bind(i)})),m("h4",{className:"App-titleControl App-titleControl--text"},app.translator.trans("core.forum.notifications.title"))),m("div",{className:"NotificationList-content"},n.length?n.map((function(i){var n=[],o={};return i.forEach((function(t){var i=t.subject();if(void 0!==i){var a=!1;i instanceof l.Z?a=i:i&&i.discussion&&(a=i.discussion());var s=a?a.id():0;o[s]=o[s]||{discussion:a,notifications:[]},o[s].notifications.push(t),-1===n.indexOf(o[s])&&n.push(o[s])}})),n.map((function(i){var n=i.discussion&&i.discussion.badges().toArray();return m("div",{className:"NotificationGroup"},i.discussion?m(c.Z,{className:"NotificationGroup-header",href:app.route.discussion(i.discussion)},n&&n.length?m("ul",{className:"NotificationGroup-badges badges"},(0,s.Z)(n)):"",i.discussion.title()):m("div",{className:"NotificationGroup-header"},app.forum.attribute("title")),m("ul",{className:"NotificationGroup-content"},i.notifications.map((function(i){var n=t.notificationComponents()[i.contentType()];return n?m("li",null,n.component({notification:i})):""}))))}))})):"",i.isLoading()?m(r.Z,{className:"LoadingIndicator--block"}):n.length?"":m("div",{className:"NotificationList-empty"},app.translator.trans("core.forum.notifications.empty_text"))))},n.notificationComponents=function(){return{discussionRenamed:h}},n.oncreate=function(i){t.prototype.oncreate.call(this,i),this.$notifications=this.$(".NotificationList-content"),this.$scrollParent=this.inPanel()?this.$notifications:$(window),this.boundScrollHandler=this.scrollHandler.bind(this),this.$scrollParent.on("scroll",this.boundScrollHandler)},n.onremove=function(){this.$scrollParent.off("scroll",this.boundScrollHandler)},n.scrollHandler=function(){var t=this.attrs.state,i=this.inPanel()?this.$scrollParent[0]:document.documentElement,n=Math.abs(i.scrollHeight-i.scrollTop-i.clientHeight)<=1;t.hasMoreResults()&&!t.isLoading()&&n&&t.loadMore()},n.inPanel=function(){return"auto"===this.$notifications.css("overflow")},i}(a.Z);window.flreg.add("components/NotificationList",N)}}]);
//# sourceMappingURL=NotificationList.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[765],{9440:(t,n,o)=>{o.r(n),o.d(n,{default:()=>s});var a=o(1788),e=o(9657),i=o(9100),s=function(t){function n(){return t.apply(this,arguments)||this}(0,a.Z)(n,t),n.initAttrs=function(n){n.className=n.className||"NotificationsDropdown",n.buttonClassName=n.buttonClassName||"Button Button--flat",n.menuClassName=n.menuClassName||"Dropdown-menu--right",n.label=n.label||app.translator.trans("core.forum.notifications.tooltip"),n.icon=n.icon||"fas fa-bell",n.accessibleToggleLabel=n.accessibleToggleLabel||app.translator.trans("core.forum.notifications.toggle_dropdown_accessible_label"),t.initAttrs.call(this,n)};var e=n.prototype;return e.getButton=function(){var n=this.getNewCount(),o=t.prototype.getButton.call(this);return o.attrs.title=this.attrs.label,o.attrs.className+=n?" new":"",o.attrs.onclick=this.onclick.bind(this),o},e.getButtonContent=function(){var t=this.getUnreadCount();return[(0,i.Z)(this.attrs.icon,{className:"Button-icon"}),t?m("span",{className:"NotificationsDropdown-unread"},t):"",m("span",{className:"Button-label"},this.attrs.label)]},e.getMenu=function(){var t=this.NotificationList;return m("div",{className:"Dropdown-menu "+this.attrs.menuClassName,onclick:this.menuClick.bind(this)},this.showing&&t?m(t,{state:this.attrs.state}):"")},e.onclick=function(){var t=this;o.e(77).then(o.bind(o,3490)).then((function(n){t.NotificationList=n.default,m.redraw()})),app.drawer.isOpen()?this.goToRoute():this.attrs.state.load()},e.goToRoute=function(){m.route.set(app.route("notifications"))},e.getUnreadCount=function(){return app.session.user.unreadNotificationCount()},e.getNewCount=function(){return app.session.user.newNotificationCount()},e.menuClick=function(t){(t.shiftKey||t.metaKey||t.ctrlKey||2===t.which)&&t.stopPropagation()},n}(e.Z);window.flreg.add("components/NotificationsDropdown",s)}}]);
//# sourceMappingURL=NotificationsDropdown.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/NotificationsDropdown.js"],"names":["NotificationsDropdown","initAttrs","attrs","className","buttonClassName","menuClassName","label","app","translator","trans","icon","accessibleToggleLabel","getButton","newNotifications","this","getNewCount","vdom","title","onclick","bind","getButtonContent","unread","getUnreadCount","getMenu","NotificationList","menuClick","showing","state","then","m","redraw","drawer","isOpen","goToRoute","load","route","set","session","user","unreadNotificationCount","newNotificationCount","e","shiftKey","metaKey","ctrlKey","which","stopPropagation","Dropdown","window","flreg","add"],"mappings":"8JAGqBA,E,6EACZC,UAAP,SAAiBC,GACfA,EAAMC,UAAYD,EAAMC,WAAa,wBACrCD,EAAME,gBAAkBF,EAAME,iBAAmB,sBACjDF,EAAMG,cAAgBH,EAAMG,eAAiB,uBAC7CH,EAAMI,MAAQJ,EAAMI,OAASC,IAAIC,WAAWC,MAAM,oCAClDP,EAAMQ,KAAOR,EAAMQ,MAAQ,cAE3BR,EAAMS,sBAAwBT,EAAMS,uBAAyBJ,IAAIC,WAAWC,MAAM,6DAElF,EAAMR,UAAN,UAAgBC,I,2BAGlBU,UAAA,WACE,IAAMC,EAAmBC,KAAKC,cACxBC,EAAO,EAAH,UAASJ,UAAT,WAOV,OALAI,EAAKd,MAAMe,MAAQH,KAAKZ,MAAMI,MAE9BU,EAAKd,MAAMC,WAAaU,EAAmB,OAAS,GACpDG,EAAKd,MAAMgB,QAAUJ,KAAKI,QAAQC,KAAKL,MAEhCE,G,EAGTI,iBAAA,WACE,IAAMC,EAASP,KAAKQ,iBAEpB,MAAO,EACLZ,OAAKI,KAAKZ,MAAMQ,KAAM,CAAEP,UAAW,gBACnCkB,EAAS,UAAMlB,UAAU,gCAAgCkB,GAAiB,GAC1E,UAAMlB,UAAU,gBAAgBW,KAAKZ,MAAMI,S,EAI/CiB,QAAA,WACE,IAAMC,EAAmBV,KAAKU,iBAE9B,OACE,SAAKrB,UAAW,iBAAmBW,KAAKZ,MAAMG,cAAea,QAASJ,KAAKW,UAAUN,KAAKL,OACvFA,KAAKY,SAAWF,EAAmB,EAACA,EAAD,CAAkBG,MAAOb,KAAKZ,MAAMyB,QAAY,K,EAK1FT,QAAA,WAAU,WACR,6BAAyFU,MAAK,SAACJ,GAC7F,EAAKA,iBAAmBA,EAAgB,QACxCK,EAAEC,YAGAvB,IAAIwB,OAAOC,SACblB,KAAKmB,YAELnB,KAAKZ,MAAMyB,MAAMO,Q,EAIrBD,UAAA,WACEJ,EAAEM,MAAMC,IAAI7B,IAAI4B,MAAM,mB,EAGxBb,eAAA,WACE,OAAOf,IAAI8B,QAAQC,KAAKC,2B,EAG1BxB,YAAA,WACE,OAAOR,IAAI8B,QAAQC,KAAKE,wB,EAG1Bf,UAAA,SAAUgB,IAGJA,EAAEC,UAAYD,EAAEE,SAAWF,EAAEG,SAAuB,IAAZH,EAAEI,QAAaJ,EAAEK,mB,GAzEdC,KA6EnDC,OAAOC,MAAMC,IAAI,mCAAoClD","file":"forum/components/NotificationsDropdown.js","sourcesContent":["import Dropdown from '../../common/components/Dropdown';\nimport icon from '../../common/helpers/icon';\n\nexport default class NotificationsDropdown extends Dropdown {\n static initAttrs(attrs) {\n attrs.className = attrs.className || 'NotificationsDropdown';\n attrs.buttonClassName = attrs.buttonClassName || 'Button Button--flat';\n attrs.menuClassName = attrs.menuClassName || 'Dropdown-menu--right';\n attrs.label = attrs.label || app.translator.trans('core.forum.notifications.tooltip');\n attrs.icon = attrs.icon || 'fas fa-bell';\n // For best a11y support, both `title` and `aria-label` should be used\n attrs.accessibleToggleLabel = attrs.accessibleToggleLabel || app.translator.trans('core.forum.notifications.toggle_dropdown_accessible_label');\n\n super.initAttrs(attrs);\n }\n\n getButton() {\n const newNotifications = this.getNewCount();\n const vdom = super.getButton();\n\n vdom.attrs.title = this.attrs.label;\n\n vdom.attrs.className += newNotifications ? ' new' : '';\n vdom.attrs.onclick = this.onclick.bind(this);\n\n return vdom;\n }\n\n getButtonContent() {\n const unread = this.getUnreadCount();\n\n return [\n icon(this.attrs.icon, { className: 'Button-icon' }),\n unread ? <span className=\"NotificationsDropdown-unread\">{unread}</span> : '',\n <span className=\"Button-label\">{this.attrs.label}</span>,\n ];\n }\n\n getMenu() {\n const NotificationList = this.NotificationList;\n\n return (\n <div className={'Dropdown-menu ' + this.attrs.menuClassName} onclick={this.menuClick.bind(this)}>\n {this.showing && NotificationList ? <NotificationList state={this.attrs.state} /> : ''}\n </div>\n );\n }\n\n onclick() {\n import(/* webpackChunkName: \"forum/components/NotificationList\" */ './NotificationList').then((NotificationList) => {\n this.NotificationList = NotificationList.default;\n m.redraw();\n });\n\n if (app.drawer.isOpen()) {\n this.goToRoute();\n } else {\n this.attrs.state.load();\n }\n }\n\n goToRoute() {\n m.route.set(app.route('notifications'));\n }\n\n getUnreadCount() {\n return app.session.user.unreadNotificationCount();\n }\n\n getNewCount() {\n return app.session.user.newNotificationCount();\n }\n\n menuClick(e) {\n // Don't close the notifications dropdown if the user is opening a link in a\n // new tab or window.\n if (e.shiftKey || e.metaKey || e.ctrlKey || e.which === 2) e.stopPropagation();\n }\n}\n\nwindow.flreg.add('components/NotificationsDropdown', NotificationsDropdown)"],"sourceRoot":""}

2
js/dist/forum/components/Post.js vendored Normal file

File diff suppressed because one or more lines are too long

1
js/dist/forum/components/Post.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
js/dist/forum/components/PostUser.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[564],{7214:(t,i,n)=>{n.r(i),n.d(i,{default:()=>a});var s=n(1788),e=n(5556),r=n(2587),o=n(1024),a=function(t){function i(){return t.apply(this,arguments)||this}(0,s.Z)(i,t);var n=i.prototype;return n.oninit=function(i){t.prototype.oninit.call(this,i),this.discussion=this.attrs.discussion,this.currentTitle=this.attrs.currentTitle,this.newTitle=(0,o.Z)(this.currentTitle)},n.className=function(){return"RenameDiscussionModal Modal--small"},n.title=function(){return app.translator.trans("core.forum.rename_discussion.title")},n.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m("input",{className:"FormControl",bidi:this.newTitle,type:"text"})),m("div",{className:"Form-group"},r.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.rename_discussion.submit_button")))))},n.onsubmit=function(t){var i=this;t.preventDefault(),this.loading=!0;var n=this.newTitle(),s=this.currentTitle;if(n&&n!==s)return this.discussion.save({title:n}).then((function(){app.viewingDiscussion(i.discussion)&&app.current.get("stream").update(),m.redraw(),i.hide()})).catch((function(){i.loading=!1,m.redraw()}));this.hide()},i}(e.Z);window.flreg.add("components/RenameDiscussionModal",a)}}]);
//# sourceMappingURL=RenameDiscussionModal.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/RenameDiscussionModal.js"],"names":["RenameDiscussionModal","oninit","vnode","this","discussion","attrs","currentTitle","newTitle","Stream","className","title","app","translator","trans","content","bidi","type","Button","loading","onsubmit","e","preventDefault","save","then","viewingDiscussion","current","get","update","m","redraw","hide","Modal","window","flreg","add"],"mappings":"wKAOqBA,E,sGACnBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAEbC,KAAKC,WAAaD,KAAKE,MAAMD,WAC7BD,KAAKG,aAAeH,KAAKE,MAAMC,aAC/BH,KAAKI,UAAWC,OAAOL,KAAKG,e,EAG9BG,UAAA,WACE,MAAO,sC,EAGTC,MAAA,WACE,OAAOC,IAAIC,WAAWC,MAAM,uC,EAG9BC,QAAA,WACE,OACE,SAAKL,UAAU,cACb,SAAKA,UAAU,uBACb,SAAKA,UAAU,cACb,WAAOA,UAAU,cAAcM,KAAMZ,KAAKI,SAAUS,KAAK,UAE3D,SAAKP,UAAU,cACZQ,cACC,CACER,UAAW,uCACXO,KAAM,SACNE,QAASf,KAAKe,SAEhBP,IAAIC,WAAWC,MAAM,mD,EAQjCM,SAAA,SAASC,GAAG,WACVA,EAAEC,iBAEFlB,KAAKe,SAAU,EAEf,IAAMR,EAAQP,KAAKI,WACbD,EAAeH,KAAKG,aAK1B,GAAII,GAASA,IAAUJ,EACrB,OAAOH,KAAKC,WACTkB,KAAK,CAAEZ,UACPa,MAAK,WACAZ,IAAIa,kBAAkB,EAAKpB,aAC7BO,IAAIc,QAAQC,IAAI,UAAUC,SAE5BC,EAAEC,SACF,EAAKC,UAPF,OASE,WACL,EAAKZ,SAAU,EACfU,EAAEC,YAGN1B,KAAK2B,Q,GAjEwCC,KAsEnDC,OAAOC,MAAMC,IAAI,mCAAoClC","file":"forum/components/RenameDiscussionModal.js","sourcesContent":["import Modal from '../../common/components/Modal';\nimport Button from '../../common/components/Button';\nimport Stream from '../../common/utils/Stream';\n\n/**\n * The 'RenameDiscussionModal' displays a modal dialog with an input to rename a discussion\n */\nexport default class RenameDiscussionModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.discussion = this.attrs.discussion;\n this.currentTitle = this.attrs.currentTitle;\n this.newTitle = Stream(this.currentTitle);\n }\n\n className() {\n return 'RenameDiscussionModal Modal--small';\n }\n\n title() {\n return app.translator.trans('core.forum.rename_discussion.title');\n }\n\n content() {\n return (\n <div className=\"Modal-body\">\n <div className=\"Form Form--centered\">\n <div className=\"Form-group\">\n <input className=\"FormControl\" bidi={this.newTitle} type=\"text\" />\n </div>\n <div className=\"Form-group\">\n {Button.component(\n {\n className: 'Button Button--primary Button--block',\n type: 'submit',\n loading: this.loading,\n },\n app.translator.trans('core.forum.rename_discussion.submit_button')\n )}\n </div>\n </div>\n </div>\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n const title = this.newTitle();\n const currentTitle = this.currentTitle;\n\n // If the title is different to what it was before, then save it. After the\n // save has completed, update the post stream as there will be a new post\n // indicating that the discussion was renamed.\n if (title && title !== currentTitle) {\n return this.discussion\n .save({ title })\n .then(() => {\n if (app.viewingDiscussion(this.discussion)) {\n app.current.get('stream').update();\n }\n m.redraw();\n this.hide();\n })\n .catch(() => {\n this.loading = false;\n m.redraw();\n });\n } else {\n this.hide();\n }\n }\n}\n\nwindow.flreg.add('components/RenameDiscussionModal', RenameDiscussionModal)"],"sourceRoot":""}

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[557],{2304:(t,n,o)=>{o.r(n),o.d(n,{default:()=>f});var a=o(2122),e=o(1788),r=o(9908),s=o(507),i=o(9657),p=o(2558),u=o(2587),l=o(4594),c=o(5128),f=function(t){function n(){return t.apply(this,arguments)||this}(0,e.Z)(n,t),n.initAttrs=function(n){t.initAttrs.call(this,n),n.className="SessionDropdown",n.buttonClassName="Button Button--user Button--flat",n.menuClassName="Dropdown-menu--right",n.accessibleToggleLabel=app.translator.trans("core.forum.header.session_dropdown_accessible_label")};var o=n.prototype;return o.view=function(n){return t.prototype.view.call(this,(0,a.Z)({},n,{children:this.items().toArray()}))},o.getButtonContent=function(){var t=app.session.user;return[(0,r.Z)(t)," ",m("span",{className:"Button-label"},(0,s.Z)(t))]},o.items=function(){var t=new l.Z,n=app.session.user;return t.add("profile",p.Z.component({icon:"fas fa-user",href:app.route.user(n)},app.translator.trans("core.forum.header.profile_button")),100),t.add("settings",p.Z.component({icon:"fas fa-cog",href:app.route("settings")},app.translator.trans("core.forum.header.settings_button")),50),app.forum.attribute("adminUrl")&&t.add("administration",p.Z.component({icon:"fas fa-wrench",href:app.forum.attribute("adminUrl"),target:"_blank"},app.translator.trans("core.forum.header.admin_button")),0),t.add("separator",c.Z.component(),-90),t.add("logOut",u.Z.component({icon:"fas fa-sign-out-alt",onclick:app.session.logout.bind(app.session)},app.translator.trans("core.forum.header.log_out_button")),-100),t},n}(i.Z);window.flreg.add("components/SessionDropdown",f)}}]);
//# sourceMappingURL=SessionDropdown.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/SessionDropdown.js"],"names":["SessionDropdown","initAttrs","attrs","className","buttonClassName","menuClassName","accessibleToggleLabel","app","translator","trans","view","vnode","children","this","items","toArray","getButtonContent","user","session","avatar","username","ItemList","add","LinkButton","icon","href","route","forum","attribute","target","Separator","Button","onclick","logout","bind","Dropdown","window","flreg"],"mappings":"yNAYqBA,E,6EACZC,UAAP,SAAiBC,GACf,EAAMD,UAAN,UAAgBC,GAEhBA,EAAMC,UAAY,kBAClBD,EAAME,gBAAkB,mCACxBF,EAAMG,cAAgB,uBAEtBH,EAAMI,sBAAwBC,IAAIC,WAAWC,MAAM,wD,2BAGrDC,KAAA,SAAKC,GACH,mBAAaD,KAAb,qBAAuBC,EAAvB,CAA8BC,SAAUC,KAAKC,QAAQC,c,EAGvDC,iBAAA,WACE,IAAMC,EAAOV,IAAIW,QAAQD,KAEzB,MAAO,EAACE,OAAOF,GAAO,IAAK,UAAMd,UAAU,iBAAgBiB,OAASH,M,EAQtEH,MAAA,WACE,IAAMA,EAAQ,IAAIO,IACZJ,EAAOV,IAAIW,QAAQD,KAuDzB,OArDAH,EAAMQ,IACJ,UACAC,cACE,CACEC,KAAM,cACNC,KAAMlB,IAAImB,MAAMT,KAAKA,IAEvBV,IAAIC,WAAWC,MAAM,qCAEvB,KAGFK,EAAMQ,IACJ,WACAC,cACE,CACEC,KAAM,aACNC,KAAMlB,IAAImB,MAAM,aAElBnB,IAAIC,WAAWC,MAAM,sCAEvB,IAGEF,IAAIoB,MAAMC,UAAU,aACtBd,EAAMQ,IACJ,iBACAC,cACE,CACEC,KAAM,gBACNC,KAAMlB,IAAIoB,MAAMC,UAAU,YAC1BC,OAAQ,UAEVtB,IAAIC,WAAWC,MAAM,mCAEvB,GAIJK,EAAMQ,IAAI,YAAaQ,iBAAwB,IAE/ChB,EAAMQ,IACJ,SACAS,cACE,CACEP,KAAM,sBACNQ,QAASzB,IAAIW,QAAQe,OAAOC,KAAK3B,IAAIW,UAEvCX,IAAIC,WAAWC,MAAM,sCAEtB,KAGIK,G,GAnFkCqB,KAuF7CC,OAAOC,MAAMf,IAAI,6BAA8BtB","file":"forum/components/SessionDropdown.js","sourcesContent":["import avatar from '../../common/helpers/avatar';\nimport username from '../../common/helpers/username';\nimport Dropdown from '../../common/components/Dropdown';\nimport LinkButton from '../../common/components/LinkButton';\nimport Button from '../../common/components/Button';\nimport ItemList from '../../common/utils/ItemList';\nimport Separator from '../../common/components/Separator';\n\n/**\n * The `SessionDropdown` component shows a button with the current user's\n * avatar/name, with a dropdown of session controls.\n */\nexport default class SessionDropdown extends Dropdown {\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n\n attrs.className = 'SessionDropdown';\n attrs.buttonClassName = 'Button Button--user Button--flat';\n attrs.menuClassName = 'Dropdown-menu--right';\n\n attrs.accessibleToggleLabel = app.translator.trans('core.forum.header.session_dropdown_accessible_label');\n }\n\n view(vnode) {\n return super.view({ ...vnode, children: this.items().toArray() });\n }\n\n getButtonContent() {\n const user = app.session.user;\n\n return [avatar(user), ' ', <span className=\"Button-label\">{username(user)}</span>];\n }\n\n /**\n * Build an item list for the contents of the dropdown menu.\n *\n * @return {ItemList}\n */\n items() {\n const items = new ItemList();\n const user = app.session.user;\n\n items.add(\n 'profile',\n LinkButton.component(\n {\n icon: 'fas fa-user',\n href: app.route.user(user),\n },\n app.translator.trans('core.forum.header.profile_button')\n ),\n 100\n );\n\n items.add(\n 'settings',\n LinkButton.component(\n {\n icon: 'fas fa-cog',\n href: app.route('settings'),\n },\n app.translator.trans('core.forum.header.settings_button')\n ),\n 50\n );\n\n if (app.forum.attribute('adminUrl')) {\n items.add(\n 'administration',\n LinkButton.component(\n {\n icon: 'fas fa-wrench',\n href: app.forum.attribute('adminUrl'),\n target: '_blank',\n },\n app.translator.trans('core.forum.header.admin_button')\n ),\n 0\n );\n }\n\n items.add('separator', Separator.component(), -90);\n\n items.add(\n 'logOut',\n Button.component(\n {\n icon: 'fas fa-sign-out-alt',\n onclick: app.session.logout.bind(app.session),\n },\n app.translator.trans('core.forum.header.log_out_button')\n ),\n -100\n );\n\n return items;\n }\n}\n\nwindow.flreg.add('components/SessionDropdown', SessionDropdown)"],"sourceRoot":""}

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[826],{6991:(t,n,e)=>{e.d(n,{Z:()=>c});var i=e(1788),a=e(8931),o=e(5971),r=e(9100),s=e(4594),c=function(t){function n(){return t.apply(this,arguments)||this}(0,i.Z)(n,t);var e=n.prototype;return e.oninit=function(n){t.prototype.oninit.call(this,n),this.methods=this.notificationMethods().toArray(),this.loading={},this.types=this.notificationTypes().toArray()},e.view=function(){var t=this,n=this.attrs.user.preferences();return m("table",{className:"NotificationGrid"},m("thead",null,m("tr",null,m("td",null),this.methods.map((function(n){return m("th",{className:"NotificationGrid-groupToggle",onclick:t.toggleMethod.bind(t,n.name)},(0,r.Z)(n.icon)," ",n.label)})))),m("tbody",null,this.types.map((function(e){return m("tr",null,m("td",{className:"NotificationGrid-groupToggle",onclick:t.toggleType.bind(t,e.name)},(0,r.Z)(e.icon)," ",e.label),t.methods.map((function(i){var a=t.preferenceKey(e.name,i.name);return m("td",{className:"NotificationGrid-checkbox"},m(o.Z,{state:!!n[a],loading:t.loading[a],disabled:!(a in n),onchange:t.toggle.bind(t,[a])}))})))}))))},e.oncreate=function(n){t.prototype.oncreate.call(this,n),this.$("thead .NotificationGrid-groupToggle").bind("mouseenter mouseleave",(function(t){var n=parseInt($(this).index(),10)+1;$(this).parents("table").find("td:nth-child("+n+")").toggleClass("highlighted","mouseenter"===t.type)})),this.$("tbody .NotificationGrid-groupToggle").bind("mouseenter mouseleave",(function(t){$(this).parent().find("td").toggleClass("highlighted","mouseenter"===t.type)}))},e.toggle=function(t){var n=this,e=this.attrs.user,i=e.preferences(),a=!i[t[0]];t.forEach((function(t){n.loading[t]=!0,i[t]=a})),m.redraw(),e.save({preferences:i}).then((function(){t.forEach((function(t){return n.loading[t]=!1})),m.redraw()}))},e.toggleMethod=function(t){var n=this,e=this.types.map((function(e){return n.preferenceKey(e.name,t)})).filter((function(t){return t in n.attrs.user.preferences()}));this.toggle(e)},e.toggleType=function(t){var n=this,e=this.methods.map((function(e){return n.preferenceKey(t,e.name)})).filter((function(t){return t in n.attrs.user.preferences()}));this.toggle(e)},e.preferenceKey=function(t,n){return"notify_"+t+"_"+n},e.notificationMethods=function(){var t=new s.Z;return t.add("alert",{name:"alert",icon:"fas fa-bell",label:app.translator.trans("core.forum.settings.notify_by_web_heading")}),t.add("email",{name:"email",icon:"far fa-envelope",label:app.translator.trans("core.forum.settings.notify_by_email_heading")}),t},e.notificationTypes=function(){var t=new s.Z;return t.add("discussionRenamed",{name:"discussionRenamed",icon:"fas fa-pencil-alt",label:app.translator.trans("core.forum.settings.notify_discussion_renamed_label")}),t},n}(a.Z);window.flreg.add("components/NotificationGrid",c)},5792:(t,n,e)=>{e.a(t,(async t=>{e.r(n),e.d(n,{default:()=>u});var i=e(1788),a=e(4594),o=e(833),r=e(2587),s=e(4926),c=e(6991),l=e(7473),u=function(t){function n(){return t.apply(this,arguments)||this}(0,i.Z)(n,t);var u=n.prototype;return u.oninit=function(n){t.prototype.oninit.call(this,n),this.show(app.session.user),app.setTitle(app.translator.trans("core.forum.settings.title"))},u.content=function(){return m("div",{className:"SettingsPage"},m("ul",null,(0,l.Z)(this.settingsItems().toArray())))},u.settingsItems=function(){var t=this,n=new a.Z;return["account","notifications","privacy"].forEach((function(e){n.add(e,m(s.Z,{className:"Settings-"+e,label:app.translator.trans("core.forum.settings."+e+"_heading")},t[e+"Items"]().toArray()))})),n},u.accountItems=function(){var t=new a.Z,n=function(){return e.e(372).then(e.bind(e,4146))},i=function(){return e.e(503).then(e.bind(e,22))};return t.add("changePassword",m(r.Z,{className:"Button",onclick:function(){return app.modal.show(i)}},app.translator.trans("core.forum.settings.change_password_button"))),t.add("changeEmail",m(r.Z,{className:"Button",onclick:function(){return app.modal.show(n)}},app.translator.trans("core.forum.settings.change_email_button"))),t},u.notificationsItems=function(){var t=new a.Z;return t.add("notificationGrid",m(c.Z,{user:this.user})),t},u.privacyItems=function(){var t=this,n=new a.Z;return n.add("discloseOnline",m(o.Z,{state:this.user.preferences().discloseOnline,onchange:function(n){t.discloseOnlineLoading=!0,t.user.savePreferences({discloseOnline:n}).then((function(){t.discloseOnlineLoading=!1,m.redraw()}))},loading:this.discloseOnlineLoading},app.translator.trans("core.forum.settings.privacy_disclose_online_label"))),n},n}((await e.e(251).then(e.bind(e,6068))).default);window.flreg.add("components/SettingsPage",u),t()}),1)}}]);
//# sourceMappingURL=SettingsPage.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[395],{7527:(t,a,s)=>{s.d(a,{Z:()=>n});var r=s(1788),e=s(8931),i=s(4594),n=function(t){function a(){return t.apply(this,arguments)||this}(0,r.Z)(a,t);var s=a.prototype;return s.view=function(){return m("div",{className:"LogInButtons"},this.items().toArray())},s.items=function(){return new i.Z},a}(e.Z);window.flreg.add("components/LogInButtons",n)},3235:(t,a,s)=>{s.r(a),s.d(a,{default:()=>u});var r=s(1788),e=s(5556),i=s(2587),n=s(7527),o=s(5731),l=s(4594),d=s(1024),u=function(t){function a(){return t.apply(this,arguments)||this}(0,r.Z)(a,t);var e=a.prototype;return e.oninit=function(a){t.prototype.oninit.call(this,a),this.username=(0,d.Z)(this.attrs.username||""),this.email=(0,d.Z)(this.attrs.email||""),this.password=(0,d.Z)(this.attrs.password||"")},e.className=function(){return"Modal--small SignUpModal"},e.title=function(){return app.translator.trans("core.forum.sign_up.title")},e.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},e.isProvided=function(t){return this.attrs.provided&&-1!==this.attrs.provided.indexOf(t)},e.body=function(){return[this.attrs.token?"":m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},e.fields=function(){var t=new l.Z;return t.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:(0,o.Z)(app.translator.trans("core.forum.sign_up.username_placeholder")),bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),t.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:(0,o.Z)(app.translator.trans("core.forum.sign_up.email_placeholder")),bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:(0,o.Z)(app.translator.trans("core.forum.sign_up.password_placeholder")),bidi:this.password,disabled:this.loading})),10),t.add("submit",m("div",{className:"Form-group"},m(i.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.sign_up.submit_button"))),-10),t},e.footer=function(){return[m("p",{className:"SignUpModal-logIn"},app.translator.trans("core.forum.sign_up.log_in_text",{a:m("a",{onclick:this.logIn.bind(this)})}))]},e.logIn=function(){var t={identification:this.email()||this.username(),password:this.password()};app.modal.show((function(){return s.e(460).then(s.bind(s,1498))}),t)},e.onready=function(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()},e.onsubmit=function(t){t.preventDefault(),this.loading=!0;var a=this.submitData();app.request({url:app.forum.attribute("baseUrl")+"/register",method:"POST",body:a,errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},e.submitData=function(){var t={username:this.username(),email:this.email()};return this.attrs.token?t.token=this.attrs.token:t.password=this.password(),t},a}(e.Z);window.flreg.add("components/SignUpModal",u)}}]);
//# sourceMappingURL=SignUpModal.js.map

File diff suppressed because one or more lines are too long

2
js/dist/forum/components/UserPage.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
js/dist/forum/flarum-core.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
*/
/*!
* Color Thief v2.0
* by Lokesh Dhakar - http://www.lokeshdhakar.com
*
* Thanks
* ------
* Nick Rabinowitz - For creating quantize.js.
* John Schulz - For clean up and optimization. @JFSIII
* Nathan Spady - For adding drag and drop support to the demo page.
*
* License
* -------
* Copyright 2011, 2015 Lokesh Dhakar
* Released under the MIT license
* https://raw.githubusercontent.com/lokesh/color-thief/master/LICENSE
*
*/
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/

1
js/dist/forum/flarum-core.js.map vendored Normal file

File diff suppressed because one or more lines are too long

2
js/dist/forum/runtime.js vendored Normal file
View File

@@ -0,0 +1,2 @@
(()=>{var e,o,r,t,n,a,s,i,u={},c={};function m(e){var o=c[e];if(void 0!==o)return o.exports;var r=c[e]={exports:{}};return u[e].call(r.exports,r,r.exports,m),r.exports}m.m=u,e="function"==typeof Symbol?Symbol("webpack then"):"__webpack_then__",o="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",r=e=>{e&&(e.forEach((e=>e.r--)),e.forEach((e=>e.r--?e.r++:e())))},t=e=>!--e.r&&e(),n=(e,o)=>e?e.push(o):t(o),m.a=(a,s,i)=>{var u,c,m,p=i&&[],f=a.exports,l=!0,d=!1,h=(o,r,t)=>{d||(d=!0,r.r+=o.length,o.map(((o,n)=>o[e](r,t))),d=!1)},b=new Promise(((e,o)=>{m=o,c=()=>(e(f),r(p),p=0)}));b[o]=f,b[e]=(e,o)=>{if(l)return t(e);u&&h(u,e,o),n(p,e),b.catch(o)},a.exports=b,s((a=>{if(!a)return c();var s,i;u=(a=>a.map((a=>{if(null!==a&&"object"==typeof a){if(a[e])return a;if(a.then){var s=[];a.then((e=>{i[o]=e,r(s),s=0}));var i={[e]:(e,o)=>(n(s,e),a.catch(o))};return i}}return{[e]:e=>t(e),[o]:a}})))(a);var m=new Promise(((e,r)=>{(s=()=>e(i=u.map((e=>e[o])))).r=0,h(u,s,r)}));return s.r?m:i})).then(c,m),l=!1},a=[],m.O=(e,o,r,t)=>{if(!o){var n=1/0;for(u=0;u<a.length;u++){for(var[o,r,t]=a[u],s=!0,i=0;i<o.length;i++)(!1&t||n>=t)&&Object.keys(m.O).every((e=>m.O[e](o[i])))?o.splice(i--,1):(s=!1,t<n&&(n=t));s&&(a.splice(u--,1),e=r())}return e}t=t||0;for(var u=a.length;u>0&&a[u-1][2]>t;u--)a[u]=a[u-1];a[u]=[o,r,t]},m.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return m.d(o,{a:o}),o},m.d=(e,o)=>{for(var r in o)m.o(o,r)&&!m.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},m.f={},m.e=e=>Promise.all(Object.keys(m.f).reduce(((o,r)=>(m.f[r](e,o),o)),[])),m.u=e=>({28:"forum/components/PostsUserPage",77:"forum/components/NotificationList",192:"forum/components/Post",247:"common/components/TextEditor",251:"forum/components/UserPage",293:"forum/components/EditPostComposer",352:"forum/components/EditUserModal",372:"forum/components/ChangeEmailModal",395:"forum/components/SignUpModal",437:"forum/components/DiscussionComposer",460:"forum/components/LogInModal",502:"forum/components/ForgotPasswordModal",503:"forum/components/ChangePasswordModal",557:"forum/components/SessionDropdown",563:"forum/components/PostStream",564:"forum/components/RenameDiscussionModal",765:"forum/components/NotificationsDropdown",779:"forum/components/PostUser",799:"forum/components/DiscussionsUserPage",826:"forum/components/SettingsPage",847:"forum/components/IndexPage"}[e]+".js"),m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),s={},i="@flarum/core:",m.l=(e,o,r,t)=>{if(s[e])s[e].push(o);else{var n,a;if(void 0!==r)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var p=u[c];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==i+r){n=p;break}}n||(a=!0,(n=document.createElement("script")).charset="utf-8",n.timeout=120,m.nc&&n.setAttribute("nonce",m.nc),n.setAttribute("data-webpack",i+r),n.src=e),s[e]=[o];var f=(o,r)=>{n.onerror=n.onload=null,clearTimeout(l);var t=s[e];if(delete s[e],n.parentNode&&n.parentNode.removeChild(n),t&&t.forEach((e=>e(r))),o)return o(r)},l=setTimeout(f.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=f.bind(null,n.onerror),n.onload=f.bind(null,n.onload),a&&document.head.appendChild(n)}},m.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},m.p="/assets/",(()=>{var e={406:0};m.f.j=(o,r)=>{var t=m.o(e,o)?e[o]:void 0;if(0!==t)if(t)r.push(t[2]);else if(406!=o){var n=new Promise(((r,n)=>t=e[o]=[r,n]));r.push(t[2]=n);var a=m.p+m.u(o),s=new Error;m.l(a,(r=>{if(m.o(e,o)&&(0!==(t=e[o])&&(e[o]=void 0),t)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+o+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,t[1](s)}}),"chunk-"+o,o)}else e[o]=0},m.O.j=o=>0===e[o];var o=(o,r)=>{var t,n,[a,s,i]=r,u=0;for(t in s)m.o(s,t)&&(m.m[t]=s[t]);for(i&&i(m),o&&o(r);u<a.length;u++)n=a[u],m.o(e,n)&&e[n]&&e[n][0](),e[a[u]]=0;m.O()},r=self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[];r.forEach(o.bind(null,0)),r.push=o.bind(null,r.push.bind(r))})(),m.O()})();
//# sourceMappingURL=runtime.js.map

1
js/dist/forum/runtime.js.map vendored Normal file

File diff suppressed because one or more lines are too long

3
js/dist/forum/vendor.js vendored Normal file

File diff suppressed because one or more lines are too long

24
js/dist/forum/vendor.js.LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,24 @@
/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/
/*!
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2021-03-02T17:08Z
*/

1
js/dist/forum/vendor.js.map vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -8,4 +8,4 @@
*/
export * from './src/common';
export * from './src/forum';
export * from './src/forum';

8218
js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,29 +6,37 @@
"clsx": "^1.1.1",
"color-thief-browser": "^2.0.2",
"dayjs": "^1.10.4",
"expose-loader": "^1.0.3",
"jquery": "^3.6.0",
"jquery.hotkeys": "^0.1.0",
"lodash-es": "^4.17.21",
"mithril": "^2.0.4",
"punycode": "^2.1.1",
"spin.js": "^3.1.0",
"textarea-caret": "^3.1.0"
"textarea-caret": "^3.1.0",
"webpack-visualizer-plugin": "^0.1.11",
"zepto": "^1.2.0"
},
"devDependencies": {
"@babel/plugin-proposal-export-default-from": "^7.12.13",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-top-level-await": "^7.12.13",
"@babel/preset-typescript": "^7.13.0",
"@types/jquery": "^3.5.5",
"@types/lodash-es": "^4.17.4",
"@types/mithril": "^2.0.7",
"@types/punycode": "^2.1.0",
"@types/textarea-caret": "^3.0.0",
"babel-plugin-add-module-exports": "^1.0.4",
"bundlewatch": "^0.3.2",
"expose-loader": "^2.0.0",
"flarum-webpack-config": "0.1.0-beta.10",
"husky": "^4.3.8",
"loader-utils": "^1.4.0",
"prettier": "^2.2.1",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-merge": "^4.2.2"
"webpack": "~5.33.2",
"webpack-bundle-analyzer": "^4.4.1",
"webpack-cli": "~4.6.0",
"webpack-merge": "~5.7.3"
},
"scripts": {
"dev": "webpack --mode development --watch",

3
js/shims.d.ts vendored
View File

@@ -8,6 +8,8 @@ import * as _$ from 'jquery';
// Globals from flarum/core
import Application from './src/common/Application';
import FlarumRegistry from './src/common/FlarumRegistry';
/**
* flarum/core exposes several extensions globally:
*
@@ -41,4 +43,5 @@ declare global {
*/
declare global {
const app: Application;
const flreg: FlarumRegistry;
}

View File

@@ -36,7 +36,7 @@ export default class UploadImageButton extends Button {
$input
.appendTo('body')
.hide()
.click()
.trigger('click')
.on('change', (e) => {
const body = new FormData();
body.append(this.attrs.name, $(e.target)[0].files[0]);

View File

@@ -3,11 +3,3 @@ import app from './app';
export { app };
// Export public API
// Export compat API
import compatObj from './compat';
import proxifyCompat from '../common/utils/proxifyCompat';
compatObj.app = app;
export const compat = proxifyCompat(compatObj, 'admin');

View File

@@ -0,0 +1,55 @@
interface ExportRegistry {
moduleExports: object;
onLoads: object;
/**
* Add an instance to the registry.
* This serves as the equivalent of `flarum.core.compat[id] = object`
*/
add(id: string, object: any);
/**
* Add a function to run when object of id "id" is added (or overriden).
* If such an object is already registered, the handler will be applied immediately.
*/
onLoad(id: string, handler: Function);
/**
* Retrieve an object of type `id` from the registry.
*/
get(id: string): any;
}
export default class FlarumRegistry implements ExportRegistry {
moduleExports = {};
onLoads = {};
add(id: string, object: any) {
const onLoads = this.onLoads[id];
if (onLoads) {
onLoads.map((onLoad) => {
object = onLoad(object);
});
}
this.moduleExports[id] = object;
}
onLoad(id: string, handler: Function) {
const loadedObject = this.moduleExports[id];
if (loadedObject) {
this.moduleExports[id] = handler(loadedObject);
} else {
this.onLoads[id] = this.onLoads[id] || [];
this.onLoads[id].push(handler);
}
}
get(id: string): any {
if (this.moduleExports[id]) {
return this.moduleExports[id];
}
}
}

View File

@@ -1,151 +0,0 @@
import * as extend from './extend';
import Session from './Session';
import Store from './Store';
import BasicEditorDriver from './utils/BasicEditorDriver';
import evented from './utils/evented';
import liveHumanTimes from './utils/liveHumanTimes';
import ItemList from './utils/ItemList';
import mixin from './utils/mixin';
import humanTime from './utils/humanTime';
import computed from './utils/computed';
import Drawer from './utils/Drawer';
import anchorScroll from './utils/anchorScroll';
import RequestError from './utils/RequestError';
import abbreviateNumber from './utils/abbreviateNumber';
import * as string from './utils/string';
import Stream from './utils/Stream';
import SubtreeRetainer from './utils/SubtreeRetainer';
import setRouteWithForcedRefresh from './utils/setRouteWithForcedRefresh';
import extract from './utils/extract';
import ScrollListener from './utils/ScrollListener';
import stringToColor from './utils/stringToColor';
import subclassOf from './utils/subclassOf';
import patchMithril from './utils/patchMithril';
import proxifyCompat from './utils/proxifyCompat';
import classList from './utils/classList';
import extractText from './utils/extractText';
import formatNumber from './utils/formatNumber';
import mapRoutes from './utils/mapRoutes';
import withAttr from './utils/withAttr';
import Notification from './models/Notification';
import User from './models/User';
import Post from './models/Post';
import Discussion from './models/Discussion';
import Group from './models/Group';
import Forum from './models/Forum';
import Component from './Component';
import Translator from './Translator';
import AlertManager from './components/AlertManager';
import Page from './components/Page';
import Switch from './components/Switch';
import Badge from './components/Badge';
import LoadingIndicator from './components/LoadingIndicator';
import Placeholder from './components/Placeholder';
import Separator from './components/Separator';
import Dropdown from './components/Dropdown';
import SplitDropdown from './components/SplitDropdown';
import RequestErrorModal from './components/RequestErrorModal';
import FieldSet from './components/FieldSet';
import Select from './components/Select';
import Navigation from './components/Navigation';
import Alert from './components/Alert';
import Link from './components/Link';
import LinkButton from './components/LinkButton';
import Checkbox from './components/Checkbox';
import SelectDropdown from './components/SelectDropdown';
import ModalManager from './components/ModalManager';
import Button from './components/Button';
import Modal from './components/Modal';
import GroupBadge from './components/GroupBadge';
import TextEditor from './components/TextEditor';
import TextEditorButton from './components/TextEditorButton';
import Model from './Model';
import Application from './Application';
import fullTime from './helpers/fullTime';
import avatar from './helpers/avatar';
import icon from './helpers/icon';
import humanTimeHelper from './helpers/humanTime';
import punctuateSeries from './helpers/punctuateSeries';
import highlight from './helpers/highlight';
import username from './helpers/username';
import userOnline from './helpers/userOnline';
import listItems from './helpers/listItems';
import Fragment from './Fragment';
import DefaultResolver from './resolvers/DefaultResolver';
export default {
extend: extend,
Session: Session,
Store: Store,
'utils/BasicEditorDriver': BasicEditorDriver,
'utils/evented': evented,
'utils/liveHumanTimes': liveHumanTimes,
'utils/ItemList': ItemList,
'utils/mixin': mixin,
'utils/humanTime': humanTime,
'utils/computed': computed,
'utils/Drawer': Drawer,
'utils/anchorScroll': anchorScroll,
'utils/RequestError': RequestError,
'utils/abbreviateNumber': abbreviateNumber,
'utils/string': string,
'utils/SubtreeRetainer': SubtreeRetainer,
'utils/extract': extract,
'utils/ScrollListener': ScrollListener,
'utils/stringToColor': stringToColor,
'utils/Stream': Stream,
'utils/subclassOf': subclassOf,
'utils/setRouteWithForcedRefresh': setRouteWithForcedRefresh,
'utils/patchMithril': patchMithril,
'utils/proxifyCompat': proxifyCompat,
'utils/classList': classList,
'utils/extractText': extractText,
'utils/formatNumber': formatNumber,
'utils/mapRoutes': mapRoutes,
'utils/withAttr': withAttr,
'models/Notification': Notification,
'models/User': User,
'models/Post': Post,
'models/Discussion': Discussion,
'models/Group': Group,
'models/Forum': Forum,
Component: Component,
Fragment: Fragment,
Translator: Translator,
'components/AlertManager': AlertManager,
'components/Page': Page,
'components/Switch': Switch,
'components/Badge': Badge,
'components/LoadingIndicator': LoadingIndicator,
'components/Placeholder': Placeholder,
'components/Separator': Separator,
'components/Dropdown': Dropdown,
'components/SplitDropdown': SplitDropdown,
'components/RequestErrorModal': RequestErrorModal,
'components/FieldSet': FieldSet,
'components/Select': Select,
'components/Navigation': Navigation,
'components/Alert': Alert,
'components/Link': Link,
'components/LinkButton': LinkButton,
'components/Checkbox': Checkbox,
'components/SelectDropdown': SelectDropdown,
'components/ModalManager': ModalManager,
'components/Button': Button,
'components/Modal': Modal,
'components/GroupBadge': GroupBadge,
'components/TextEditor': TextEditor,
'components/TextEditorButton': TextEditorButton,
Model: Model,
Application: Application,
'helpers/fullTime': fullTime,
'helpers/avatar': avatar,
'helpers/icon': icon,
'helpers/humanTime': humanTimeHelper,
'helpers/punctuateSeries': punctuateSeries,
'helpers/highlight': highlight,
'helpers/username': username,
'helpers/userOnline': userOnline,
'helpers/listItems': listItems,
'resolvers/DefaultResolver': DefaultResolver,
};

View File

@@ -1,5 +1,5 @@
// Expose jQuery, mithril and dayjs to the window browser object
import 'expose-loader?exposes[]=$&exposes[]=jQuery!jquery';
import 'expose-loader?exposes=$,jQuery!jquery';
import 'expose-loader?exposes=m!mithril';
import 'expose-loader?exposes=dayjs!dayjs';

View File

@@ -1,4 +1,4 @@
import Mithril from 'mithril';
import Component from '../Component';
/**
* Generates a route resolver for a given component.
@@ -7,7 +7,7 @@ import Mithril from 'mithril';
* - It sets a key on the component so a rerender will be triggered on route change.
*/
export default class DefaultResolver {
component: Mithril.Component;
component: Component | Function;
routeName: string;
constructor(component, routeName) {
@@ -31,8 +31,13 @@ export default class DefaultResolver {
};
}
onmatch(args, requestedPath, route) {
return this.component;
async onmatch(args, requestedPath, route) {
if (typeof this.component.component === 'function') {
return this.component;
} else {
const component = await this.component();
return component.default;
}
}
render(vnode) {

View File

@@ -10,12 +10,17 @@ export default class ModalManagerState {
*
* @public
*/
show(componentClass, attrs) {
async show(componentClass, attrs) {
// Breaking Change Compliance Warning, Remove in Beta 15.
if (!(componentClass.prototype instanceof Modal)) {
// This is duplicated so that if the error is caught, an error message still shows up in the debug console.
console.error('The ModalManager can only show Modals');
throw new Error('The ModalManager can only show Modals');
if (typeof componentClass === 'function') {
const componentResolver = await componentClass();
componentClass = componentResolver.default;
} else {
// This is duplicated so that if the error is caught, an error message still shows up in the debug console.
console.error('The ModalManager can only show Modals');
throw new Error('The ModalManager can only show Modals');
}
}
if (componentClass.init) {
// This is duplicated so that if the error is caught, an error message still shows up in the debug console.

View File

@@ -7,7 +7,7 @@ export default class Drawer {
constructor() {
// Set up an event handler so that whenever the content area is tapped,
// the drawer will close.
$('#content').click((e) => {
$('#content').on('click tap', e => {
if (this.isOpen()) {
e.preventDefault();
this.hide();

View File

@@ -0,0 +1,162 @@
/* ========================================================================
* Bootstrap: affix.js v3.3.6
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$target = $(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed = null
this.unpin = null
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION = '3.3.6'
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0,
target: window
}
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
var targetHeight = this.$target.height()
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
if (this.affixed == 'bottom') {
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
}
var initializing = this.affixed == null
var colliderTop = initializing ? scrollTop : position.top
var colliderHeight = initializing ? targetHeight : height
if (offsetTop != null && scrollTop <= offsetTop) return 'top'
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
var scrollHeight = Math.max($(document).height(), $(document.body).height())
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
if (this.affixed != affix) {
if (this.unpin != null) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if (affix == 'bottom') {
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}
}
// AFFIX PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.affix
$.fn.affix = Plugin
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
if (data.offsetTop != null) data.offset.top = data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);

View File

@@ -1,5 +1,5 @@
function bidi(node, prop) {
var type = node.tag === 'select' ? (node.attrs.multi ? 'multi' : 'select') : node.attrs.type;
let type = node.tag === 'select' ? (node.attrs.multi ? 'multi' : 'select') : node.attrs.type;
// Setup: bind listeners
if (type === 'multi') {
@@ -46,5 +46,5 @@ function bidi(node, prop) {
bidi.view = function (ctrl, node, prop) {
return bidi(node, node.attrs.bidi);
};
window.flreg = new (require('../FlarumRegistry').default)();
export default bidi;

View File

@@ -1,4 +1,4 @@
export default (compat: { [key: string]: any }, namespace: string) => {
export default function proxifyCompat(compat: { [key: string]: any }, namespace: string) {
// regex to replace common/ and NAMESPACE/ for core & core extensions
// e.g. admin/utils/extract --> utils/extract
// e.g. tags/common/utils/sortTags --> tags/utils/sortTags
@@ -7,4 +7,4 @@ export default (compat: { [key: string]: any }, namespace: string) => {
return new Proxy(compat, {
get: (obj, prop: string) => obj[prop] || obj[prop.replace(regex, '$1')],
});
};
}

View File

@@ -9,7 +9,8 @@
* Replaces m.withAttr for Mithril 2.0.
* @see https://mithril.js.org/archive/v0.2.5/mithril.withAttr.html
*/
export default (key: string, cb: Function) =>
function (this: Element) {
export default function withAttr(key: string, cb: Function) {
return function (this: Element) {
cb(this.getAttribute(key) || this[key]);
};
}

View File

@@ -1,13 +1,9 @@
import History from './utils/History';
import Pane from './utils/Pane';
import DiscussionPage from './components/DiscussionPage';
import SignUpModal from './components/SignUpModal';
import HeaderPrimary from './components/HeaderPrimary';
import HeaderSecondary from './components/HeaderSecondary';
import Composer from './components/Composer';
import DiscussionRenamedNotification from './components/DiscussionRenamedNotification';
import CommentPost from './components/CommentPost';
import DiscussionRenamedPost from './components/DiscussionRenamedPost';
import routes from './routes';
import alertEmailConfirmation from './utils/alertEmailConfirmation';
import Application from '../common/Application';
@@ -19,24 +15,6 @@ import ComposerState from './states/ComposerState';
import isSafariMobile from './utils/isSafariMobile';
export default class ForumApplication extends Application {
/**
* A map of notification types to their components.
*
* @type {Object}
*/
notificationComponents = {
discussionRenamed: DiscussionRenamedNotification,
};
/**
* A map of post types to their components.
*
* @type {Object}
*/
postComponents = {
comment: CommentPost,
discussionRenamed: DiscussionRenamedPost,
};
/**
* An object which controls the state of the page's side pane.
*
@@ -128,7 +106,7 @@ export default class ForumApplication extends Application {
// Route the home link back home when clicked. We do not want it to register
// if the user is opening it in a new tab, however.
$('#home-link').click((e) => {
$('#home-link').on('click tap', e => {
if (e.ctrlKey || e.metaKey || e.which === 2) return;
e.preventDefault();
app.history.home();
@@ -153,8 +131,8 @@ export default class ForumApplication extends Application {
* @param {Discussion} discussion
* @return {Boolean}
*/
viewingDiscussion(discussion) {
return this.current.matches(DiscussionPage, { discussion });
async viewingDiscussion(discussion) {
return this.current.matches(DiscussionPage.default, { discussion });
}
/**
@@ -174,6 +152,8 @@ export default class ForumApplication extends Application {
if (payload.loggedIn) {
window.location.reload();
} else {
const SignUpModal = () => import(/* webpackChunkName: "forum/components/SignUpModal" */ './components/SignUpModal');
this.modal.show(SignUpModal, payload);
}
}

View File

@@ -1,153 +0,0 @@
import compat from '../common/compat';
import PostControls from './utils/PostControls';
import KeyboardNavigatable from './utils/KeyboardNavigatable';
import slidable from './utils/slidable';
import History from './utils/History';
import DiscussionControls from './utils/DiscussionControls';
import alertEmailConfirmation from './utils/alertEmailConfirmation';
import UserControls from './utils/UserControls';
import Pane from './utils/Pane';
import ComposerState from './states/ComposerState';
import DiscussionListState from './states/DiscussionListState';
import GlobalSearchState from './states/GlobalSearchState';
import NotificationListState from './states/NotificationListState';
import PostStreamState from './states/PostStreamState';
import SearchState from './states/SearchState';
import AffixedSidebar from './components/AffixedSidebar';
import DiscussionPage from './components/DiscussionPage';
import DiscussionListPane from './components/DiscussionListPane';
import LogInModal from './components/LogInModal';
import ComposerBody from './components/ComposerBody';
import ForgotPasswordModal from './components/ForgotPasswordModal';
import Notification from './components/Notification';
import LogInButton from './components/LogInButton';
import DiscussionsUserPage from './components/DiscussionsUserPage';
import Composer from './components/Composer';
import SessionDropdown from './components/SessionDropdown';
import HeaderPrimary from './components/HeaderPrimary';
import PostEdited from './components/PostEdited';
import PostStream from './components/PostStream';
import ChangePasswordModal from './components/ChangePasswordModal';
import IndexPage from './components/IndexPage';
import DiscussionRenamedNotification from './components/DiscussionRenamedNotification';
import DiscussionsSearchSource from './components/DiscussionsSearchSource';
import HeaderSecondary from './components/HeaderSecondary';
import ComposerButton from './components/ComposerButton';
import DiscussionList from './components/DiscussionList';
import ReplyPlaceholder from './components/ReplyPlaceholder';
import AvatarEditor from './components/AvatarEditor';
import Post from './components/Post';
import SettingsPage from './components/SettingsPage';
import TerminalPost from './components/TerminalPost';
import ChangeEmailModal from './components/ChangeEmailModal';
import NotificationsDropdown from './components/NotificationsDropdown';
import UserPage from './components/UserPage';
import PostUser from './components/PostUser';
import UserCard from './components/UserCard';
import UsersSearchSource from './components/UsersSearchSource';
import NotificationGrid from './components/NotificationGrid';
import PostPreview from './components/PostPreview';
import EventPost from './components/EventPost';
import DiscussionHero from './components/DiscussionHero';
import PostMeta from './components/PostMeta';
import EditUserModal from './components/EditUserModal';
import SearchSource from './components/SearchSource';
import DiscussionRenamedPost from './components/DiscussionRenamedPost';
import DiscussionComposer from './components/DiscussionComposer';
import LogInButtons from './components/LogInButtons';
import NotificationList from './components/NotificationList';
import WelcomeHero from './components/WelcomeHero';
import SignUpModal from './components/SignUpModal';
import CommentPost from './components/CommentPost';
import ComposerPostPreview from './components/ComposerPostPreview';
import ReplyComposer from './components/ReplyComposer';
import NotificationsPage from './components/NotificationsPage';
import PostStreamScrubber from './components/PostStreamScrubber';
import EditPostComposer from './components/EditPostComposer';
import RenameDiscussionModal from './components/RenameDiscussionModal';
import Search from './components/Search';
import DiscussionListItem from './components/DiscussionListItem';
import LoadingPost from './components/LoadingPost';
import PostsUserPage from './components/PostsUserPage';
import DiscussionPageResolver from './resolvers/DiscussionPageResolver';
import BasicEditorDriver from '../common/utils/BasicEditorDriver';
import routes from './routes';
import ForumApplication from './ForumApplication';
export default Object.assign(compat, {
'utils/PostControls': PostControls,
'utils/KeyboardNavigatable': KeyboardNavigatable,
'utils/slidable': slidable,
'utils/History': History,
'utils/DiscussionControls': DiscussionControls,
'utils/alertEmailConfirmation': alertEmailConfirmation,
'utils/UserControls': UserControls,
'utils/Pane': Pane,
'utils/BasicEditorDriver': BasicEditorDriver,
'states/ComposerState': ComposerState,
'states/DiscussionListState': DiscussionListState,
'states/GlobalSearchState': GlobalSearchState,
'states/NotificationListState': NotificationListState,
'states/PostStreamState': PostStreamState,
'states/SearchState': SearchState,
'components/AffixedSidebar': AffixedSidebar,
'components/DiscussionPage': DiscussionPage,
'components/DiscussionListPane': DiscussionListPane,
'components/LogInModal': LogInModal,
'components/ComposerBody': ComposerBody,
'components/ForgotPasswordModal': ForgotPasswordModal,
'components/Notification': Notification,
'components/LogInButton': LogInButton,
'components/DiscussionsUserPage': DiscussionsUserPage,
'components/Composer': Composer,
'components/SessionDropdown': SessionDropdown,
'components/HeaderPrimary': HeaderPrimary,
'components/PostEdited': PostEdited,
'components/PostStream': PostStream,
'components/ChangePasswordModal': ChangePasswordModal,
'components/IndexPage': IndexPage,
'components/DiscussionRenamedNotification': DiscussionRenamedNotification,
'components/DiscussionsSearchSource': DiscussionsSearchSource,
'components/HeaderSecondary': HeaderSecondary,
'components/ComposerButton': ComposerButton,
'components/DiscussionList': DiscussionList,
'components/ReplyPlaceholder': ReplyPlaceholder,
'components/AvatarEditor': AvatarEditor,
'components/Post': Post,
'components/SettingsPage': SettingsPage,
'components/TerminalPost': TerminalPost,
'components/ChangeEmailModal': ChangeEmailModal,
'components/NotificationsDropdown': NotificationsDropdown,
'components/UserPage': UserPage,
'components/PostUser': PostUser,
'components/UserCard': UserCard,
'components/UsersSearchSource': UsersSearchSource,
'components/NotificationGrid': NotificationGrid,
'components/PostPreview': PostPreview,
'components/EventPost': EventPost,
'components/DiscussionHero': DiscussionHero,
'components/PostMeta': PostMeta,
'components/EditUserModal': EditUserModal,
'components/SearchSource': SearchSource,
'components/DiscussionRenamedPost': DiscussionRenamedPost,
'components/DiscussionComposer': DiscussionComposer,
'components/LogInButtons': LogInButtons,
'components/NotificationList': NotificationList,
'components/WelcomeHero': WelcomeHero,
'components/SignUpModal': SignUpModal,
'components/CommentPost': CommentPost,
'components/ComposerPostPreview': ComposerPostPreview,
'components/ReplyComposer': ReplyComposer,
'components/NotificationsPage': NotificationsPage,
'components/PostStreamScrubber': PostStreamScrubber,
'components/EditPostComposer': EditPostComposer,
'components/RenameDiscussionModal': RenameDiscussionModal,
'components/Search': Search,
'components/DiscussionListItem': DiscussionListItem,
'components/LoadingPost': LoadingPost,
'components/PostsUserPage': PostsUserPage,
'resolvers/DiscussionPageResolver': DiscussionPageResolver,
routes: routes,
ForumApplication: ForumApplication,
});

View File

@@ -147,7 +147,7 @@ export default class AvatarEditor extends Component {
$input
.appendTo('body')
.hide()
.click()
.trigger('click')
.on('input', (e) => {
this.upload($(e.target)[0].files[0]);
});

View File

@@ -1,14 +1,14 @@
import Post from './Post';
import classList from '../../common/utils/classList';
import PostUser from './PostUser';
import PostMeta from './PostMeta';
import PostEdited from './PostEdited';
import EditPostComposer from './EditPostComposer';
import ItemList from '../../common/utils/ItemList';
import listItems from '../../common/helpers/listItems';
import Button from '../../common/components/Button';
import ComposerPostPreview from './ComposerPostPreview';
const Post = (await import(/* webpackChunkName: "forum/components/Post" */ './Post')).default;
const PostUser = await import(/* webpackChunkName: "forum/components/PostUser" */ './PostUser');
/**
* The `CommentPost` component displays a standard `comment`-typed post. This
* includes a number of item lists (controls, header, and footer) surrounding
@@ -87,7 +87,9 @@ export default class CommentPost extends Post {
}
isEditing() {
return app.composer.bodyMatches(EditPostComposer, { post: this.attrs.post });
import(/* webpackChunkName: "forum/components/EditPostComposer" */ './EditPostComposer').then((EditPostComposer) => {
return app.composer.bodyMatches(EditPostComposer.default, { post: this.attrs.post });
});
}
elementAttrs() {
@@ -126,7 +128,7 @@ export default class CommentPost extends Post {
items.add(
'user',
PostUser.component({
PostUser.default.component({
post,
cardVisible: this.cardVisible,
oncardshow: () => {

View File

@@ -88,7 +88,7 @@ export default class Composer extends Component {
$(window)
.on('resize', (this.handlers.onresize = this.updateHeight.bind(this)))
.resize();
.trigger('resize');
$(document)
.on('mousemove', (this.handlers.onmousemove = this.onmousemove.bind(this)))
@@ -110,8 +110,8 @@ export default class Composer extends Component {
$(vnode.dom)
.css('cursor', 'row-resize')
.bind('dragstart mousedown', (e) => e.preventDefault())
.mousedown(function (e) {
.on('dragstart mousedown', (e) => e.preventDefault())
.on('mousedown', function (e) {
composer.mouseStart = e.clientY;
composer.heightStart = composer.$().height();
composer.handle = $(this);

View File

@@ -1,7 +1,6 @@
import Component from '../../common/Component';
import LoadingIndicator from '../../common/components/LoadingIndicator';
import ConfirmDocumentUnload from '../../common/components/ConfirmDocumentUnload';
import TextEditor from '../../common/components/TextEditor';
import avatar from '../../common/helpers/avatar';
import listItems from '../../common/helpers/listItems';
import ItemList from '../../common/utils/ItemList';
@@ -34,7 +33,13 @@ export default class ComposerBody extends Component {
*
* @type {Boolean}
*/
this.loading = false;
this.loading = true;
import(/* webpackChunkName: "common/components/TextEditor" */ '../../common/components/TextEditor').then((TextEditor) => {
this.TextEditor = TextEditor.default;
this.loading = false;
m.redraw();
});
// Let the composer state know to ask for confirmation under certain
// circumstances, if the body supports / requires it and has a corresponding
@@ -47,6 +52,8 @@ export default class ComposerBody extends Component {
}
view() {
const TextEditor = this.TextEditor;
return (
<ConfirmDocumentUnload when={this.hasChanges.bind(this)}>
<div className={'ComposerBody ' + (this.attrs.className || '')}>
@@ -54,16 +61,18 @@ export default class ComposerBody extends Component {
<div className="ComposerBody-content">
<ul className="ComposerBody-header">{listItems(this.headerItems().toArray())}</ul>
<div className="ComposerBody-editor">
{TextEditor.component({
submitLabel: this.attrs.submitLabel,
placeholder: this.attrs.placeholder,
disabled: this.loading || this.attrs.disabled,
composer: this.composer,
preview: this.jumpToPreview && this.jumpToPreview.bind(this),
onchange: this.composer.fields.content,
onsubmit: this.onsubmit.bind(this),
value: this.composer.fields.content(),
})}
{TextEditor
? TextEditor.component({
submitLabel: this.attrs.submitLabel,
placeholder: this.attrs.placeholder,
disabled: this.loading || this.attrs.disabled,
composer: this.composer,
preview: this.jumpToPreview && this.jumpToPreview.bind(this),
onchange: this.composer.fields.content,
onsubmit: this.onsubmit.bind(this),
value: this.composer.fields.content(),
})
: ''}
</div>
</div>
{LoadingIndicator.component({ className: 'ComposerBody-loading' + (this.loading ? ' active' : '') })}

View File

@@ -64,7 +64,7 @@ export default class DiscussionListItem extends Component {
const isRead = discussion.isRead();
const showUnread = !this.showRepliesCount() && isUnread;
let jumpTo = 0;
const controls = DiscussionControls.controls(discussion, this).toArray();
const controls = new DiscussionControls().controls(discussion, this).toArray();
const attrs = this.elementAttrs();
if (this.attrs.params.q) {

View File

@@ -2,7 +2,6 @@ import Page from '../../common/components/Page';
import ItemList from '../../common/utils/ItemList';
import DiscussionHero from './DiscussionHero';
import DiscussionListPane from './DiscussionListPane';
import PostStream from './PostStream';
import PostStreamScrubber from './PostStreamScrubber';
import LoadingIndicator from '../../common/components/LoadingIndicator';
import SplitDropdown from '../../common/components/SplitDropdown';
@@ -69,6 +68,8 @@ export default class DiscussionPage extends Page {
view() {
const discussion = this.discussion;
const PostStream = this.PostStream;
return (
<div className="DiscussionPage">
<DiscussionListPane state={app.discussions} />
@@ -81,11 +82,11 @@ export default class DiscussionPage extends Page {
<ul>{listItems(this.sidebarItems().toArray())}</ul>
</nav>
<div className="DiscussionPage-stream">
{PostStream.component({
discussion,
stream: this.stream,
onPositionChange: this.positionChanged.bind(this),
})}
{PostStream ? (
<PostStream discussion={discussion} stream={this.stream} onPositionChange={this.positionChanged.bind(this)} />
) : (
LoadingIndicator.component({ className: 'LoadingIndicator--block' })
)}
</div>
</div>,
]
@@ -99,6 +100,11 @@ export default class DiscussionPage extends Page {
* Load the discussion from the API or use the preloaded one.
*/
load() {
import(/* webpackChunkName: "forum/components/PostStream" */ './PostStream').then((PostStream) => {
this.PostStream = PostStream.default;
m.redraw();
});
const preloadedDiscussion = app.preloadedApiDocument();
if (preloadedDiscussion) {
// We must wrap this in a setTimeout because if we are mounting this
@@ -191,7 +197,7 @@ export default class DiscussionPage extends Page {
buttonClassName: 'Button--primary',
accessibleToggleLabel: app.translator.trans('core.forum.discussion_controls.toggle_dropdown_accessible_label'),
},
DiscussionControls.controls(this.discussion, this).toArray()
new DiscussionControls().controls(this.discussion, this).toArray()
)
);

View File

@@ -1,7 +1,8 @@
import UserPage from './UserPage';
import DiscussionList from './DiscussionList';
import DiscussionListState from '../states/DiscussionListState';
const UserPage = (await import(/* webpackChunkName: "forum/components/UserPage" */ './UserPage')).default;
/**
* The `DiscussionsUserPage` component shows a discussion list inside of a user
* page.

View File

@@ -1,9 +1,10 @@
import Post from './Post';
import { ucfirst } from '../../common/utils/string';
import usernameHelper from '../../common/helpers/username';
import icon from '../../common/helpers/icon';
import Link from '../../common/components/Link';
const Post = (await import(/* webpackChunkName: "forum/components/Post" */ './Post')).default;
/**
* The `EventPost` component displays a post which indicating a discussion
* event, like a discussion being renamed or stickied. Subclasses must implement

View File

@@ -1,10 +1,6 @@
import Component from '../../common/Component';
import Button from '../../common/components/Button';
import LogInModal from './LogInModal';
import SignUpModal from './SignUpModal';
import SessionDropdown from './SessionDropdown';
import SelectDropdown from '../../common/components/SelectDropdown';
import NotificationsDropdown from './NotificationsDropdown';
import ItemList from '../../common/utils/ItemList';
import listItems from '../../common/helpers/listItems';
import Search from '../components/Search';
@@ -27,7 +23,10 @@ export default class HeaderSecondary extends Component {
items() {
const items = new ItemList();
items.add('search', Search.component({ state: app.search }), 30);
const LogInModal = () => import(/* webpackChunkName: "forum/components/LogInModal" */ './LogInModal');
const SignUpModal = () => import(/* webpackChunkName: "forum/components/SignUpModal" */ './SignUpModal');
items.add('search', Search.component({state: app.search}), 30);
if (app.forum.attribute('showLanguageSelector') && Object.keys(app.data.locales).length > 1) {
const locales = [];
@@ -40,7 +39,7 @@ export default class HeaderSecondary extends Component {
icon: app.data.locale === locale ? 'fas fa-check' : true,
onclick: () => {
if (app.session.user) {
app.session.user.savePreferences({ locale }).then(() => window.location.reload());
app.session.user.savePreferences({locale}).then(() => window.location.reload());
} else {
document.cookie = `locale=${locale}; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT`;
window.location.reload();
@@ -66,8 +65,24 @@ export default class HeaderSecondary extends Component {
}
if (app.session.user) {
items.add('notifications', NotificationsDropdown.component({ state: app.notifications }), 10);
items.add('session', SessionDropdown.component(), 0);
if (!this.NotificationsDropdown) {
import(/* webpackChunkName: "forum/components/NotificationsDropdown" */ './NotificationsDropdown').then(NotificationsDropdown => {
this.NotificationsDropdown = NotificationsDropdown.default;
m.redraw();
});
} else {
items.add('notifications', this.NotificationsDropdown.component({state: app.notifications}), 10);
}
if (!this.SessionDropdown) {
import(/* webpackChunkName: "forum/components/SessionDropdown" */ './SessionDropdown').then(SessionDropdown => {
this.SessionDropdown = SessionDropdown.default;
m.redraw();
});
} else {
items.add('session', this.SessionDropdown.component(), 0);
}
} else {
if (app.forum.attribute('allowSignUp')) {
items.add(

View File

@@ -1,11 +1,8 @@
import { extend } from '../../common/extend';
import Page from '../../common/components/Page';
import ItemList from '../../common/utils/ItemList';
import listItems from '../../common/helpers/listItems';
import DiscussionList from './DiscussionList';
import WelcomeHero from './WelcomeHero';
import DiscussionComposer from './DiscussionComposer';
import LogInModal from './LogInModal';
import DiscussionPage from './DiscussionPage';
import Dropdown from '../../common/components/Dropdown';
import Button from '../../common/components/Button';
@@ -295,6 +292,9 @@ export default class IndexPage extends Page {
* @return {Promise}
*/
newDiscussionAction() {
const LogInModal = () => import(/* webpackChunkName: "forum/components/LogInModal" */ './LogInModal');
const DiscussionComposer = () => import(/* webpackChunkName: "forum/components/DiscussionComposer" */ './DiscussionComposer');
return new Promise((resolve, reject) => {
if (app.session.user) {
app.composer.load(DiscussionComposer, { user: app.session.user });

View File

@@ -1,6 +1,4 @@
import Modal from '../../common/components/Modal';
import ForgotPasswordModal from './ForgotPasswordModal';
import SignUpModal from './SignUpModal';
import Button from '../../common/components/Button';
import LogInButtons from './LogInButtons';
import extractText from '../../common/utils/extractText';
@@ -142,6 +140,8 @@ export default class LogInModal extends Modal {
* @public
*/
forgotPassword() {
const ForgotPasswordModal = () => import(/* webpackChunkName: "forum/components/ForgotPasswordModal" */ './ForgotPasswordModal');
const email = this.identification();
const attrs = email.indexOf('@') !== -1 ? { email } : undefined;
@@ -155,6 +155,8 @@ export default class LogInModal extends Modal {
* @public
*/
signUp() {
const SignUpModal = () => import(/* webpackChunkName: "forum/components/SignUpModal" */ './SignUpModal');
const attrs = { password: this.password() };
const identification = this.identification();
attrs[identification.indexOf('@') !== -1 ? 'email' : 'username'] = identification;

View File

@@ -4,6 +4,7 @@ import Button from '../../common/components/Button';
import Link from '../../common/components/Link';
import LoadingIndicator from '../../common/components/LoadingIndicator';
import Discussion from '../../common/models/Discussion';
import DiscussionRenamedNotification from './DiscussionRenamedNotification';
/**
* The `NotificationList` component displays a list of the logged-in user's
@@ -74,7 +75,7 @@ export default class NotificationList extends Component {
<ul className="NotificationGroup-content">
{group.notifications.map((notification) => {
const NotificationComponent = app.notificationComponents[notification.contentType()];
const NotificationComponent = this.notificationComponents()[notification.contentType()];
return NotificationComponent ? <li>{NotificationComponent.component({ notification })}</li> : '';
})}
</ul>
@@ -95,6 +96,17 @@ export default class NotificationList extends Component {
);
}
/**
* A map of notification types to their components.
*
* @type {Object}
*/
notificationComponents() {
return {
discussionRenamed: DiscussionRenamedNotification,
};
}
oncreate(vnode) {
super.oncreate(vnode);

View File

@@ -1,6 +1,5 @@
import Dropdown from '../../common/components/Dropdown';
import icon from '../../common/helpers/icon';
import NotificationList from './NotificationList';
export default class NotificationsDropdown extends Dropdown {
static initAttrs(attrs) {
@@ -38,14 +37,21 @@ export default class NotificationsDropdown extends Dropdown {
}
getMenu() {
const NotificationList = this.NotificationList;
return (
<div className={'Dropdown-menu ' + this.attrs.menuClassName} onclick={this.menuClick.bind(this)}>
{this.showing ? NotificationList.component({ state: this.attrs.state }) : ''}
{this.showing && NotificationList ? <NotificationList state={this.attrs.state} /> : ''}
</div>
);
}
onclick() {
import(/* webpackChunkName: "forum/components/NotificationList" */ './NotificationList').then((NotificationList) => {
this.NotificationList = NotificationList.default;
m.redraw();
});
if (app.drawer.isOpen()) {
this.goToRoute();
} else {

View File

@@ -1,5 +1,4 @@
import Page from '../../common/components/Page';
import NotificationList from './NotificationList';
/**
* The `NotificationsPage` component shows the notifications list. It is only
@@ -11,16 +10,19 @@ export default class NotificationsPage extends Page {
app.history.push('notifications');
import(/* webpackChunkName: "forum/components/NotificationList" */ './NotificationList').then((NotificationList) => {
this.NotificationList = NotificationList.default;
m.redraw();
});
app.notifications.load();
this.bodyClass = 'App--notifications';
}
view() {
return (
<div className="NotificationsPage">
<NotificationList state={app.notifications}></NotificationList>
</div>
);
const NotificationList = this.NotificationList;
return <div className="NotificationsPage">{NotificationList ? <NotificationList state={app.notifications} /> : ''}</div>;
}
}

View File

@@ -43,7 +43,7 @@ export default class Post extends Component {
attrs.className = this.classes(attrs.className).join(' ');
const controls = PostControls.controls(this.attrs.post, this).toArray();
const controls = new PostControls().controls(this.attrs.post, this).toArray();
return (
<article {...attrs}>

View File

@@ -3,6 +3,8 @@ import ScrollListener from '../../common/utils/ScrollListener';
import PostLoading from './LoadingPost';
import ReplyPlaceholder from './ReplyPlaceholder';
import Button from '../../common/components/Button';
import CommentPost from './CommentPost';
import DiscussionRenamedPost from './DiscussionRenamedPost';
/**
* The `PostStream` component displays an infinitely-scrollable wall of posts in
@@ -25,6 +27,18 @@ export default class PostStream extends Component {
this.scrollListener = new ScrollListener(this.onscroll.bind(this));
}
/**
* A map of post types to their components.
*
* @type {Object}
*/
postComponents() {
return {
comment: CommentPost,
discussionRenamed: DiscussionRenamedPost,
};
}
view() {
let lastTime;
@@ -45,7 +59,7 @@ export default class PostStream extends Component {
if (post) {
const time = post.createdAt();
const PostComponent = app.postComponents[post.contentType()];
const PostComponent = this.postComponents()[post.contentType()];
content = PostComponent ? PostComponent.component({ post }) : '';
attrs.key = 'post' + post.id();

View File

@@ -123,10 +123,10 @@ export default class PostStreamScrubber extends Component {
this.indexStart = 0;
this.$('.Scrubber-handle')
.bind('mousedown touchstart', this.onmousedown.bind(this))
.on('mousedown touchstart', this.onmousedown.bind(this))
// Exempt the scrollbar handle from the 'jump to' click event.
.click((e) => e.stopPropagation());
.on('click', e => e.stopPropagation());
// When the mouse moves and when it is released, we pass the
// information that we captured when the mouse was first pressed onto

View File

@@ -1,10 +1,11 @@
import UserPage from './UserPage';
import LoadingIndicator from '../../common/components/LoadingIndicator';
import Button from '../../common/components/Button';
import Link from '../../common/components/Link';
import Placeholder from '../../common/components/Placeholder';
import CommentPost from './CommentPost';
const UserPage = (await import(/* webpackChunkName: "forum/components/UserPage" */ './UserPage')).default;
/**
* The `PostsUserPage` component shows a user's activity feed inside of their
* profile.

View File

@@ -1,13 +1,12 @@
import UserPage from './UserPage';
import ItemList from '../../common/utils/ItemList';
import Switch from '../../common/components/Switch';
import Button from '../../common/components/Button';
import FieldSet from '../../common/components/FieldSet';
import NotificationGrid from './NotificationGrid';
import ChangePasswordModal from './ChangePasswordModal';
import ChangeEmailModal from './ChangeEmailModal';
import listItems from '../../common/helpers/listItems';
const UserPage = (await import(/* webpackChunkName: "forum/components/UserPage" */ './UserPage')).default;
/**
* The `SettingsPage` component displays the user's settings control panel, in
* the context of their user profile.
@@ -57,6 +56,9 @@ export default class SettingsPage extends UserPage {
accountItems() {
const items = new ItemList();
const ChangeEmailModal = () => import(/* webpackChunkName: "forum/components/ChangeEmailModal" */ './ChangeEmailModal');
const ChangePasswordModal = () => import(/* webpackChunkName: "forum/components/ChangePasswordModal" */ './ChangePasswordModal');
items.add(
'changePassword',
<Button className="Button" onclick={() => app.modal.show(ChangePasswordModal)}>

View File

@@ -1,5 +1,4 @@
import Modal from '../../common/components/Modal';
import LogInModal from './LogInModal';
import Button from '../../common/components/Button';
import LogInButtons from './LogInButtons';
import extractText from '../../common/utils/extractText';
@@ -138,6 +137,8 @@ export default class SignUpModal extends Modal {
* @public
*/
logIn() {
const LogInModal = () => import(/* webpackChunkName: "forum/components/LogInModal" */ './LogInModal');
const attrs = {
identification: this.email() || this.username(),
password: this.password(),

Some files were not shown because too many files have changed in this diff Show More