framework/extensions/lock/js/dist/forum.js
flarum-bot 57af2ccf83 Bundled output for commit 4547a4416b
Includes transpiled JS/TS.

[skip ci]
2021-10-12 01:27:19 +00:00

2 lines
3.0 KiB
JavaScript

(()=>{var o={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return o.d(n,{a:n}),n},d:(t,n)=>{for(var c in n)o.o(n,c)&&!o.o(t,c)&&Object.defineProperty(t,c,{enumerable:!0,get:n[c]})},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 n=flarum.core.compat.extend,c=flarum.core.compat.app;var e=o.n(c);const r=flarum.core.compat.Model;var s=o.n(r);const a=flarum.core.compat["models/Discussion"];var i=o.n(a);const u=flarum.core.compat["components/NotificationGrid"];var l=o.n(u);function p(o,t){o.prototype=Object.create(t.prototype),o.prototype.constructor=o,o.__proto__=t}const f=flarum.core.compat["components/EventPost"];var d=function(o){function t(){return o.apply(this,arguments)||this}p(t,o);var n=t.prototype;return n.icon=function(){return this.attrs.post.content().locked?"fas fa-lock":"fas fa-unlock"},n.descriptionKey=function(){return this.attrs.post.content().locked?"flarum-lock.forum.post_stream.discussion_locked_text":"flarum-lock.forum.post_stream.discussion_unlocked_text"},t}(o.n(f)());const k=flarum.core.compat["components/Notification"];var y=function(o){function t(){return o.apply(this,arguments)||this}p(t,o);var n=t.prototype;return n.icon=function(){return"fas fa-lock"},n.href=function(){var o=this.attrs.notification;return app.route.discussion(o.subject(),o.content().postNumber)},n.content=function(){return app.translator.trans("flarum-lock.forum.notifications.discussion_locked_text",{user:this.attrs.notification.fromUser()})},t}(o.n(k)());const _=flarum.core.compat["components/Badge"];var b=o.n(_);const v=flarum.core.compat["utils/DiscussionControls"];var h=o.n(v);const L=flarum.core.compat["components/DiscussionPage"];var g=o.n(L);const x=flarum.core.compat["components/Button"];var j=o.n(x);e().initializers.add("flarum-lock",(function(){e().postComponents.discussionLocked=d,e().notificationComponents.discussionLocked=y,i().prototype.isLocked=s().attribute("isLocked"),i().prototype.canLock=s().attribute("canLock"),(0,n.extend)(i().prototype,"badges",(function(o){this.isLocked()&&o.add("locked",b().component({type:"locked",label:app.translator.trans("flarum-lock.forum.badge.locked_tooltip"),icon:"fas fa-lock"}))})),(0,n.extend)(h(),"moderationControls",(function(o,t){t.canLock()&&o.add("lock",j().component({icon:"fas fa-lock",onclick:this.lockAction.bind(t)},app.translator.trans(t.isLocked()?"flarum-lock.forum.discussion_controls.unlock_button":"flarum-lock.forum.discussion_controls.lock_button")))})),h().lockAction=function(){this.save({isLocked:!this.isLocked()}).then((function(){app.current.matches(g())&&app.current.get("stream").update(),m.redraw()}))},(0,n.extend)(l().prototype,"notificationTypes",(function(o){o.add("discussionLocked",{name:"discussionLocked",icon:"fas fa-lock",label:e().translator.trans("flarum-lock.forum.settings.notify_discussion_locked_label")})}))}))})(),module.exports=t})();
//# sourceMappingURL=forum.js.map