diff --git a/extend.php b/extend.php index 2498710..14cf3f4 100644 --- a/extend.php +++ b/extend.php @@ -12,7 +12,9 @@ namespace Blomstra\FlagDuplicates; use Blomstra\FlagDuplicates\Post\DiscussionFlaggedAsDuplicatePost; +use Flarum\Api\Controller\ListDiscussionsController; use Flarum\Api\Controller\ShowDiscussionController; +use Flarum\Api\Serializer\DiscussionSerializer; use Flarum\Extend; use Flarum\Flags\Event\Created as FlagCreated; use Flarum\Flags\Event\Deleting as FlagDeleting; @@ -38,4 +40,7 @@ (new Extend\ApiController(ShowDiscussionController::class)) ->addInclude('firstPost'), + + (new Extend\ApiSerializer(DiscussionSerializer::class)) + ->attribute('canFlagDuplicate', Api\AddCanFlagDuplicateAttribute::class), ]; diff --git a/js/dist/forum.js b/js/dist/forum.js index 5972e44..0122e75 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={195:(t,e,r)=>{t.exports=r(236)},236:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,a=Object.create(o.prototype),i=new O(n||[]);return a._invoke=function(t,e,r){var n=f;return function(o,a){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw a;return S()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=E(i,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=l(t,e,r);if("normal"===c.type){if(n=r.done?h:p,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(t,r,i),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function v(){}function g(){}function y(){}var b={};c(b,a,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(j([])));x&&x!==r&&n.call(x,a)&&(b=x);var _=y.prototype=v.prototype=Object.create(b);function D(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,a,i,s){var c=l(t[o],t,a);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,i,s)}),(function(t){r("throw",t,i,s)})):e.resolve(f).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,s)}))}s(c.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function j(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:j(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n);const t=flarum.core.compat["forum/app"];var e=r.n(t);function o(t,e,r,n,o,a,i){try{var s=t[a](i),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,a(t,e)}var s=r(195),c=r.n(s);const u=flarum.core.compat["forum/components/EventPost"];var l=r.n(u);const f=flarum.core.compat["common/components/LoadingIndicator"];var p=r.n(f);const d=flarum.core.compat["common/components/Link"];var h=r.n(d),v=function(t){function r(){return t.apply(this,arguments)||this}i(r,t);var n=r.prototype;return n.oninit=function(e){var r=this;t.prototype.oninit.call(this,e),this.subtree.check((function(){var t;return null==(t=r.dupe)?void 0:t.freshness}),(function(){return r.dupeFail}))},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.loadDupe()},n.icon=function(){return"fas fa-flag"},n.descriptionKey=function(){return"blomstra-flag-duplicates.forum.post_stream.flagged_duplicate_text"},n.descriptionData=function(){var t={};return t.duplicate=this.dupe?m(h(),{href:e().route.discussion(this.dupe)},this.dupe.title()):this.dupeFail?m("code",null,e().translator.trans("blomstra-flag-duplicates.forum.post_stream.deleted_discussion")):m(p(),{size:"small",display:"inline"}),t},n.loadDupe=function(){var t,r=(t=c().mark((function t(){var r,n=this;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.attrs.post.content(),t.prev=1,t.next=4,e().store.find("discussions",r,{},{errorHandler:function(){n.dupeFail=!0,m.redraw()}});case 4:this.dupe=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),this.dupeFail=!0;case 10:m.redraw();case 11:case"end":return t.stop()}}),t,this,[[1,7]])})),function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(t){o(i,n,a,s,c,"next",t)}function c(t){o(i,n,a,s,c,"throw",t)}s(void 0)}))});return function(){return r.apply(this,arguments)}}(),r}(l());const g=flarum.core.compat["common/extend"],y=flarum.core.compat["flags/forum/components/FlagPostModal"];var b=r.n(y);const w=flarum.core.compat["forum/components/Post"];var x=r.n(w);const _=flarum.core.compat["common/helpers/icon"];var D=r.n(_);const L=flarum.extensions["fof-merge-discussions"],E=flarum.core.compat["common/components/Button"];var P=r.n(E);const k=flarum.core.compat["forum/utils/DiscussionControls"];var O=r.n(k);const j=flarum.core.compat["common/Component"];var S=r.n(j);const F=flarum.core.compat["common/utils/withAttr"];var N=r.n(F);const T=flarum.core.compat["forum/states/GlobalSearchState"];var G=r.n(T),M=function(t){function r(){for(var e,r=arguments.length,n=new Array(r),o=0;o{var t={195:(t,e,r)=>{t.exports=r(236)},236:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,a=Object.create(o.prototype),i=new O(n||[]);return a._invoke=function(t,e,r){var n=f;return function(o,a){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw a;return S()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=E(i,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=l(t,e,r);if("normal"===c.type){if(n=r.done?h:p,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(t,r,i),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function v(){}function g(){}function y(){}var b={};c(b,a,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(j([])));x&&x!==r&&n.call(x,a)&&(b=x);var _=y.prototype=v.prototype=Object.create(b);function D(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,a,i,s){var c=l(t[o],t,a);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,i,s)}),(function(t){r("throw",t,i,s)})):e.resolve(f).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,s)}))}s(c.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function j(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:j(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n);const t=flarum.core.compat["forum/app"];var e=r.n(t);function o(t,e,r,n,o,a,i){try{var s=t[a](i),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,a(t,e)}var s=r(195),c=r.n(s);const u=flarum.core.compat["forum/components/EventPost"];var l=r.n(u);const f=flarum.core.compat["common/components/LoadingIndicator"];var p=r.n(f);const d=flarum.core.compat["common/components/Link"];var h=r.n(d),v=function(t){function r(){return t.apply(this,arguments)||this}i(r,t);var n=r.prototype;return n.oninit=function(e){var r=this;t.prototype.oninit.call(this,e),this.subtree.check((function(){var t;return null==(t=r.dupe)?void 0:t.freshness}),(function(){return r.dupeFail}))},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.loadDupe()},n.icon=function(){return"fas fa-flag"},n.descriptionKey=function(){return"blomstra-flag-duplicates.forum.post_stream.flagged_duplicate_text"},n.descriptionData=function(){var t={};return t.duplicate=this.dupe?m(h(),{href:e().route.discussion(this.dupe)},this.dupe.title()):this.dupeFail?m("code",null,e().translator.trans("blomstra-flag-duplicates.forum.post_stream.deleted_discussion")):m(p(),{size:"small",display:"inline"}),t},n.loadDupe=function(){var t,r=(t=c().mark((function t(){var r,n=this;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.attrs.post.content(),t.prev=1,t.next=4,e().store.find("discussions",r,{},{errorHandler:function(){n.dupeFail=!0,m.redraw()}});case 4:this.dupe=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),this.dupeFail=!0;case 10:m.redraw();case 11:case"end":return t.stop()}}),t,this,[[1,7]])})),function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(t){o(i,n,a,s,c,"next",t)}function c(t){o(i,n,a,s,c,"throw",t)}s(void 0)}))});return function(){return r.apply(this,arguments)}}(),r}(l());const g=flarum.core.compat["common/extend"],y=flarum.core.compat["flags/forum/components/FlagPostModal"];var b=r.n(y);const w=flarum.core.compat["forum/components/Post"];var x=r.n(w);const _=flarum.core.compat["common/helpers/icon"];var D=r.n(_);const L=flarum.extensions["fof-merge-discussions"],E=flarum.core.compat["common/components/Button"];var P=r.n(E);const k=flarum.core.compat["forum/utils/DiscussionControls"];var O=r.n(k);const j=flarum.core.compat["common/Component"];var S=r.n(j);const F=flarum.core.compat["common/utils/withAttr"];var N=r.n(F);const T=flarum.core.compat["forum/states/GlobalSearchState"];var G=r.n(T),M=function(t){function r(){for(var e,r=arguments.length,n=new Array(r),o=0;o result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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.core.compat['forum/app'];","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/EventPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","import app from 'flarum/forum/app';\nimport EventPost from 'flarum/forum/components/EventPost';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Link from 'flarum/common/components/Link';\n\nexport default class DiscussionFlaggedDuplicatePost extends EventPost {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.subtree.check(\n () => this.dupe?.freshness,\n () => this.dupeFail\n );\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.loadDupe();\n }\n\n icon() {\n return 'fas fa-flag';\n }\n\n descriptionKey() {\n return 'blomstra-flag-duplicates.forum.post_stream.flagged_duplicate_text';\n }\n\n descriptionData() {\n const data = {};\n\n data.duplicate = this.dupe ? (\n {this.dupe.title()}\n ) : this.dupeFail ? (\n {app.translator.trans('blomstra-flag-duplicates.forum.post_stream.deleted_discussion')}\n ) : (\n \n );\n\n return data;\n }\n\n async loadDupe() {\n const dupeId = this.attrs.post.content();\n\n try {\n this.dupe = await app.store.find(\n 'discussions',\n dupeId,\n {},\n {\n errorHandler: () => {\n this.dupeFail = true;\n m.redraw();\n },\n }\n );\n } catch {\n this.dupeFail = true;\n }\n\n m.redraw();\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['flags/forum/components/FlagPostModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.extensions['fof-merge-discussions'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/withAttr'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/states/GlobalSearchState'];","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport { components } from '@fof-merge-discussions';\nimport Button from 'flarum/common/components/Button';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Stream from 'flarum/common/utils/Stream';\nimport GlobalSearchState from 'flarum/forum/states/GlobalSearchState';\nimport type Mithril from 'mithril';\n\ninterface IAttrs {\n discussion: Discussion;\n reason: Stream;\n reasonDetail: Stream;\n}\n\ninterface IState {\n selectedDiscussion: Discussion | null;\n}\n\nexport default class DiscussionSearch extends Component {\n search!: GlobalSearchState;\n\n oninit(vnode: Mithril.Vnode): void {\n super.oninit(vnode);\n\n this.state = {\n selectedDiscussion: null,\n };\n }\n\n oncreate(vnode: Mithril.VnodeDOM): void {\n super.oncreate(vnode);\n }\n\n view(): Mithril.Children {\n const discussion = this.attrs.discussion;\n this.search = new GlobalSearchState();\n\n\n return (\n \n );\n }\n}\n","import app from 'flarum/forum/app';\nimport DiscussionFlaggedDuplicatePost from './components/DiscussionFlaggedDuplicatePost';\nimport extendFlagModal from './extendFlagModal';\n\napp.initializers.add('blomstra/flag-duplicates', () => {\n app.postComponents.discussionFlaggedDuplicate = DiscussionFlaggedDuplicatePost;\n extendFlagModal();\n});\n","import app from 'flarum/forum/app';\nimport { extend, override } from 'flarum/common/extend';\nimport FlagPostModal from 'flarum/flags/forum/components/FlagPostModal';\nimport Post from 'flarum/forum/components/Post';\nimport Link from 'flarum/common/components/Link';\nimport type Mithril from 'mithril';\nimport icon from 'flarum/common/helpers/icon';\nimport { components } from '@fof-merge-discussions';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Flag from 'flarum/flags/forum/models/Flag';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport DiscussionSearch from './components/DiscussionSearch';\n\nexport default function extendFlagModal() {\n extend(FlagPostModal.prototype, 'flagReasons', function (this: FlagPostModal, items: ItemList) {\n if (this.attrs.post?.number() !== 1 || this.success) return;\n\n const discussion = this.attrs.post.discussion();\n\n items.add('duplicate', , 100);\n });\n\n // Only required until https://github.com/flarum/core/pull/3260 is merged.\n extend(FlagPostModal.prototype, ['oncreate', 'onupdate'], function () {\n if (this.attrs.post?.number() !== 1) return;\n\n this.$('.Search-clear').attr('type', 'button');\n this.$('.Button[type=submit]').prop('disabled', (this.reason() === 'duplicate' && !this.reasonDetail()) || !this.reason());\n });\n\n extend(Post.prototype, 'flagActionItems', function (items: ItemList) {\n const flags = this.attrs.post?.flags?.();\n\n // If (at least) one of the flags here is `duplicate`, then we'll remove the `Delete` button and replace it with a `Merge` button.\n if (flags.some((flag: Flag) => flag?.reason?.() === 'duplicate')) {\n const discussion = this.attrs.post.discussion();\n\n items.remove('controls');\n items.add(\n 'merge',\n {\n app.modal.show(components.DiscussionMergeModal, { discussion, preselect: this.dupeDiscussion });\n }}\n >\n {app.translator.trans('fof-merge-discussions.forum.discussion.merge')}\n ,\n 5\n );\n }\n });\n\n override(Post.prototype, 'flagReason', function (original, flag: Flag) {\n const orig = original(flag);\n\n console.log(this.dupeDiscussion);\n\n if (flag?.reason?.() === 'duplicate') {\n if (this.dupeDiscussion === null) {\n orig[1] = (\n {app.translator.trans('blomstra-flag-duplicates.forum.flags.reason_discussion_deleted')}\n );\n\n return orig;\n }\n\n if (this.flagsLoading || !this.dupeDiscussion) {\n orig[1] = (\n \n \n \n );\n\n return orig;\n }\n\n const url = app.route.discussion(this.dupeDiscussion);\n\n orig[1] = (\n \n \n {this.dupeDiscussion.title() || app.translator.trans('blomstra-flag-duplicates.forum.flags.duplicate_discussion')}{' '}\n {icon('fas fa-external-link-alt')}{' '}\n \n \n );\n return orig;\n } else {\n return orig;\n }\n });\n\n extend(Post.prototype, 'oninit', function (this: Post) {\n this.subtree?.check(\n () => this.dupeDiscussion?.freshness,\n () => this.dupeDiscussion\n );\n });\n\n extend(Post.prototype, ['oninit', 'onupdate'], function (this: Post, vnode: Mithril.Vnode) {\n const flags = this.attrs.post?.flags?.();\n\n if (flags) {\n this.flagsLoading = true;\n\n flags.map((flag: Flag) => {\n if (flag?.reason?.() === 'duplicate') {\n const inStoreDiscussion = app.store.getById('discussion', flag.reasonDetail());\n\n if (inStoreDiscussion) {\n this.dupeDiscussion = inStoreDiscussion;\n } else {\n app.store\n .find(\n 'discussions',\n flag.reasonDetail(),\n {},\n {\n errorHandler: () => {\n this.dupeDiscussion = null;\n m.redraw();\n },\n }\n )\n .then((discussion: Discussion) => {\n this.dupeDiscussion = discussion;\n m.redraw();\n });\n }\n }\n });\n this.flagsLoading = false;\n }\n });\n\n extend(DiscussionControls, 'userControls', function (items: ItemList, discussion: Discussion) {\n const post = discussion.firstPost();\n if (!post || post.isHidden() || post.contentType() !== 'comment' || !post.canFlag()) return;\n\n items.add(\n 'flag-dupe',\n ,\n 0\n );\n });\n}\n"],"names":["module","exports","runtime","undefined","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","state","GenStateSuspendedStart","method","arg","GenStateExecuting","Error","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","done","GenStateSuspendedYield","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","invoke","resolve","reject","result","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","globalThis","Function","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","o","get","prop","r","flarum","core","compat","asyncGeneratorStep","gen","_next","_throw","_setPrototypeOf","p","_inheritsLoose","subClass","superClass","DiscussionFlaggedDuplicatePost","oninit","vnode","subtree","check","dupe","freshness","dupeFail","oncreate","loadDupe","icon","descriptionKey","descriptionData","data","duplicate","href","app","discussion","title","trans","size","display","dupeId","attrs","post","content","find","errorHandler","m","redraw","args","arguments","apply","EventPost","extensions","DiscussionSearch","search","selectedDiscussion","view","GlobalSearchState","className","checked","reason","onclick","withAttr","class","components","onSelect","reasonDetail","id","bind","ignore","Component","add","discussionFlaggedDuplicate","extend","FlagPostModal","items","number","success","$","attr","Post","flags","some","flag","remove","disabled","dupeDiscussion","show","DiscussionMergeModal","preselect","override","original","orig","console","log","flagsLoading","url","external","target","map","inStoreDiscussion","getById","DiscussionControls","firstPost","isHidden","contentType","canFlag"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"2BAAAA,EAAOC,QAAU,EAAjBD,I,UCOA,IAAIE,EAAW,SAAUD,GACvB,aAEA,IAEIE,EAFAC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,CAAC,EACnDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,gBAE/C,SAASC,EAAOC,EAAKC,EAAKC,GAOxB,OANAf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC,MAAOA,EACPE,YAAY,EACZC,cAAc,EACdC,UAAU,IAELN,EAAIC,EACZ,CACD,IAEEF,EAAO,CAAC,EAAG,GACZ,CAAC,MAAOQ,GACPR,EAAS,SAASC,EAAKC,EAAKC,GAC1B,OAAOF,EAAIC,GAAOC,CACnB,CACF,CAED,SAASM,EAAKC,EAASC,EAASC,EAAMC,GAEpC,IAAIC,EAAiBH,GAAWA,EAAQt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3C,KAAK,cAAciC,QAAS,kBAAM3B,IAAAA,MAAUwD,KAAKb,IAAe,CAAEnC,KAAAA,GAAtC,GACjCR,IAAAA,WAAeG,MAAM,iDAExB,EAEH,GD7IF,G","sources":["webpack://@blomstra/flag-duplicates/./node_modules/@babel/runtime/regenerator/index.js","webpack://@blomstra/flag-duplicates/./node_modules/regenerator-runtime/runtime.js","webpack://@blomstra/flag-duplicates/webpack/bootstrap","webpack://@blomstra/flag-duplicates/webpack/runtime/compat get default export","webpack://@blomstra/flag-duplicates/webpack/runtime/define property getters","webpack://@blomstra/flag-duplicates/webpack/runtime/hasOwnProperty shorthand","webpack://@blomstra/flag-duplicates/webpack/runtime/make namespace object","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['forum/app']\"","webpack://@blomstra/flag-duplicates/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://@blomstra/flag-duplicates/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@blomstra/flag-duplicates/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['forum/components/EventPost']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/components/Link']\"","webpack://@blomstra/flag-duplicates/./src/forum/components/DiscussionFlaggedDuplicatePost.js","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/extend']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['flags/forum/components/FlagPostModal']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['forum/components/Post']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@blomstra/flag-duplicates/external assign \"flarum.extensions['fof-merge-discussions']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/components/Button']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['forum/utils/DiscussionControls']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/Component']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/utils/withAttr']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['forum/states/GlobalSearchState']\"","webpack://@blomstra/flag-duplicates/./src/forum/components/DiscussionSearch.tsx","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/extenders']\"","webpack://@blomstra/flag-duplicates/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@blomstra/flag-duplicates/./src/forum/index.ts","webpack://@blomstra/flag-duplicates/./src/forum/extendFlagModal.tsx"],"sourcesContent":["module.exports = require(\"regenerator-runtime\");\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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.core.compat['forum/app'];","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/EventPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","import app from 'flarum/forum/app';\nimport EventPost from 'flarum/forum/components/EventPost';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Link from 'flarum/common/components/Link';\n\nexport default class DiscussionFlaggedDuplicatePost extends EventPost {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.subtree.check(\n () => this.dupe?.freshness,\n () => this.dupeFail\n );\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.loadDupe();\n }\n\n icon() {\n return 'fas fa-flag';\n }\n\n descriptionKey() {\n return 'blomstra-flag-duplicates.forum.post_stream.flagged_duplicate_text';\n }\n\n descriptionData() {\n const data = {};\n\n data.duplicate = this.dupe ? (\n {this.dupe.title()}\n ) : this.dupeFail ? (\n {app.translator.trans('blomstra-flag-duplicates.forum.post_stream.deleted_discussion')}\n ) : (\n \n );\n\n return data;\n }\n\n async loadDupe() {\n const dupeId = this.attrs.post.content();\n\n try {\n this.dupe = await app.store.find(\n 'discussions',\n dupeId,\n {},\n {\n errorHandler: () => {\n this.dupeFail = true;\n m.redraw();\n },\n }\n );\n } catch {\n this.dupeFail = true;\n }\n\n m.redraw();\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['flags/forum/components/FlagPostModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.extensions['fof-merge-discussions'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/withAttr'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/states/GlobalSearchState'];","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport { components } from '@fof-merge-discussions';\nimport Button from 'flarum/common/components/Button';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Stream from 'flarum/common/utils/Stream';\nimport GlobalSearchState from 'flarum/forum/states/GlobalSearchState';\nimport type Mithril from 'mithril';\n\ninterface IAttrs {\n discussion: Discussion;\n reason: Stream;\n reasonDetail: Stream;\n}\n\ninterface IState {\n selectedDiscussion: Discussion | null;\n}\n\nexport default class DiscussionSearch extends Component {\n search!: GlobalSearchState;\n\n oninit(vnode: Mithril.Vnode): void {\n super.oninit(vnode);\n\n this.state = {\n selectedDiscussion: null,\n };\n }\n\n oncreate(vnode: Mithril.VnodeDOM): void {\n super.oncreate(vnode);\n }\n\n view(): Mithril.Children {\n const discussion = this.attrs.discussion;\n this.search = new GlobalSearchState();\n\n\n return (\n \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","import app from 'flarum/forum/app';\nimport DiscussionFlaggedDuplicatePost from './components/DiscussionFlaggedDuplicatePost';\nimport extendFlagModal from './extendFlagModal';\nimport Extend from 'flarum/common/extenders';\nimport Discussion from 'flarum/common/models/Discussion';\n\napp.initializers.add('blomstra/flag-duplicates', () => {\n new Extend.Model(Discussion).attribute('canFlagDuplicate');\n\n app.postComponents.discussionFlaggedDuplicate = DiscussionFlaggedDuplicatePost;\n extendFlagModal();\n});\n","import app from 'flarum/forum/app';\nimport { extend, override } from 'flarum/common/extend';\nimport FlagPostModal from 'flarum/flags/forum/components/FlagPostModal';\nimport Post from 'flarum/forum/components/Post';\nimport Link from 'flarum/common/components/Link';\nimport type Mithril from 'mithril';\nimport icon from 'flarum/common/helpers/icon';\nimport { components } from '@fof-merge-discussions';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Flag from 'flarum/flags/forum/models/Flag';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport DiscussionSearch from './components/DiscussionSearch';\n\nexport default function extendFlagModal() {\n extend(FlagPostModal.prototype, 'flagReasons', function (this: FlagPostModal, items: ItemList) {\n if (this.attrs.post?.number() !== 1 || this.success) return;\n\n const discussion = this.attrs.post.discussion();\n\n items.add('duplicate', , 100);\n });\n\n // Only required until https://github.com/flarum/core/pull/3260 is merged.\n extend(FlagPostModal.prototype, ['oncreate', 'onupdate'], function () {\n if (this.attrs.post?.number() !== 1) return;\n\n this.$('.Search-clear').attr('type', 'button');\n this.$('.Button[type=submit]').prop('disabled', (this.reason() === 'duplicate' && !this.reasonDetail()) || !this.reason());\n });\n\n extend(Post.prototype, 'flagActionItems', function (items: ItemList) {\n const flags = this.attrs.post?.flags?.();\n\n // If (at least) one of the flags here is `duplicate`, then we'll remove the `Delete` button and replace it with a `Merge` button.\n if (flags.some((flag: Flag) => flag?.reason?.() === 'duplicate')) {\n const discussion = this.attrs.post.discussion();\n\n items.remove('controls');\n items.add(\n 'merge',\n {\n app.modal.show(components.DiscussionMergeModal, { discussion, preselect: this.dupeDiscussion });\n }}\n >\n {app.translator.trans('fof-merge-discussions.forum.discussion.merge')}\n ,\n 5\n );\n }\n });\n\n override(Post.prototype, 'flagReason', function (original, flag: Flag) {\n const orig = original(flag);\n\n console.log(this.dupeDiscussion);\n\n if (flag?.reason?.() === 'duplicate') {\n if (this.dupeDiscussion === null) {\n orig[1] = (\n {app.translator.trans('blomstra-flag-duplicates.forum.flags.reason_discussion_deleted')}\n );\n\n return orig;\n }\n\n if (this.flagsLoading || !this.dupeDiscussion) {\n orig[1] = (\n \n \n \n );\n\n return orig;\n }\n\n const url = app.route.discussion(this.dupeDiscussion);\n\n orig[1] = (\n \n \n {this.dupeDiscussion.title() || app.translator.trans('blomstra-flag-duplicates.forum.flags.duplicate_discussion')}{' '}\n {icon('fas fa-external-link-alt')}{' '}\n \n \n );\n return orig;\n } else {\n return orig;\n }\n });\n\n extend(Post.prototype, 'oninit', function (this: Post) {\n this.subtree?.check(\n () => this.dupeDiscussion?.freshness,\n () => this.dupeDiscussion\n );\n });\n\n extend(Post.prototype, ['oninit', 'onupdate'], function (this: Post, vnode: Mithril.Vnode) {\n const flags = this.attrs.post?.flags?.();\n\n if (flags) {\n this.flagsLoading = true;\n\n flags.map((flag: Flag) => {\n if (flag?.reason?.() === 'duplicate') {\n const inStoreDiscussion = app.store.getById('discussion', flag.reasonDetail());\n\n if (inStoreDiscussion) {\n this.dupeDiscussion = inStoreDiscussion;\n } else {\n app.store\n .find(\n 'discussions',\n flag.reasonDetail(),\n {},\n {\n errorHandler: () => {\n this.dupeDiscussion = null;\n m.redraw();\n },\n }\n )\n .then((discussion: Discussion) => {\n this.dupeDiscussion = discussion;\n m.redraw();\n });\n }\n }\n });\n this.flagsLoading = false;\n }\n });\n\n extend(DiscussionControls, 'userControls', function (items: ItemList, discussion: Discussion) {\n const post = discussion.firstPost();\n if (!post || post.isHidden() || post.contentType() !== 'comment' || !discussion.canFlagDuplicate()) return;\n\n items.add(\n 'flag-dupe',\n ,\n 0\n );\n });\n}\n"],"names":["module","exports","runtime","undefined","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","state","GenStateSuspendedStart","method","arg","GenStateExecuting","Error","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","done","GenStateSuspendedYield","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","invoke","resolve","reject","result","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","globalThis","Function","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","o","get","prop","r","flarum","core","compat","asyncGeneratorStep","gen","_next","_throw","_setPrototypeOf","p","_inheritsLoose","subClass","superClass","DiscussionFlaggedDuplicatePost","oninit","vnode","subtree","check","dupe","freshness","dupeFail","oncreate","loadDupe","icon","descriptionKey","descriptionData","data","duplicate","href","app","discussion","title","trans","size","display","dupeId","attrs","post","content","find","errorHandler","m","redraw","args","arguments","apply","EventPost","extensions","DiscussionSearch","search","selectedDiscussion","view","GlobalSearchState","className","checked","reason","onclick","withAttr","class","components","onSelect","reasonDetail","id","bind","ignore","Component","add","Extend","Discussion","attribute","discussionFlaggedDuplicate","extend","FlagPostModal","items","number","success","$","attr","Post","flags","some","flag","remove","disabled","dupeDiscussion","show","DiscussionMergeModal","preselect","override","original","orig","console","log","flagsLoading","url","external","target","map","inStoreDiscussion","getById","DiscussionControls","firstPost","isHidden","contentType","canFlagDuplicate"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/extendFlagModal.tsx b/js/src/forum/extendFlagModal.tsx index f84536d..9615dd0 100644 --- a/js/src/forum/extendFlagModal.tsx +++ b/js/src/forum/extendFlagModal.tsx @@ -141,7 +141,7 @@ export default function extendFlagModal() { extend(DiscussionControls, 'userControls', function (items: ItemList, discussion: Discussion) { const post = discussion.firstPost(); - if (!post || post.isHidden() || post.contentType() !== 'comment' || !post.canFlag()) return; + if (!post || post.isHidden() || post.contentType() !== 'comment' || !discussion.canFlagDuplicate()) return; items.add( 'flag-dupe', diff --git a/js/src/forum/index.ts b/js/src/forum/index.ts index 541f5ec..d9afbbf 100644 --- a/js/src/forum/index.ts +++ b/js/src/forum/index.ts @@ -1,8 +1,12 @@ import app from 'flarum/forum/app'; import DiscussionFlaggedDuplicatePost from './components/DiscussionFlaggedDuplicatePost'; import extendFlagModal from './extendFlagModal'; +import Extend from 'flarum/common/extenders'; +import Discussion from 'flarum/common/models/Discussion'; app.initializers.add('blomstra/flag-duplicates', () => { + new Extend.Model(Discussion).attribute('canFlagDuplicate'); + app.postComponents.discussionFlaggedDuplicate = DiscussionFlaggedDuplicatePost; extendFlagModal(); }); diff --git a/src/Api/AddCanFlagDuplicateAttribute.php b/src/Api/AddCanFlagDuplicateAttribute.php new file mode 100644 index 0000000..11cca6e --- /dev/null +++ b/src/Api/AddCanFlagDuplicateAttribute.php @@ -0,0 +1,27 @@ +postSerializer->setRequest($serializer->getRequest()); + + $gate = $this->gate; + + return $gate($this->postSerializer, $discussion->firstPost); + } +}