diff --git a/js/dist/forum.js b/js/dist/forum.js index adf09f9..7cc902d 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,7 +1,144 @@ /******/ (() => { // webpackBootstrap -/******/ // runtime can't be in strict mode because a global variable is assign and maybe created. /******/ var __webpack_modules__ = ({ +/***/ "./src/forum/cache.ts": +/*!****************************!*\ + !*** ./src/forum/cache.ts ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "FIFOCache": () => (/* binding */ FIFOCache), +/* harmony export */ "ResponseCache": () => (/* binding */ ResponseCache) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/models/Discussion */ "flarum/common/models/Discussion"); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_3__); + + +/* + * This file is part of club-1/flarum-ext-cross-references. + * + * Copyright (c) 2023 Nicolas Peugnet . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + + + +var FIFOCache = /*#__PURE__*/function () { + function FIFOCache(capacity) { + this.head = void 0; + this.tail = void 0; + this.data = new Map(); + this.capacity = void 0; + this.capacity = capacity; + } + var _proto = FIFOCache.prototype; + _proto.get = function get(key) { + return this.data.get(key); + }; + _proto.set = function set(key, value) { + if (this.data.size == this.capacity) { + var evicted = this.head; + this.data["delete"](evicted.key); + this.head = evicted.next; + } + var entry = { + key: key + }; + if (!this.head) { + this.head = entry; + } + if (!this.tail) { + this.tail = entry; + } else { + this.tail.next = entry; + this.tail = entry; + } + this.data.set(key, value); + return this; + }; + return FIFOCache; +}(); +function key(name, id) { + return name + id; +} +var ModelMap = {}; +ModelMap[(flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_2___default().name)] = 'discussions'; + +/** Empty function used to disable callbacks */ +function noop() {} +; +var ResponseCache = /*#__PURE__*/function () { + function ResponseCache() {} + ResponseCache.find = /*#__PURE__*/function () { + var _find = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee(m, id, options) { + var res; + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (options === void 0) { + options = {}; + } + if (!(this.responseErrors.get(key(m.name, id)) == true)) { + _context.next = 3; + break; + } + return _context.abrupt("return", null); + case 3: + _context.next = 5; + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_3___default().store.find(ModelMap[m.name], id, options, { + errorHandler: noop + })["catch"](noop); + case 5: + res = _context.sent; + if (!res) { + _context.next = 8; + break; + } + return _context.abrupt("return", res); + case 8: + this.responseErrors.set(key(m.name, id), true); + return _context.abrupt("return", null); + case 10: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + function find(_x, _x2, _x3) { + return _find.apply(this, arguments); + } + return find; + }(); + return ResponseCache; +}(); +ResponseCache.responseErrors = new FIFOCache(128); + +/***/ }), + /***/ "./src/forum/components/DiscussionId.js": /*!**********************************************!*\ !*** ./src/forum/components/DiscussionId.js ***! @@ -225,17 +362,20 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); /* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); -/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/forum/components/CommentPost */ "flarum/forum/components/CommentPost"); -/* harmony import */ var flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/forum/components/DiscussionHero */ "flarum/forum/components/DiscussionHero"); -/* harmony import */ var flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/forum/components/DiscussionListItem */ "flarum/forum/components/DiscussionListItem"); -/* harmony import */ var flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _components_DiscussionId__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/DiscussionId */ "./src/forum/components/DiscussionId.js"); -/* harmony import */ var _components_DiscussionLink__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/DiscussionLink */ "./src/forum/components/DiscussionLink.js"); -/* harmony import */ var _components_DiscussionReferencedPost__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/DiscussionReferencedPost */ "./src/forum/components/DiscussionReferencedPost.js"); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/models/Discussion */ "flarum/common/models/Discussion"); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/forum/components/CommentPost */ "flarum/forum/components/CommentPost"); +/* harmony import */ var flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/forum/components/DiscussionHero */ "flarum/forum/components/DiscussionHero"); +/* harmony import */ var flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! flarum/forum/components/DiscussionListItem */ "flarum/forum/components/DiscussionListItem"); +/* harmony import */ var flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _cache__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cache */ "./src/forum/cache.ts"); +/* harmony import */ var _components_DiscussionId__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/DiscussionId */ "./src/forum/components/DiscussionId.js"); +/* harmony import */ var _components_DiscussionLink__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/DiscussionLink */ "./src/forum/components/DiscussionLink.js"); +/* harmony import */ var _components_DiscussionReferencedPost__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/DiscussionReferencedPost */ "./src/forum/components/DiscussionReferencedPost.js"); /* * This file is part of club-1/flarum-ext-cross-references. * @@ -265,8 +405,10 @@ __webpack_require__.r(__webpack_exports__); -flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().initializers.add('club-1-cross-references', function (app) { - app.postComponents.discussionReferenced = _components_DiscussionReferencedPost__WEBPACK_IMPORTED_MODULE_7__["default"]; + + +flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().initializers.add('club-1-cross-references', function (app) { + app.postComponents.discussionReferenced = _components_DiscussionReferencedPost__WEBPACK_IMPORTED_MODULE_9__["default"]; addSourceLinkReplacement(); addDiscussionTitleId(); addDiscussionListId(); @@ -290,9 +432,9 @@ function addSourceLinkReplacement() { } if (a.text === a.href) { var discussionId = match[1]; - var discussion = flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.getById('discussions', discussionId); + var discussion = flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().store.getById('discussions', discussionId); var span = document.createElement('span'); - m.render(span, m(_components_DiscussionLink__WEBPACK_IMPORTED_MODULE_6__["default"], { + m.render(span, m(_components_DiscussionLink__WEBPACK_IMPORTED_MODULE_8__["default"], { discussion: discussion, href: a.href })); @@ -306,22 +448,22 @@ function addSourceLinkReplacement() { } }); } - (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2___default().prototype), 'oncreate', replaceSourceLinks); - (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2___default().prototype), 'onupdate', replaceSourceLinks); + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_3___default().prototype), 'oncreate', replaceSourceLinks); + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_3___default().prototype), 'onupdate', replaceSourceLinks); } /** * Extend DiscussionHero to add its ID in the title item. */ function addDiscussionTitleId() { - (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_3___default().prototype), 'items', function (items) { - if (!flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().forum.attribute('showDiscussionId')) { + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_4___default().prototype), 'items', function (items) { + if (!flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().forum.attribute('showDiscussionId')) { return; } var attrs = this.attrs; var discussionId = attrs.discussion.id(); var title = items.get('title'); - items.setContent('title', m('h2', [title.text, ' ', m(_components_DiscussionId__WEBPACK_IMPORTED_MODULE_5__["default"], { + items.setContent('title', m('h2', [title.text, ' ', m(_components_DiscussionId__WEBPACK_IMPORTED_MODULE_7__["default"], { discussionId: discussionId })])); }); @@ -331,22 +473,18 @@ function addDiscussionTitleId() { * Extend DiscussionListItem to add its ID as an item with a high priority. */ function addDiscussionListId() { - (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_4___default().prototype), 'infoItems', function (items) { - if (!flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().forum.attribute('showDiscussionId')) { + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_DiscussionListItem__WEBPACK_IMPORTED_MODULE_5___default().prototype), 'infoItems', function (items) { + if (!flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().forum.attribute('showDiscussionId')) { return; } var attrs = this.attrs; var discussionId = attrs.discussion.id(); - items.add('id', m(_components_DiscussionId__WEBPACK_IMPORTED_MODULE_5__["default"], { + items.add('id', m(_components_DiscussionId__WEBPACK_IMPORTED_MODULE_7__["default"], { discussionId: discussionId }), 90); }); } -/** Empty function used to disable callbacks */ -function noop() {} -; - /** * Extremely dirty hack to trigger a refresh of the composer preview * by inserting a ZeroWidthSpace at the beginning of the message and @@ -357,7 +495,7 @@ function noop() {} */ function refreshComposerPreview() { var _app$composer$fields; - var content = (_app$composer$fields = (flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().composer.fields)) == null ? void 0 : _app$composer$fields.content; + var content = (_app$composer$fields = (flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().composer.fields)) == null ? void 0 : _app$composer$fields.content; if (content) { content('​' + content()); setTimeout(function () { @@ -367,17 +505,17 @@ function refreshComposerPreview() { } function filterCrossReferences(tag) { var id = tag.getAttribute('id'); - var res = flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.getById('discussions', id); + var res = flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().store.getById('discussions', id); if (res) { var discussion = res; tag.setAttribute('title', discussion.title()); } else { - flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.find('discussions', id, {}, { - errorHandler: noop - }).then(refreshComposerPreview)["catch"](noop); + _cache__WEBPACK_IMPORTED_MODULE_6__.ResponseCache.find((flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_1___default()), id).then(function (d) { + if (d) refreshComposerPreview(); + }); return false; } - tag.setAttribute('comment', flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('club-1-cross-references.forum.comment')); + tag.setAttribute('comment', flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().translator.trans('club-1-cross-references.forum.comment')); } /***/ }), @@ -415,6 +553,17 @@ module.exports = flarum.core.compat['common/extend']; /***/ }), +/***/ "flarum/common/models/Discussion": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['common/models/Discussion']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/models/Discussion']; + +/***/ }), + /***/ "flarum/forum/app": /*!**************************************************!*\ !*** external "flarum.core.compat['forum/app']" ***! @@ -470,6 +619,414 @@ module.exports = flarum.core.compat['forum/components/EventPost']; /***/ }), +/***/ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***! + \*******************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); +function _regeneratorRuntime() { + "use strict"; + + /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + module.exports = _regeneratorRuntime = function _regeneratorRuntime() { + return exports; + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + var exports = {}, + Op = Object.prototype, + hasOwn = Op.hasOwnProperty, + defineProperty = Object.defineProperty || function (obj, key, desc) { + obj[key] = desc.value; + }, + $Symbol = "function" == typeof Symbol ? Symbol : {}, + iteratorSymbol = $Symbol.iterator || "@@iterator", + asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", + toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + function define(obj, key, value) { + return Object.defineProperty(obj, key, { + value: value, + enumerable: !0, + configurable: !0, + writable: !0 + }), obj[key]; + } + try { + define({}, ""); + } catch (err) { + define = function define(obj, key, value) { + return obj[key] = value; + }; + } + function wrap(innerFn, outerFn, self, tryLocsList) { + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, + generator = Object.create(protoGenerator.prototype), + context = new Context(tryLocsList || []); + return defineProperty(generator, "_invoke", { + value: makeInvokeMethod(innerFn, self, context) + }), generator; + } + function tryCatch(fn, obj, arg) { + try { + return { + type: "normal", + arg: fn.call(obj, arg) + }; + } catch (err) { + return { + type: "throw", + arg: err + }; + } + } + exports.wrap = wrap; + var ContinueSentinel = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var IteratorPrototype = {}; + define(IteratorPrototype, iteratorSymbol, function () { + return this; + }); + var getProto = Object.getPrototypeOf, + NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); + var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function (method) { + define(prototype, method, function (arg) { + return this._invoke(method, arg); + }); + }); + } + function AsyncIterator(generator, PromiseImpl) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if ("throw" !== record.type) { + var result = record.arg, + value = result.value; + return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { + invoke("next", value, resolve, reject); + }, function (err) { + invoke("throw", err, resolve, reject); + }) : PromiseImpl.resolve(value).then(function (unwrapped) { + result.value = unwrapped, resolve(result); + }, function (error) { + return invoke("throw", error, resolve, reject); + }); + } + reject(record.arg); + } + var previousPromise; + defineProperty(this, "_invoke", { + value: function value(method, arg) { + function callInvokeWithMethodAndArg() { + return new PromiseImpl(function (resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(innerFn, self, context) { + var state = "suspendedStart"; + return function (method, arg) { + if ("executing" === state) throw new Error("Generator is already running"); + if ("completed" === state) { + if ("throw" === method) throw arg; + return doneResult(); + } + for (context.method = method, context.arg = arg;;) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { + if ("suspendedStart" === state) throw state = "completed", context.arg; + context.dispatchException(context.arg); + } else "return" === context.method && context.abrupt("return", context.arg); + state = "executing"; + var record = tryCatch(innerFn, self, context); + if ("normal" === record.type) { + if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; + return { + value: record.arg, + done: context.done + }; + } + "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); + } + }; + } + function maybeInvokeDelegate(delegate, context) { + var methodName = context.method, + method = delegate.iterator[methodName]; + if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; + var record = tryCatch(method, delegate.iterator, context.arg); + if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; + var info = record.arg; + return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); + } + function pushTryEntry(locs) { + var entry = { + tryLoc: locs[0] + }; + 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); + } + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal", delete record.arg, entry.completion = record; + } + function Context(tryLocsList) { + this.tryEntries = [{ + tryLoc: "root" + }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); + } + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) return iteratorMethod.call(iterable); + if ("function" == typeof iterable.next) return iterable; + if (!isNaN(iterable.length)) { + var i = -1, + next = function next() { + for (; ++i < iterable.length;) { + if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; + } + return next.value = undefined, next.done = !0, next; + }; + return next.next = next; + } + } + return { + next: doneResult + }; + } + function doneResult() { + return { + value: undefined, + done: !0 + }; + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), defineProperty(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { + var ctor = "function" == typeof genFun && genFun.constructor; + return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); + }, exports.mark = function (genFun) { + return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; + }, exports.awrap = function (arg) { + return { + __await: arg + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { + return this; + }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { + void 0 === PromiseImpl && (PromiseImpl = Promise); + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { + return result.done ? result.value : iter.next(); + }); + }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { + return this; + }), define(Gp, "toString", function () { + return "[object Generator]"; + }), exports.keys = function (val) { + var object = Object(val), + keys = []; + for (var key in object) { + keys.push(key); + } + return keys.reverse(), function next() { + for (; keys.length;) { + var key = keys.pop(); + if (key in object) return next.value = key, next.done = !1, next; + } + return next.done = !0, next; + }; + }, exports.values = values, Context.prototype = { + constructor: Context, + reset: function reset(skipTempReset) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { + "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); + } + }, + stop: function stop() { + this.done = !0; + var rootRecord = this.tryEntries[0].completion; + if ("throw" === rootRecord.type) throw rootRecord.arg; + return this.rval; + }, + dispatchException: function dispatchException(exception) { + if (this.done) throw exception; + var context = this; + function handle(loc, caught) { + return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; + } + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i], + record = entry.completion; + if ("root" === entry.tryLoc) return handle("end"); + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"), + hasFinally = hasOwn.call(entry, "finallyLoc"); + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); + if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); + } else if (hasCatch) { + if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); + } else { + if (!hasFinally) throw new Error("try statement without catch or finally"); + if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); + } + } + } + }, + abrupt: function abrupt(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); + var record = finallyEntry ? finallyEntry.completion : {}; + return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); + }, + complete: function complete(record, afterLoc) { + if ("throw" === record.type) throw record.arg; + return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; + }, + finish: function finish(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; + } + }, + "catch": function _catch(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if ("throw" === record.type) { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(iterable, resultName, nextLoc) { + return this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }, "next" === this.method && (this.arg = undefined), ContinueSentinel; + } + }, exports; +} +module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/typeof.js": +/*!*******************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! + \*******************************************************/ +/***/ ((module) => { + +function _typeof(obj) { + "@babel/helpers - typeof"; + + return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj); +} +module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/regenerator/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@babel/runtime/regenerator/index.js ***! + \**********************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// TODO(Babel 8): Remove this file. + +var runtime = __webpack_require__(/*! ../helpers/regeneratorRuntime */ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js")(); +module.exports = runtime; + +// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + if (typeof globalThis === "object") { + globalThis.regeneratorRuntime = runtime; + } else { + Function("r", "regeneratorRuntime = r")(runtime); + } +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _asyncToGenerator) +/* harmony export */ }); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } +} +function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + _next(undefined); + }); + }; +} + +/***/ }), + /***/ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js": /*!******************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***! diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 5f1cd48..642564b 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEgD;AAAA,IAE3BC,YAAY;EAAA;EAAA;IAAA;EAAA;EAAA;EAAA,OAC/BC,IAAI,GAAJ,gBAAO;IACL,OAAO;MAAM,SAAM;IAAc,QAAG,IAAI,CAACC,KAAK,CAACC,YAAY,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AC,EAAEC,CAAC,EAAE;IACtGD,CAAC,CAACG,SAAS,GAAGF,CAAC;IACf,OAAOD,CAAC;EACV,CAAC;EACD,OAAOD,eAAe,CAACC,CAAC,EAAEC,CAAC,CAAC;AAC9B;;;;;;UCNA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D","sources":["webpack://@club-1/flarum-ext-cross-references/./src/forum/components/DiscussionId.js","webpack://@club-1/flarum-ext-cross-references/./src/forum/components/DiscussionLink.js","webpack://@club-1/flarum-ext-cross-references/./src/forum/components/DiscussionReferencedPost.js","webpack://@club-1/flarum-ext-cross-references/./src/forum/index.ts","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['common/Component']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['common/components/Link']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['common/extend']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/app']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/DiscussionHero']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/DiscussionListItem']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/EventPost']\"","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@club-1/flarum-ext-cross-references/webpack/bootstrap","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/compat get default export","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/define property getters","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/hasOwnProperty shorthand","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/make namespace object"],"sourcesContent":["/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport Component from \"flarum/common/Component\";\n\nexport default class DiscussionId extends Component {\n view() {\n return #{this.attrs.discussionId}\n }\n}\n","/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport app from 'flarum/forum/app';\nimport Link from 'flarum/common/components/Link';\nimport Component from 'flarum/common/Component';\nimport DiscussionId from './DiscussionId';\n\n\nexport default class DiscussionLink extends Link {\n view() {\n const discussion = this.attrs.discussion;\n const href = this.attrs.href;\n const showId = app.forum.attribute('showDiscussionId');\n const isComment = href && /\\/d\\/[^\\/]+\\/[0-9]+/.test(href);\n return (\n \n {\n discussion.title()\n } {\n showId && \n } {\n isComment && \n }\n \n );\n }\n}\n\nclass DiscussionComment extends Component {\n view() {\n return \n ({app.translator.trans('club-1-cross-references.forum.comment')})\n \n }\n}\n","/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport app from 'flarum/forum/app';\nimport EventPost from 'flarum/forum/components/EventPost';\nimport DiscussionLink from './DiscussionLink';\n\n\nexport default class DiscussionReferencedPost extends EventPost {\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n\n const sourceId = attrs.post.content()[0];\n attrs.source = app.store.getById('discussions', sourceId);\n }\n icon() {\n return 'fas fa-reply';\n }\n\n descriptionKey() {\n return 'club-1-cross-references.forum.post_stream.discussion_referenced_text';\n }\n\n descriptionData() {\n return {\n source: \n }\n }\n}\n","/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { ComponentAttrs } from 'flarum/common/Component';\nimport { extend } from 'flarum/common/extend';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Stream from 'flarum/common/utils/Stream';\nimport app from 'flarum/forum/app';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport DiscussionHero from 'flarum/forum/components/DiscussionHero';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport DiscussionId from './components/DiscussionId';\nimport DiscussionLink from './components/DiscussionLink';\nimport DiscussionReferencedPost from './components/DiscussionReferencedPost';\n\napp.initializers.add('club-1-cross-references', function(app) {\n app.postComponents.discussionReferenced = DiscussionReferencedPost;\n addSourceLinkReplacement();\n\n addDiscussionTitleId();\n addDiscussionListId();\n});\n\n/**\n * Extend CommentPost to replace plain links to discussions into\n * formated ones using its title as the text.\n */\nfunction addSourceLinkReplacement() {\n function replaceSourceLinks(this: CommentPost) {\n this.$('.Post-body a').replaceWith(function() {\n const a = this as HTMLAnchorElement;\n if (a.protocol !== document.location.protocol || a.host !== document.location.host) {\n return a;\n }\n const match = a.pathname.match(/\\/d\\/([0-9]+)/);\n if (match == null) {\n return a;\n }\n if (a.text === a.href) {\n const discussionId = match[1];\n const discussion = app.store.getById('discussions', discussionId);\n const span = document.createElement('span');\n m.render(span, m(DiscussionLink, {discussion, href: a.href}));\n return span;\n } else {\n a.addEventListener('click', (e) => {\n m.route.set(this.getAttribute('href'))\n e.preventDefault();\n });\n return a;\n }\n });\n }\n extend(CommentPost.prototype, 'oncreate', replaceSourceLinks);\n extend(CommentPost.prototype, 'onupdate', replaceSourceLinks);\n}\n\n/**\n * Extend DiscussionHero to add its ID in the title item.\n */\nfunction addDiscussionTitleId() {\n extend(DiscussionHero.prototype, 'items', function(items) {\n if (!app.forum.attribute('showDiscussionId')) {\n return;\n }\n const attrs = this.attrs as ComponentAttrs & {discussion: Discussion}\n const discussionId = attrs.discussion.id()\n const title = items.get('title');\n items.setContent('title', m('h2', [\n title.text,\n ' ',\n m(DiscussionId, {discussionId}),\n ]));\n });\n}\n\n/**\n * Extend DiscussionListItem to add its ID as an item with a high priority.\n */\nfunction addDiscussionListId() {\n extend(DiscussionListItem.prototype, 'infoItems', function(items) {\n if (!app.forum.attribute('showDiscussionId')) {\n return;\n }\n const attrs = this.attrs as ComponentAttrs & {discussion: Discussion}\n const discussionId = attrs.discussion.id();\n items.add('id', m(DiscussionId, {discussionId}), 90);\n });\n}\n\n/** Empty function used to disable callbacks */\nfunction noop() {};\n\n/**\n * Extremely dirty hack to trigger a refresh of the composer preview\n * by inserting a ZeroWidthSpace at the beginning of the message and\n * then removing it 50ms later after the render pass.\n *\n * TODO: Replace this workaround once this issue is fixed:\n * \n */\nfunction refreshComposerPreview() {\n const content = app.composer.fields?.content;\n if (content) {\n content('​' + content());\n setTimeout(() => content(content().slice(1)), 50);\n }\n}\n\nexport function filterCrossReferences(tag) {\n const id = tag.getAttribute('id');\n const res = app.store.getById('discussions', id);\n if (res) {\n const discussion = res as Discussion;\n tag.setAttribute('title', discussion.title());\n } else {\n app.store.find('discussions', id, {}, {errorHandler: noop})\n .then(refreshComposerPreview)\n .catch(noop);\n return false;\n }\n tag.setAttribute('comment', app.translator.trans('club-1-cross-references.forum.comment'));\n}\n","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/components/Link'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['forum/components/CommentPost'];","module.exports = flarum.core.compat['forum/components/DiscussionHero'];","module.exports = flarum.core.compat['forum/components/DiscussionListItem'];","module.exports = flarum.core.compat['forum/components/EventPost'];","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}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\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};"],"names":["Component","DiscussionId","view","attrs","discussionId","app","Link","DiscussionLink","discussion","href","showId","forum","attribute","isComment","test","route","id","title","DiscussionComment","translator","trans","EventPost","DiscussionReferencedPost","initAttrs","sourceId","post","content","source","store","getById","icon","descriptionKey","descriptionData","extend","CommentPost","DiscussionHero","DiscussionListItem","initializers","add","postComponents","discussionReferenced","addSourceLinkReplacement","addDiscussionTitleId","addDiscussionListId","replaceSourceLinks","$","replaceWith","a","protocol","document","location","host","match","pathname","text","span","createElement","m","render","addEventListener","e","set","getAttribute","preventDefault","prototype","items","get","setContent","noop","refreshComposerPreview","composer","fields","setTimeout","slice","filterCrossReferences","tag","res","setAttribute","find","errorHandler","then","setPrototypeOf","_inheritsLoose","subClass","superClass","Object","create","constructor","_setPrototypeOf","o","p","bind","__proto__"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGyD;AACtB;AAS5B,IAAME,SAAS;EAMpB,mBAAYC,QAAgB,EAAE;IAAA,KALpBC,IAAI;IAAA,KACJC,IAAI;IAAA,KACJC,IAAI,GAAmB,IAAIC,GAAG,EAAE;IAAA,KAChCJ,QAAQ;IAGhB,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAAC;EAAA,OAEDK,GAAG,GAAH,aAAIC,GAAW,EAAiB;IAC9B,OAAO,IAAI,CAACH,IAAI,CAACE,GAAG,CAACC,GAAG,CAAC;EAC3B,CAAC;EAAA,OAEDC,GAAG,GAAH,aAAID,GAAW,EAAEE,KAAQ,EAAQ;IAC/B,IAAI,IAAI,CAACL,IAAI,CAACM,IAAI,IAAI,IAAI,CAACT,QAAQ,EAAE;MACnC,IAAMU,OAAO,GAAG,IAAI,CAACT,IAAK;MAC1B,IAAI,CAACE,IAAI,UAAO,CAACO,OAAO,CAACJ,GAAG,CAAC;MAC7B,IAAI,CAACL,IAAI,GAAGS,OAAO,CAACC,IAAI;IAC1B;IACA,IAAMC,KAAqB,GAAG;MAACN,GAAG,EAAHA;IAAG,CAAC;IACnC,IAAI,CAAC,IAAI,CAACL,IAAI,EAAE;MACd,IAAI,CAACA,IAAI,GAAGW,KAAK;IACnB;IACA,IAAI,CAAC,IAAI,CAACV,IAAI,EA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AClB,CAAC,CAAC;EACJ,CAAC;AACH;;;;;;;;;;;;;;;;AC7BiD;AAClC,SAASqE,cAAc,CAACC,QAAQ,EAAEC,UAAU,EAAE;EAC3DD,QAAQ,CAACnK,SAAS,GAAGoB,MAAM,CAAC2B,MAAM,CAACqH,UAAU,CAACpK,SAAS,CAAC;EACxDmK,QAAQ,CAACnK,SAAS,CAACsH,WAAW,GAAG6C,QAAQ;EACzC3C,8DAAc,CAAC2C,QAAQ,EAAEC,UAAU,CAAC;AACtC;;;;;;;;;;;;;;;ACLe,SAASC,eAAe,CAACC,CAAC,EAAEC,CAAC,EAAE;EAC5CF,eAAe,GAAGjJ,MAAM,CAACoG,cAAc,GAAGpG,MAAM,CAACoG,cAAc,CAACgD,IAAI,EAAE,GAAG,SAASH,eAAe,CAACC,CAAC,EAAEC,CAAC,EAAE;IACtGD,CAAC,CAAC7C,SAAS,GAAG8C,CAAC;IACf,OAAOD,CAAC;EACV,CAAC;EACD,OAAOD,eAAe,CAACC,CAAC,EAAEC,CAAC,CAAC;AAC9B;;;;;;UCNA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D","sources":["webpack://@club-1/flarum-ext-cross-references/./src/forum/cache.ts","webpack://@club-1/flarum-ext-cross-references/./src/forum/components/DiscussionId.js","webpack://@club-1/flarum-ext-cross-references/./src/forum/components/DiscussionLink.js","webpack://@club-1/flarum-ext-cross-references/./src/forum/components/DiscussionReferencedPost.js","webpack://@club-1/flarum-ext-cross-references/./src/forum/index.ts","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['common/Component']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['common/components/Link']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['common/extend']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/app']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/DiscussionHero']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/DiscussionListItem']\"","webpack://@club-1/flarum-ext-cross-references/external root \"flarum.core.compat['forum/components/EventPost']\"","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/helpers/regeneratorRuntime.js","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/helpers/typeof.js","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/regenerator/index.js","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@club-1/flarum-ext-cross-references/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@club-1/flarum-ext-cross-references/webpack/bootstrap","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/compat get default export","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/define property getters","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/hasOwnProperty shorthand","webpack://@club-1/flarum-ext-cross-references/webpack/runtime/make namespace object","webpack://@club-1/flarum-ext-cross-references/./forum.ts"],"sourcesContent":["/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2023 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport Model from 'flarum/common/Model';\nimport Discussion from 'flarum/common/models/Discussion';\nimport app from 'flarum/forum/app';\n\nexport interface Cache {\n get(key: string): T | undefined\n set(key: string, value: T): this\n}\n\ntype FIFOCacheEntry = {key: string, next?: FIFOCacheEntry};\n\nexport class FIFOCache implements Cache {\n protected head?: FIFOCacheEntry;\n protected tail?: FIFOCacheEntry;\n protected data: Map = new Map();\n protected capacity: number;\n\n constructor(capacity: number) {\n this.capacity = capacity;\n }\n\n get(key: string): T | undefined {\n return this.data.get(key);\n }\n\n set(key: string, value: T): this {\n if (this.data.size == this.capacity) {\n const evicted = this.head!;\n this.data.delete(evicted.key);\n this.head = evicted.next;\n }\n const entry: FIFOCacheEntry = {key}\n if (!this.head) {\n this.head = entry;\n }\n if (!this.tail) {\n this.tail = entry;\n } else {\n this.tail.next = entry;\n this.tail = entry;\n }\n this.data.set(key, value);\n return this;\n }\n}\n\nfunction key(name: string, id: string): string {\n return name + id;\n}\n\nconst ModelMap: {[name: string]: string} = {}\nModelMap[Discussion.name] = 'discussions';\n\n\n/** Empty function used to disable callbacks */\nfunction noop() {};\n\nexport abstract class ResponseCache {\n private static responseErrors: Cache = new FIFOCache(128);\n\n public static async find(m: new () => T, id: string, options = {}): Promise {\n if (this.responseErrors.get(key(m.name, id)) == true) {\n return null;\n }\n const res = await app.store.find(ModelMap[m.name] , id, options, {errorHandler: noop})\n .catch(noop);\n if (res) {\n return res;\n }\n this.responseErrors.set(key(m.name, id), true);\n return null;\n }\n}\n","/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport Component from \"flarum/common/Component\";\n\nexport default class DiscussionId extends Component {\n view() {\n return #{this.attrs.discussionId}\n }\n}\n","/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport app from 'flarum/forum/app';\nimport Link from 'flarum/common/components/Link';\nimport Component from 'flarum/common/Component';\nimport DiscussionId from './DiscussionId';\n\n\nexport default class DiscussionLink extends Link {\n view() {\n const discussion = this.attrs.discussion;\n const href = this.attrs.href;\n const showId = app.forum.attribute('showDiscussionId');\n const isComment = href && /\\/d\\/[^\\/]+\\/[0-9]+/.test(href);\n return (\n \n {\n discussion.title()\n } {\n showId && \n } {\n isComment && \n }\n \n );\n }\n}\n\nclass DiscussionComment extends Component {\n view() {\n return \n ({app.translator.trans('club-1-cross-references.forum.comment')})\n \n }\n}\n","/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport app from 'flarum/forum/app';\nimport EventPost from 'flarum/forum/components/EventPost';\nimport DiscussionLink from './DiscussionLink';\n\n\nexport default class DiscussionReferencedPost extends EventPost {\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n\n const sourceId = attrs.post.content()[0];\n attrs.source = app.store.getById('discussions', sourceId);\n }\n icon() {\n return 'fas fa-reply';\n }\n\n descriptionKey() {\n return 'club-1-cross-references.forum.post_stream.discussion_referenced_text';\n }\n\n descriptionData() {\n return {\n source: \n }\n }\n}\n","/*\n * This file is part of club-1/flarum-ext-cross-references.\n *\n * Copyright (c) 2022 Nicolas Peugnet .\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { ComponentAttrs } from 'flarum/common/Component';\nimport { extend } from 'flarum/common/extend';\nimport Discussion from 'flarum/common/models/Discussion';\nimport app from 'flarum/forum/app';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport DiscussionHero from 'flarum/forum/components/DiscussionHero';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport { ResponseCache } from './cache';\nimport DiscussionId from './components/DiscussionId';\nimport DiscussionLink from './components/DiscussionLink';\nimport DiscussionReferencedPost from './components/DiscussionReferencedPost';\n\napp.initializers.add('club-1-cross-references', function(app) {\n app.postComponents.discussionReferenced = DiscussionReferencedPost;\n addSourceLinkReplacement();\n\n addDiscussionTitleId();\n addDiscussionListId();\n});\n\n/**\n * Extend CommentPost to replace plain links to discussions into\n * formated ones using its title as the text.\n */\nfunction addSourceLinkReplacement() {\n function replaceSourceLinks(this: CommentPost) {\n this.$('.Post-body a').replaceWith(function() {\n const a = this as HTMLAnchorElement;\n if (a.protocol !== document.location.protocol || a.host !== document.location.host) {\n return a;\n }\n const match = a.pathname.match(/\\/d\\/([0-9]+)/);\n if (match == null) {\n return a;\n }\n if (a.text === a.href) {\n const discussionId = match[1];\n const discussion = app.store.getById('discussions', discussionId);\n const span = document.createElement('span');\n m.render(span, m(DiscussionLink, {discussion, href: a.href}));\n return span;\n } else {\n a.addEventListener('click', (e) => {\n m.route.set(this.getAttribute('href'))\n e.preventDefault();\n });\n return a;\n }\n });\n }\n extend(CommentPost.prototype, 'oncreate', replaceSourceLinks);\n extend(CommentPost.prototype, 'onupdate', replaceSourceLinks);\n}\n\n/**\n * Extend DiscussionHero to add its ID in the title item.\n */\nfunction addDiscussionTitleId() {\n extend(DiscussionHero.prototype, 'items', function(items) {\n if (!app.forum.attribute('showDiscussionId')) {\n return;\n }\n const attrs = this.attrs as ComponentAttrs & {discussion: Discussion}\n const discussionId = attrs.discussion.id()\n const title = items.get('title');\n items.setContent('title', m('h2', [\n title.text,\n ' ',\n m(DiscussionId, {discussionId}),\n ]));\n });\n}\n\n/**\n * Extend DiscussionListItem to add its ID as an item with a high priority.\n */\nfunction addDiscussionListId() {\n extend(DiscussionListItem.prototype, 'infoItems', function(items) {\n if (!app.forum.attribute('showDiscussionId')) {\n return;\n }\n const attrs = this.attrs as ComponentAttrs & {discussion: Discussion}\n const discussionId = attrs.discussion.id();\n items.add('id', m(DiscussionId, {discussionId}), 90);\n });\n}\n\n/**\n * Extremely dirty hack to trigger a refresh of the composer preview\n * by inserting a ZeroWidthSpace at the beginning of the message and\n * then removing it 50ms later after the render pass.\n *\n * TODO: Replace this workaround once this issue is fixed:\n * \n */\nfunction refreshComposerPreview() {\n const content = app.composer.fields?.content;\n if (content) {\n content('​' + content());\n setTimeout(() => content(content().slice(1)), 50);\n }\n}\n\nexport function filterCrossReferences(tag) {\n const id = tag.getAttribute('id');\n const res = app.store.getById('discussions', id);\n if (res) {\n const discussion = res as Discussion;\n tag.setAttribute('title', discussion.title());\n } else {\n ResponseCache.find(Discussion, id).then((d) => {\n if (d) refreshComposerPreview();\n });\n return false;\n }\n tag.setAttribute('comment', app.translator.trans('club-1-cross-references.forum.comment'));\n}\n","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/components/Link'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['common/models/Discussion'];","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['forum/components/CommentPost'];","module.exports = flarum.core.compat['forum/components/DiscussionHero'];","module.exports = flarum.core.compat['forum/components/DiscussionListItem'];","module.exports = flarum.core.compat['forum/components/EventPost'];","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n module.exports = _regeneratorRuntime = function _regeneratorRuntime() {\n return exports;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n var exports = {},\n Op = Object.prototype,\n hasOwn = Op.hasOwnProperty,\n defineProperty = Object.defineProperty || function (obj, key, desc) {\n obj[key] = desc.value;\n },\n $Symbol = \"function\" == typeof Symbol ? Symbol : {},\n iteratorSymbol = $Symbol.iterator || \"@@iterator\",\n asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\",\n toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n function define(obj, key, value) {\n return Object.defineProperty(obj, key, {\n value: value,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), obj[key];\n }\n try {\n define({}, \"\");\n } catch (err) {\n define = function define(obj, key, value) {\n return obj[key] = value;\n };\n }\n function wrap(innerFn, outerFn, self, tryLocsList) {\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,\n generator = Object.create(protoGenerator.prototype),\n context = new Context(tryLocsList || []);\n return defineProperty(generator, \"_invoke\", {\n value: makeInvokeMethod(innerFn, self, context)\n }), generator;\n }\n function tryCatch(fn, obj, arg) {\n try {\n return {\n type: \"normal\",\n arg: fn.call(obj, arg)\n };\n } catch (err) {\n return {\n type: \"throw\",\n arg: err\n };\n }\n }\n exports.wrap = wrap;\n var ContinueSentinel = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n var getProto = Object.getPrototypeOf,\n NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);\n var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);\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 function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (\"throw\" !== record.type) {\n var result = record.arg,\n value = result.value;\n return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) {\n invoke(\"next\", value, resolve, reject);\n }, function (err) {\n invoke(\"throw\", err, resolve, reject);\n }) : PromiseImpl.resolve(value).then(function (unwrapped) {\n result.value = unwrapped, resolve(result);\n }, function (error) {\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n reject(record.arg);\n }\n var previousPromise;\n defineProperty(this, \"_invoke\", {\n value: function value(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function (resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(innerFn, self, context) {\n var state = \"suspendedStart\";\n return function (method, arg) {\n if (\"executing\" === state) throw new Error(\"Generator is already running\");\n if (\"completed\" === state) {\n if (\"throw\" === method) throw arg;\n return doneResult();\n }\n for (context.method = method, context.arg = arg;;) {\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 if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) {\n if (\"suspendedStart\" === state) throw state = \"completed\", context.arg;\n context.dispatchException(context.arg);\n } else \"return\" === context.method && context.abrupt(\"return\", context.arg);\n state = \"executing\";\n var record = tryCatch(innerFn, self, context);\n if (\"normal\" === record.type) {\n if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue;\n return {\n value: record.arg,\n done: context.done\n };\n }\n \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg);\n }\n };\n }\n function maybeInvokeDelegate(delegate, context) {\n var methodName = context.method,\n method = delegate.iterator[methodName];\n if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel;\n var record = tryCatch(method, delegate.iterator, context.arg);\n if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel;\n var info = record.arg;\n return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel);\n }\n function pushTryEntry(locs) {\n var entry = {\n tryLoc: locs[0]\n };\n 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);\n }\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\", delete record.arg, entry.completion = record;\n }\n function Context(tryLocsList) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) return iteratorMethod.call(iterable);\n if (\"function\" == typeof iterable.next) return iterable;\n if (!isNaN(iterable.length)) {\n var i = -1,\n next = function next() {\n for (; ++i < iterable.length;) {\n if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;\n }\n return next.value = undefined, next.done = !0, next;\n };\n return next.next = next;\n }\n }\n return {\n next: doneResult\n };\n }\n function doneResult() {\n return {\n value: undefined,\n done: !0\n };\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), defineProperty(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) {\n var ctor = \"function\" == typeof genFun && genFun.constructor;\n return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name));\n }, exports.mark = function (genFun) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun;\n }, exports.awrap = function (arg) {\n return {\n __await: arg\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n void 0 === PromiseImpl && (PromiseImpl = Promise);\n var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);\n return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {\n return result.done ? result.value : iter.next();\n });\n }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () {\n return this;\n }), define(Gp, \"toString\", function () {\n return \"[object Generator]\";\n }), exports.keys = function (val) {\n var object = Object(val),\n keys = [];\n for (var key in object) {\n keys.push(key);\n }\n return keys.reverse(), function next() {\n for (; keys.length;) {\n var key = keys.pop();\n if (key in object) return next.value = key, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, exports.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(skipTempReset) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {\n \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);\n }\n },\n stop: function stop() {\n this.done = !0;\n var rootRecord = this.tryEntries[0].completion;\n if (\"throw\" === rootRecord.type) throw rootRecord.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(exception) {\n if (this.done) throw exception;\n var context = this;\n function handle(loc, caught) {\n return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught;\n }\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i],\n record = entry.completion;\n if (\"root\" === entry.tryLoc) return handle(\"end\");\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\"),\n hasFinally = hasOwn.call(entry, \"finallyLoc\");\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n } else {\n if (!hasFinally) throw new Error(\"try statement without catch or finally\");\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(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 && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);\n var record = finallyEntry ? finallyEntry.completion : {};\n return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);\n },\n complete: function complete(record, afterLoc) {\n if (\"throw\" === record.type) throw record.arg;\n return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;\n },\n finish: function finish(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;\n }\n },\n \"catch\": function _catch(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 (\"throw\" === record.type) {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(iterable, resultName, nextLoc) {\n return this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel;\n }\n }, exports;\n}\nmodule.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO(Babel 8): Remove this file.\n\nvar runtime = require(\"../helpers/regeneratorRuntime\")();\nmodule.exports = runtime;\n\n// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","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 if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\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 function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\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}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\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};","export * from './src/forum';\n"],"names":["Discussion","app","FIFOCache","capacity","head","tail","data","Map","get","key","set","value","size","evicted","next","entry","name","id","ModelMap","noop","ResponseCache","find","m","options","responseErrors","store","errorHandler","res","Component","DiscussionId","view","attrs","discussionId","Link","DiscussionLink","discussion","href","showId","forum","attribute","isComment","test","route","title","DiscussionComment","translator","trans","EventPost","DiscussionReferencedPost","initAttrs","sourceId","post","content","source","getById","icon","descriptionKey","descriptionData","extend","CommentPost","DiscussionHero","DiscussionListItem","initializers","add","postComponents","discussionReferenced","addSourceLinkReplacement","addDiscussionTitleId","addDiscussionListId","replaceSourceLinks","$","replaceWith","a","protocol","document","location","host","match","pathname","text","span","createElement","render","addEventListener","e","getAttribute","preventDefault","prototype","items","setContent","refreshComposerPreview","composer","fields","setTimeout","slice","filterCrossReferences","tag","setAttribute","then","d","_typeof","require","_regeneratorRuntime","module","exports","__esModule","Op","Object","hasOwn","hasOwnProperty","defineProperty","obj","desc","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","__await","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","done","methodName","undefined","TypeError","info","resultName","nextLoc","pushTryEntry","locs","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","_catch","thrown","delegateYield","runtime","regeneratorRuntime","accidentalStrictMode","globalThis","Function","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","_inheritsLoose","subClass","superClass","_setPrototypeOf","o","p","bind"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/cache.ts b/js/src/forum/cache.ts new file mode 100644 index 0000000..f2b4b06 --- /dev/null +++ b/js/src/forum/cache.ts @@ -0,0 +1,94 @@ +/* + * This file is part of club-1/flarum-ext-cross-references. + * + * Copyright (c) 2023 Nicolas Peugnet . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import Model from 'flarum/common/Model'; +import Discussion from 'flarum/common/models/Discussion'; +import app from 'flarum/forum/app'; + +export interface Cache { + get(key: string): T | undefined + set(key: string, value: T): this +} + +type FIFOCacheEntry = {key: string, next?: FIFOCacheEntry}; + +export class FIFOCache implements Cache { + protected head?: FIFOCacheEntry; + protected tail?: FIFOCacheEntry; + protected data: Map = new Map(); + protected capacity: number; + + constructor(capacity: number) { + this.capacity = capacity; + } + + get(key: string): T | undefined { + return this.data.get(key); + } + + set(key: string, value: T): this { + if (this.data.size == this.capacity) { + const evicted = this.head!; + this.data.delete(evicted.key); + this.head = evicted.next; + } + const entry: FIFOCacheEntry = {key} + if (!this.head) { + this.head = entry; + } + if (!this.tail) { + this.tail = entry; + } else { + this.tail.next = entry; + this.tail = entry; + } + this.data.set(key, value); + return this; + } +} + +function key(name: string, id: string): string { + return name + id; +} + +const ModelMap: {[name: string]: string} = {} +ModelMap[Discussion.name] = 'discussions'; + + +/** Empty function used to disable callbacks */ +function noop() {}; + +export abstract class ResponseCache { + private static responseErrors: Cache = new FIFOCache(128); + + public static async find(m: new () => T, id: string, options = {}): Promise { + if (this.responseErrors.get(key(m.name, id)) == true) { + return null; + } + const res = await app.store.find(ModelMap[m.name] , id, options, {errorHandler: noop}) + .catch(noop); + if (res) { + return res; + } + this.responseErrors.set(key(m.name, id), true); + return null; + } +} diff --git a/js/src/forum/index.ts b/js/src/forum/index.ts index 4613ed3..173b0c5 100644 --- a/js/src/forum/index.ts +++ b/js/src/forum/index.ts @@ -22,11 +22,11 @@ import { ComponentAttrs } from 'flarum/common/Component'; import { extend } from 'flarum/common/extend'; import Discussion from 'flarum/common/models/Discussion'; -import Stream from 'flarum/common/utils/Stream'; import app from 'flarum/forum/app'; import CommentPost from 'flarum/forum/components/CommentPost'; import DiscussionHero from 'flarum/forum/components/DiscussionHero'; import DiscussionListItem from 'flarum/forum/components/DiscussionListItem'; +import { ResponseCache } from './cache'; import DiscussionId from './components/DiscussionId'; import DiscussionLink from './components/DiscussionLink'; import DiscussionReferencedPost from './components/DiscussionReferencedPost'; @@ -106,9 +106,6 @@ function addDiscussionListId() { }); } -/** Empty function used to disable callbacks */ -function noop() {}; - /** * Extremely dirty hack to trigger a refresh of the composer preview * by inserting a ZeroWidthSpace at the beginning of the message and @@ -132,9 +129,9 @@ export function filterCrossReferences(tag) { const discussion = res as Discussion; tag.setAttribute('title', discussion.title()); } else { - app.store.find('discussions', id, {}, {errorHandler: noop}) - .then(refreshComposerPreview) - .catch(noop); + ResponseCache.find(Discussion, id).then((d) => { + if (d) refreshComposerPreview(); + }); return false; } tag.setAttribute('comment', app.translator.trans('club-1-cross-references.forum.comment'));