diff --git a/js/dist/forum.js b/js/dist/forum.js index fdccd6d..0068782 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var o={n:t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},d:(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},t={};(()=>{"use strict";o.r(t);const e=flarum.reg.get("core","common/extend"),r=flarum.reg.get("core","forum/app");var a=o.n(r);const n=flarum.reg.get("core","common/models/Discussion");var p=o.n(n);const s=flarum.reg.get("core","common/models/Post");var i=o.n(s);const c=flarum.reg.get("core","common/components/Badge");var u=o.n(c);const l=flarum.reg.get("core","forum/components/DiscussionListItem");var d=o.n(l);const v=flarum.reg.get("core","forum/components/Post");var f=o.n(v);const g=flarum.reg.get("core","forum/components/CommentPost");var A=o.n(g);const y=flarum.reg.get("core","common/components/Button");var b=o.n(y);const h=flarum.reg.get("core","forum/utils/PostControls");var _=o.n(h);a().initializers.add("flarum-approval",(()=>{p().prototype.isApproved=p().attribute("isApproved"),(0,e.extend)(p().prototype,"badges",(function(o){this.isApproved()||o.has("hidden")||o.add("awaitingApproval",m(u(),{type:"awaitingApproval",icon:"fas fa-gavel",label:a().translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),i().prototype.isApproved=i().attribute("isApproved"),i().prototype.canApprove=i().attribute("canApprove"),(0,e.extend)(d().prototype,"elementAttrs",(function(o){this.attrs.discussion.isApproved()||(o.className+=" DiscussionListItem--unapproved")})),(0,e.extend)(f().prototype,"elementAttrs",(function(o){this.attrs.post.isApproved()||(o.className+=" Post--unapproved")})),(0,e.extend)(A().prototype,"headerItems",(function(o){this.attrs.post.isApproved()||this.attrs.post.isHidden()||o.add("unapproved",a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),(0,e.override)(f().prototype,"flagReason",(function(o,t){return"approval"===t.type()?a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):o(t)})),(0,e.extend)(_(),"destructiveControls",(function(o,t){!t.isApproved()&&t.canApprove()&&o.add("approve",m(b(),{icon:"fas fa-check",onclick:_().approveAction.bind(t)},a().translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),_().approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)})(),module.exports=t})(); +(()=>{var t={n:o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return t.d(r,{a:r}),r},d:(o,r)=>{for(var e in r)t.o(r,e)&&!t.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:r[e]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o)};(()=>{"use strict";const o=flarum.reg.get("core","common/extend"),r=flarum.reg.get("core","forum/app");var e=t.n(r);const a=flarum.reg.get("core","common/models/Discussion");var n=t.n(a);const p=flarum.reg.get("core","common/models/Post");var s=t.n(p);const i=flarum.reg.get("core","common/components/Badge");var c=t.n(i);const u=flarum.reg.get("core","forum/components/DiscussionListItem");var l=t.n(u);const d=flarum.reg.get("core","forum/components/Post");var v=t.n(d);const f=flarum.reg.get("core","forum/components/CommentPost");var g=t.n(f);const A=flarum.reg.get("core","common/components/Button");var h=t.n(A);const b=flarum.reg.get("core","forum/utils/PostControls");var y=t.n(b);e().initializers.add("flarum-approval",(()=>{n().prototype.isApproved=n().attribute("isApproved"),(0,o.extend)(n().prototype,"badges",(function(t){this.isApproved()||t.has("hidden")||t.add("awaitingApproval",m(c(),{type:"awaitingApproval",icon:"fas fa-gavel",label:e().translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),s().prototype.isApproved=s().attribute("isApproved"),s().prototype.canApprove=s().attribute("canApprove"),(0,o.extend)(l().prototype,"elementAttrs",(function(t){this.attrs.discussion.isApproved()||(t.className+=" DiscussionListItem--unapproved")})),(0,o.extend)(v().prototype,"elementAttrs",(function(t){this.attrs.post.isApproved()||(t.className+=" Post--unapproved")})),(0,o.extend)(g().prototype,"headerItems",(function(t){this.attrs.post.isApproved()||this.attrs.post.isHidden()||t.add("unapproved",e().translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),(0,o.override)(v().prototype,"flagReason",(function(t,o){return"approval"===o.type()?e().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):t(o)})),(0,o.extend)(y(),"destructiveControls",(function(t,o){!o.isApproved()&&o.canApprove()&&t.add("approve",m(h(),{icon:"fas fa-check",onclick:y().approveAction.bind(o)},e().translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),y().approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)})(),module.exports={}})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 3cc5b08..e8cf338 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,iBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,sB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,2B,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,uC,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,yB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,gC,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,4B,aCU5D,iBAAiBW,IAAI,mBAAmB,KACtC,cAAqBC,WAAa,cAAqB,eACvD,IAAAC,QAAO,cAAsB,UAAU,SAAUC,GAC1CC,KAAKH,cAAiBE,EAAME,IAAI,WACnCF,EAAMH,IAAI,mBAAoBM,EAAE,IAAO,CACrCC,KAAM,mBACNC,KAAM,eACNC,MAAO,eAAeC,MAAM,2DAGlC,IACA,cAAeT,WAAa,cAAe,cAC3C,cAAeU,WAAa,cAAe,eAC3C,IAAAT,QAAO,cAA8B,gBAAgB,SAAUU,GACxDR,KAAKQ,MAAMC,WAAWZ,eACzBW,EAAME,WAAa,kCAEvB,KACA,IAAAZ,QAAO,cAAyB,gBAAgB,SAAUU,GACnDR,KAAKQ,MAAMG,KAAKd,eACnBW,EAAME,WAAa,oBAEvB,KACA,IAAAZ,QAAO,cAAuB,eAAe,SAAUC,GAChDC,KAAKQ,MAAMG,KAAKd,cAAiBG,KAAKQ,MAAMG,KAAKC,YACpDb,EAAMH,IAAI,aAAc,eAAeU,MAAM,qDAEjD,KACA,IAAAO,UAAS,cAAyB,cAAc,SAAUC,EAAUC,GAClE,MAAoB,aAAhBA,EAAKZ,OACA,eAAeG,MAAM,qDAEvBQ,EAASC,EAClB,KACA,IAAAjB,QAAO,IAAc,uBAAuB,SAAUC,EAAOY,IACtDA,EAAKd,cAAgBc,EAAKJ,cAC7BR,EAAMH,IAAI,UAAWM,EAAE,IAAQ,CAC7BE,KAAM,eACNY,QAAS,kBAA2BC,KAAKN,IACxC,eAAeL,MAAM,uDAAwD,GAEpF,IACA,kBAA6B,WAC3BN,KAAKkB,KAAK,CACRrB,YAAY,IAEQ,IAAlBG,KAAKmB,UACPnB,KAAKS,aAAaW,eAAe,CAC/BvB,YAAY,GAGlB,CAAC,IACC,G","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/webpack/runtime/make namespace object","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/models/Discussion')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/models/Post')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/components/Badge')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/DiscussionListItem')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/Post')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/CommentPost')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/utils/PostControls')\"","webpack://@flarum/approval/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Discussion');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Badge');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionListItem');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/CommentPost');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/PostControls');","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Post from 'flarum/common/models/Post';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport PostComponent from 'flarum/forum/components/Post';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Button from 'flarum/common/components/Button';\nimport PostControls from 'flarum/forum/utils/PostControls';\napp.initializers.add('flarum-approval', () => {\n Discussion.prototype.isApproved = Discussion.attribute('isApproved');\n extend(Discussion.prototype, 'badges', function (items) {\n if (!this.isApproved() && !items.has('hidden')) {\n items.add('awaitingApproval', m(Badge, {\n type: \"awaitingApproval\",\n icon: \"fas fa-gavel\",\n label: app.translator.trans('flarum-approval.forum.badge.awaiting_approval_tooltip')\n }));\n }\n });\n Post.prototype.isApproved = Post.attribute('isApproved');\n Post.prototype.canApprove = Post.attribute('canApprove');\n extend(DiscussionListItem.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.discussion.isApproved()) {\n attrs.className += ' DiscussionListItem--unapproved';\n }\n });\n extend(PostComponent.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.post.isApproved()) {\n attrs.className += ' Post--unapproved';\n }\n });\n extend(CommentPost.prototype, 'headerItems', function (items) {\n if (!this.attrs.post.isApproved() && !this.attrs.post.isHidden()) {\n items.add('unapproved', app.translator.trans('flarum-approval.forum.post.awaiting_approval_text'));\n }\n });\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'approval') {\n return app.translator.trans('flarum-approval.forum.post.awaiting_approval_text');\n }\n return original(flag);\n });\n extend(PostControls, 'destructiveControls', function (items, post) {\n if (!post.isApproved() && post.canApprove()) {\n items.add('approve', m(Button, {\n icon: \"fas fa-check\",\n onclick: PostControls.approveAction.bind(post)\n }, app.translator.trans('flarum-approval.forum.post_controls.approve_button')), 10);\n }\n });\n PostControls.approveAction = function () {\n this.save({\n isApproved: true\n });\n if (this.number() === 1) {\n this.discussion().pushAttributes({\n isApproved: true\n });\n }\n };\n}, -10); // set initializer priority to run after reports"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","add","isApproved","extend","items","this","has","m","type","icon","label","trans","canApprove","attrs","discussion","className","post","isHidden","override","original","flag","onclick","bind","save","number","pushAttributes"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,mBCAlF,MAAM,EAA+BI,OAAOC,IAAIP,IAAI,OAAQ,iBCAtD,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,sB,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,2B,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,uC,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,yB,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,gC,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,4B,aCU5D,iBAAiBQ,IAAI,mBAAmB,KACtC,cAAqBC,WAAa,cAAqB,eACvD,IAAAC,QAAO,cAAsB,UAAU,SAAUC,GAC1CC,KAAKH,cAAiBE,EAAME,IAAI,WACnCF,EAAMH,IAAI,mBAAoBM,EAAE,IAAO,CACrCC,KAAM,mBACNC,KAAM,eACNC,MAAO,eAAeC,MAAM,2DAGlC,IACA,cAAeT,WAAa,cAAe,cAC3C,cAAeU,WAAa,cAAe,eAC3C,IAAAT,QAAO,cAA8B,gBAAgB,SAAUU,GACxDR,KAAKQ,MAAMC,WAAWZ,eACzBW,EAAME,WAAa,kCAEvB,KACA,IAAAZ,QAAO,cAAyB,gBAAgB,SAAUU,GACnDR,KAAKQ,MAAMG,KAAKd,eACnBW,EAAME,WAAa,oBAEvB,KACA,IAAAZ,QAAO,cAAuB,eAAe,SAAUC,GAChDC,KAAKQ,MAAMG,KAAKd,cAAiBG,KAAKQ,MAAMG,KAAKC,YACpDb,EAAMH,IAAI,aAAc,eAAeU,MAAM,qDAEjD,KACA,IAAAO,UAAS,cAAyB,cAAc,SAAUC,EAAUC,GAClE,MAAoB,aAAhBA,EAAKZ,OACA,eAAeG,MAAM,qDAEvBQ,EAASC,EAClB,KACA,IAAAjB,QAAO,IAAc,uBAAuB,SAAUC,EAAOY,IACtDA,EAAKd,cAAgBc,EAAKJ,cAC7BR,EAAMH,IAAI,UAAWM,EAAE,IAAQ,CAC7BE,KAAM,eACNY,QAAS,kBAA2BC,KAAKN,IACxC,eAAeL,MAAM,uDAAwD,GAEpF,IACA,kBAA6B,WAC3BN,KAAKkB,KAAK,CACRrB,YAAY,IAEQ,IAAlBG,KAAKmB,UACPnB,KAAKS,aAAaW,eAAe,CAC/BvB,YAAY,GAGlB,CAAC,IACC,G","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/models/Discussion')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/models/Post')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/components/Badge')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/DiscussionListItem')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/Post')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/CommentPost')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/utils/PostControls')\"","webpack://@flarum/approval/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Discussion');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Badge');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionListItem');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/CommentPost');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/PostControls');","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Post from 'flarum/common/models/Post';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport PostComponent from 'flarum/forum/components/Post';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Button from 'flarum/common/components/Button';\nimport PostControls from 'flarum/forum/utils/PostControls';\napp.initializers.add('flarum-approval', () => {\n Discussion.prototype.isApproved = Discussion.attribute('isApproved');\n extend(Discussion.prototype, 'badges', function (items) {\n if (!this.isApproved() && !items.has('hidden')) {\n items.add('awaitingApproval', m(Badge, {\n type: \"awaitingApproval\",\n icon: \"fas fa-gavel\",\n label: app.translator.trans('flarum-approval.forum.badge.awaiting_approval_tooltip')\n }));\n }\n });\n Post.prototype.isApproved = Post.attribute('isApproved');\n Post.prototype.canApprove = Post.attribute('canApprove');\n extend(DiscussionListItem.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.discussion.isApproved()) {\n attrs.className += ' DiscussionListItem--unapproved';\n }\n });\n extend(PostComponent.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.post.isApproved()) {\n attrs.className += ' Post--unapproved';\n }\n });\n extend(CommentPost.prototype, 'headerItems', function (items) {\n if (!this.attrs.post.isApproved() && !this.attrs.post.isHidden()) {\n items.add('unapproved', app.translator.trans('flarum-approval.forum.post.awaiting_approval_text'));\n }\n });\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'approval') {\n return app.translator.trans('flarum-approval.forum.post.awaiting_approval_text');\n }\n return original(flag);\n });\n extend(PostControls, 'destructiveControls', function (items, post) {\n if (!post.isApproved() && post.canApprove()) {\n items.add('approve', m(Button, {\n icon: \"fas fa-check\",\n onclick: PostControls.approveAction.bind(post)\n }, app.translator.trans('flarum-approval.forum.post_controls.approve_button')), 10);\n }\n });\n PostControls.approveAction = function () {\n this.save({\n isApproved: true\n });\n if (this.number() === 1) {\n this.discussion().pushAttributes({\n isApproved: true\n });\n }\n };\n}, -10); // set initializer priority to run after reports"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","reg","add","isApproved","extend","items","this","has","m","type","icon","label","trans","canApprove","attrs","discussion","className","post","isHidden","override","original","flag","onclick","bind","save","number","pushAttributes"],"sourceRoot":""} \ No newline at end of file