From 9f398726a157713fbbaf91eb8c6540422369cbae Mon Sep 17 00:00:00 2001 From: KyrneDev Date: Mon, 12 Jul 2021 13:20:37 -0700 Subject: [PATCH] 1.0.0 --- .DS_Store | Bin 0 -> 6148 bytes composer.json | 17 +- extend.php | 97 +- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- js/package-lock.json | 14840 +++++++++++----- js/package.json | 2 +- js/src/forum/MakeTree.js | 9 +- js/src/forum/addComposerAutocomplete.js | 6 +- js/src/forum/addMentionedByList.js | 118 +- js/src/forum/addPostMentionPreviews.js | 27 +- js/src/forum/addPostQuoteButton.js | 2 +- js/src/forum/addPostReplyAction.js | 10 +- .../forum/components/AutocompleteDropdown.js | 2 +- .../components/PostMentionedNotification.js | 6 +- js/src/forum/components/PostQuoteButton.js | 14 +- .../components/UserMentionedNotification.js | 6 +- js/src/forum/index.js | 95 +- js/src/forum/utils/reply.js | 26 +- resources/less/forum.less | 1 + resources/locale/en.yml | 45 + src/.DS_Store | Bin 0 -> 6148 bytes src/Api/Controller/ListTreePostController.php | 10 +- src/ConfigureMentions.php | 42 +- src/Filter/MentionedFilter.php | 31 + src/{Listener => }/FilterVisiblePosts.php | 31 +- src/Formatter/.DS_Store | Bin 0 -> 6148 bytes src/Formatter/FormatPostMentions.php | 62 + src/Formatter/FormatUserMentions.php | 65 + src/Formatter/UnparsePostMentions.php | 95 + src/Formatter/UnparseUserMentions.php | 91 + src/Listener/AddFilterByMentions.php | 24 - .../AddPostMentionedByRelationship.php | 77 - src/Listener/FormatPostMentions.php | 30 - src/Listener/FormatUserMentions.php | 31 - src/Listener/InjectSettings.php | 30 - src/Listener/SaveTreeList.php | 3 +- src/Notification/PostMentionedBlueprint.php | 8 +- src/Notification/UserMentionedBlueprint.php | 8 +- 39 files changed, 10949 insertions(+), 5016 deletions(-) create mode 100644 .DS_Store create mode 100644 src/.DS_Store create mode 100644 src/Filter/MentionedFilter.php rename src/{Listener => }/FilterVisiblePosts.php (70%) mode change 100644 => 100755 create mode 100644 src/Formatter/.DS_Store create mode 100644 src/Formatter/FormatPostMentions.php create mode 100644 src/Formatter/FormatUserMentions.php create mode 100644 src/Formatter/UnparsePostMentions.php create mode 100644 src/Formatter/UnparseUserMentions.php delete mode 100644 src/Listener/AddFilterByMentions.php delete mode 100644 src/Listener/AddPostMentionedByRelationship.php delete mode 100644 src/Listener/FormatPostMentions.php delete mode 100644 src/Listener/FormatUserMentions.php delete mode 100644 src/Listener/InjectSettings.php diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2bb50f8c5769a8b3bffc3180375efb645ac83ac1 GIT binary patch literal 6148 zcmeHK&5qMB5FWP$(x4SRAh8#uT)3^O?vEC6SgG6X9x4Gs1i=B&ZqiiSpf;|Wlmexw zcb)(ayaLa`6YwmY;2YZonv`p`LLSNUjqUkt=c{bjL?l|1XqTu)L=FmL#f4jA+|Q+8 zCDXz@p~jGuQjf+|r&on++h7&23S2e?c<*jemn02o1pjCMrl=*If$W9@86u01h+~xc zPi2URTY^OyV}UcI zm@aVo1Xxkbt1ry+Bgd)IV~l=GZF;bNmeNImF~--jHWSR$<#=^nN~14-X;elwGILq1 z%9^ZjnvRU#-@?%#PP0biyC{__SFT=j9M^HT+?Re|PW>#%CTS}eKj+$`AnS)Fej?@I zcN~OIkb5f~9(`{QIF6Bc!u zz09(>aRtmz;9TGM%yvSnfK}kKE5PT2hr-x2xX`GM4mkA$09Mef3^D&vV2)?7X>g$t zJusoEKus0qi6Jx{?VibN8eC}9bQ0$AADWtO8bn|4IQ-Y5VOKKFQpzg^%OA)hCYu2 WVAJ42BU)hgkARZFI;+4&75D{&__taB literal 0 HcmV?d00001 diff --git a/composer.json b/composer.json index be411a1..0c744ae 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,7 @@ "type": "flarum-extension", "license": "GPL-3.0-or-later", "require": { - "flarum/core": "^0.1.0-beta-13", - "kyrne/ext-core": "*@dev" + "flarum/core": "^1.0.2" }, "conflict": { "flarum/mentions": "*" @@ -30,16 +29,10 @@ "extra": { "flarum-extension": { "title": "Evergreen", - "icon": "fas fa-tree", - "info": { - "link": "https://discuss.flarum.org/d/24695-evergreen-comment-trees-for-flarum", - "location": "Flarum Commmunity" - }, - "extra": { - "icon": "fab fa-github", - "link": "https://github.com/kyrnedev/evergreen", - "title": "Source", - "location": "Github" + "icon": { + "name": "fas fa-tree", + "background": "linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(224,64,251,1) 0%, rgba(33,150,243,1) 100%)", + "color": "#FFF" } } } diff --git a/extend.php b/extend.php index 3e632d3..e50954a 100644 --- a/extend.php +++ b/extend.php @@ -2,16 +2,18 @@ namespace Kyrne\Evergreen; +use Flarum\Api\Controller; use Flarum\Api\Event\Serializing; use Flarum\Api\Event\WillSerializeData; +use Flarum\Api\Serializer\BasicPostSerializer; use Flarum\Api\Serializer\PostSerializer; use Flarum\Event\ConfigureNotificationTypes; use Flarum\Event\ConfigurePostsQuery; use Flarum\Event\ScopeModelVisibility; use Flarum\Extend; use Flarum\Formatter\Event\Rendering; +use Illuminate\Database\Eloquent\Builder; use Kyrne\Evergreen\Api\Controller\ListTreePostController; -use Kyrne\Evergreen\ConfigureMentions; use Kyrne\Evergreen\Notification\PostMentionedBlueprint; use Kyrne\Evergreen\Notification\UserMentionedBlueprint; use Flarum\Post\Event\Deleted; @@ -22,10 +24,7 @@ use Flarum\Post\Event\Saving; use Flarum\Post\Post; use Flarum\User\User; -use Illuminate\Contracts\Events\Dispatcher; -use Illuminate\Contracts\View\Factory; use Kyrne\Evergreen\Listener; -use Kyrne\ExtCore\Extend\AddKyrneCore; return [ (new Extend\Frontend('forum')) @@ -35,46 +34,80 @@ (new Extend\Routes('api')) ->get('/trees/{id}', 'evergeen.trees.get', ListTreePostController::class), (new Extend\Event()) - ->listen(Serializing::class, Listener\InjectSettings::class) ->listen(Saving::class, Listener\SaveTreeList::class) - ->listen(ConfigurePostsQuery::class, Listener\AddFilterByMentions::class) - ->listen(WillSerializeData::class, Listener\FilterVisiblePosts::class) - ->listen(Rendering::class, Listener\FormatPostMentions::class) - ->listen(Rendering::class, Listener\FormatUserMentions::class) - ->listen(ConfigureNotificationTypes::class, function (ConfigureNotificationTypes $event) { - $event->add(PostMentionedBlueprint::class, PostSerializer::class, ['alert']); - $event->add(UserMentionedBlueprint::class, PostSerializer::class, ['alert']); - }) - ->listen(ScopeModelVisibility::class, function(ScopeModelVisibility $event) { - $sql = $event->query->toSql(); + ->subscribe(Listener\HandleDeletions::class) + ->listen(Deleted::class, Listener\UpdateMentionsMetadataWhenInvisible::class) + ->listen(Hidden::class, Listener\UpdateMentionsMetadataWhenInvisible::class) + ->listen(Posted::class, Listener\UpdateMentionsMetadataWhenVisible::class) + ->listen(Restored::class, Listener\UpdateMentionsMetadataWhenVisible::class) + ->listen(Revised::class, Listener\UpdateMentionsMetadataWhenVisible::class), + + (new Extend\ModelVisibility(Post::class)) + ->scopeAll(function(User $actor, Builder $query, $ability) { + $sql = $query->toSql(); if (stripos($sql, 'from `posts') && !stripos($sql, 'update') && !stripos($sql, 'delete') && strpos($sql, 'id')) { - $event->query->where('reply_to', 0); + $query->where('reply_to', 0); } }), - new AddKyrneCore(), - - (new Extend\Formatter) - ->configure(ConfigureMentions::class), + (new Extend\Notification()) + ->type(PostMentionedBlueprint::class, PostSerializer::class, ['alert']) + ->type(UserMentionedBlueprint::class, PostSerializer::class, ['alert']), (new Extend\Model(Post::class)) ->belongsToMany('mentionedBy', Post::class, 'post_mentions_post', 'mentions_post_id', 'post_id') ->belongsToMany('mentionsPosts', Post::class, 'post_mentions_post', 'post_id', 'mentions_post_id') ->belongsToMany('mentionsUsers', User::class, 'post_mentions_user', 'post_id', 'mentions_user_id'), - function (Dispatcher $events, Factory $views) { - $events->subscribe(Listener\AddPostMentionedByRelationship::class); - $events->subscribe(Listener\HandleDeletions::class); + (new Extend\ApiSerializer(PostSerializer::class)) + ->attributes(function (PostSerializer $serializer, Post $post, array $attributes) { + $attributes['replyTo'] = (int) $post->reply_to; + $attributes['replyCount'] = (int) $post->reply_count; + + return $attributes; + }), + + (new Extend\ApiSerializer(BasicPostSerializer::class)) + ->hasMany('mentionedBy', BasicPostSerializer::class) + ->hasMany('mentionsPosts', BasicPostSerializer::class) + ->hasMany('mentionsUsers', BasicPostSerializer::class), + + (new Extend\ApiController(Controller\ShowDiscussionController::class)) + ->addInclude(['posts.mentionedBy', 'posts.mentionedBy.user', 'posts.mentionedBy.discussion']), + + (new Extend\ApiController(Controller\ShowPostController::class)) + ->addInclude(['mentionedBy', 'mentionedBy.user', 'mentionedBy.discussion']), + + (new Extend\ApiController(Controller\ListPostsController::class)) + ->addInclude(['mentionedBy', 'mentionedBy.user', 'mentionedBy.discussion']), + + (new Extend\ApiController(Controller\CreatePostController::class)) + ->addInclude(['mentionsPosts', 'mentionsPosts.mentionedBy']), - $events->listen( - [Deleted::class, Hidden::class], - Listener\UpdateMentionsMetadataWhenInvisible::class - ); + (new Extend\ApiController(Controller\AbstractSerializeController::class)) + ->prepareDataForSerialization(FilterVisiblePosts::class), - $events->listen([Posted::class, Restored::class, Revised::class], - Listener\UpdateMentionsMetadataWhenVisible::class - ); + (new Extend\Settings) + ->serializeToForum('allowUsernameMentionFormat', 'flarum-mentions.allow_username_format', 'boolval'), + + (new Extend\Formatter) + ->configure(ConfigureMentions::class) + ->render(Formatter\FormatPostMentions::class) + ->render(Formatter\FormatUserMentions::class) + ->unparse(Formatter\UnparsePostMentions::class) + ->unparse(Formatter\UnparseUserMentions::class), + + (new Extend\Formatter) + ->configure(ConfigureMentions::class), + + (new Extend\View()) + ->namespace('flarum-mentions', __DIR__ . '/views'), + + (new Extend\Model(Post::class)) + ->belongsToMany('mentionedBy', Post::class, 'post_mentions_post', 'mentions_post_id', 'post_id') + ->belongsToMany('mentionsPosts', Post::class, 'post_mentions_post', 'post_id', 'mentions_post_id') + ->belongsToMany('mentionsUsers', User::class, 'post_mentions_user', 'post_id', 'mentions_user_id'), - $views->addNamespace('flarum-mentions', __DIR__ . '/views'); - } + (new Extend\Filter(PostFilterer::class)) + ->addFilter(Filter\MentionedFilter::class), ]; diff --git a/js/dist/forum.js b/js/dist/forum.js index 99cb224..25d27d4 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=32)}([function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["components/CommentPost"]},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["utils/string"]},function(t,e){t.exports=flarum.core.compat["helpers/username"]},function(t,e){t.exports=flarum.core.compat["models/Post"]},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["components/ReplyComposer"]},function(t,e){t.exports=flarum.core.compat["utils/DiscussionControls"]},function(t,e){t.exports=flarum.core.compat["components/PostPreview"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/Notification"]},function(t,e){t.exports=flarum.core.compat["utils/extract"]},function(t,e){t.exports=flarum.core.compat["components/Post"]},function(t,e){t.exports=flarum.core.compat["utils/extractText"]},function(t,e){t.exports=flarum.core.compat["components/Alert"]},function(t,e){t.exports=flarum.core.compat["components/LogInModal"]},function(t,e){t.exports=flarum.core.compat["components/NotificationGrid"]},function(t,e){t.exports=flarum.core.compat["components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["helpers/punctuateSeries"]},function(t,e,n){!function(){var e=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],n="undefined"!=typeof window,o=n&&null!=window.mozInnerScreenX;function r(t,r,i){if(!n)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=i&&i.debug||!1;if(s){var a=document.querySelector("#input-textarea-caret-position-mirror-div");a&&a.parentNode.removeChild(a)}var c=document.createElement("div");c.id="input-textarea-caret-position-mirror-div",document.body.appendChild(c);var u=c.style,p=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,f="INPUT"===t.nodeName;u.whiteSpace="pre-wrap",f||(u.wordWrap="break-word"),u.position="absolute",s||(u.visibility="hidden"),e.forEach(function(t){f&&"lineHeight"===t?u.lineHeight=p.height:u[t]=p[t]}),o?t.scrollHeight>parseInt(p.height)&&(u.overflowY="scroll"):u.overflow="hidden",c.textContent=t.value.substring(0,r),f&&(c.textContent=c.textContent.replace(/\s/g," "));var l=document.createElement("span");l.textContent=t.value.substring(r)||".",c.appendChild(l);var d={top:l.offsetTop+parseInt(p.borderTopWidth),left:l.offsetLeft+parseInt(p.borderLeftWidth),height:parseInt(p.lineHeight)};return s?l.style.backgroundColor="#aaa":document.body.removeChild(c),d}void 0!==t.exports?t.exports=r:n&&(window.getCaretCoordinates=r)}()},function(t,e){t.exports=flarum.core.compat["components/ComposerBody"]},function(t,e){t.exports=flarum.core.compat["components/TextEditor"]},function(t,e){t.exports=flarum.core.compat["components/TextEditorButton"]},function(t,e){t.exports=flarum.core.compat["helpers/avatar"]},function(t,e){t.exports=flarum.core.compat["helpers/highlight"]},function(t,e){t.exports=flarum.core.compat["utils/KeyboardNavigatable"]},function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["components/UserPage"]},function(t,e){t.exports=flarum.core.compat["components/LinkButton"]},function(t,e){t.exports=flarum.core.compat["components/PostsUserPage"]},function(t,e,n){"use strict";n.r(e);var o=n(0),r=n.n(o),i=n(1),s=n(9),a=n.n(s),c=n(16),u=n.n(c),p=n(3),f=n.n(p),l=n(2),d=n.n(l),h=n(6),v=n.n(h),g=n(7),y=n.n(g),b=n(8),w=n.n(b),x=n(17),C=n.n(x),T=n(18),P=n.n(T),_=n(4),S=n(10),j=n.n(S),k=n(19),B=n.n(k);var O=n(20),M=n.n(O),A=n(5),I=n.n(A),N=n(11),W=n.n(N);function H(t,e,n){var o=t.user(),r="@"+(o?o.username():t.number())+"#"+t.id()+" ";e.content()||(e.props.originalContent=r);var i=e.editor.getSelectionRange()[0],s=e.editor.value().slice(0,i),a=0==s.length?0:3-s.match(/(\n{0,2})$/)[0].length;e.editor.insertAtCursor(Array(a).join("\n")+(n?"> "+r+n.trim().replace(/\n/g,"\n> ")+"\n\n":r))}function E(t,e){var n=app.composer.component;if(n&&n.props.post&&n.props.post.discussion()===t.discussion())H(t,n,e);else{var o=t.id();t.replyTo()>0&&(o=t.replyTo()),a.a.replyAction.call(t.discussion(),!1,!1,o).then(function(n){return H(t,n,e)})}}function R(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var D=n(13),L=n.n(D),z=function(t){function e(){return t.apply(this,arguments)||this}R(e,t);var n=e.prototype;return n.view=function(){var e=this,n=L()(this.props,"post"),o=L()(this.props,"content");return this.props.className="Button PostQuoteButton",this.props.icon="fas fa-quote-left",this.props.children=app.translator.trans("flarum-mentions.forum.post.quote_button"),this.props.onclick=function(){e.hide(),E(n,o)},this.props.onmousedown=function(t){return t.stopPropagation()},t.prototype.view.call(this)},n.config=function(t){t||$(document).on("mousedown",this.hide.bind(this))},n.show=function(t,e){var n=this.$().show(),o=n.offsetParent().offset();n.css("left",t-o.left).css("top",e-o.top)},n.showStart=function(t,e){var n=this.$();this.show(t,$(window).scrollTop()+e-n.outerHeight()-5)},n.showEnd=function(t,e){var n=this.$();this.show(t-n.outerWidth(),$(window).scrollTop()+e+5)},n.hide=function(){this.$().hide()},e}(f.a);function U(){Object(i.extend)(d.a.prototype,"config",function(t,e){var n=this.props.post;if(!(e||n.isHidden()||app.session.user&&!n.discussion().canReply())){var o=this.$(".Post-body"),r=$('
'),i=function(t){setTimeout(function(){var e=function(t){var e=window.getSelection();if(e.rangeCount){var n=e.getRangeAt(0),o=n.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){var r=$("
").append(n.cloneContents());return r.find("img.emoji").replaceWith(function(){return this.alt}),r.find("img").replaceWith(function(){return"![]("+this.src+")"}),r.find("a").replaceWith(function(){return"["+this.innerText+"]("+this.href+")"}),r.text()}}return""}(o);if(e){var i=new z({post:n,content:e});m.render(r[0],i.render());var s=window.getSelection().getRangeAt(0).getClientRects(),a=s[0];if(t.clientY=o.length&&(r=0),this.index=r;var i=o.removeClass("active").eq(r).addClass("active");if(e){var s,a=n.scrollTop(),c=n.offset().top,u=c+n.outerHeight(),p=i.offset().top,f=p+i.outerHeight();pu&&(s=a-u+f+parseInt(n.css("padding-bottom"),10)),void 0!==s&&n.stop(!0).animate({scrollTop:s},100)}}},e}(n.n(rt).a);function st(){Object(i.extend)(Y.a.prototype,"config",function(t,e){if(!e){var n,o,r,i=this,s=$('
'),a=new it({items:[]}),c=this.$("textarea").wrap('
'),u=[];this.navigator=new ot.a,this.navigator.when(function(){return a.active}).onUp(function(){return a.navigate(-1)}).onDown(function(){return a.navigate(1)}).onSelect(a.complete.bind(a)).onCancel(a.hide.bind(a)).bindTo(c),c.after(s).on("click keyup input",function(t){var e=this;if(-1===[9,13,27,40,38,37,39].indexOf(t.which)){var p=this.selectionStart;if(!(this.selectionEnd-p>0)){var f=this.value;n=0;for(var l=p-1;l>=p-30;l--){if("@"===f.substr(l,1)){n=l+1;break}}if(a.hide(),a.active=!1,n){o=f.substring(n,p).toLowerCase();var d=function(t,e,r,s){void 0===s&&(s="");var u=I()(t);return o&&(u.children[0]=et()(u.children[0],o)),m("button",{className:"PostPreview "+s,onclick:function(){return function(t){var e=t+" ",o=n-1+e.length,r=i.content();i.editor.setValue(r.substring(0,n-1)+e+r.substr(c[0].selectionStart)),i.editor.setSelectionRange(o,o),a.hide()}(e)},onmouseenter:function(){a.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},Z()(t),u," "," ",r))},h=function(t){return[t.username(),t.displayName()].some(function(t){return t.toLowerCase().substr(0,o.length)===o})},v=function(){var t=[];o&&app.store.all("users").forEach(function(e){h(e)&&t.push(d(e,"@"+e.username(),"","MentionsDropdown-user"))});var r=i.props.post,c=r&&r.discussion()||i.props.discussion;if(c&&c.posts().filter(function(t){return t&&"comment"===t.contentType()&&(!r||t.number()l.height()&&(g=u.top-e.scrollTop-f-15),v+p>l.width()&&(v=l.width()-p),a.show(v,g)}else a.active=!1,a.hide()};a.active=!0,v(),a.setIndex(0),a.$().scrollTop(0),clearTimeout(r),o&&(r=setTimeout(function(){var t=o.toLowerCase();-1===u.indexOf(t)&&(app.store.find("users",{filter:{q:o},page:{limit:5}}).then(function(){a.active&&v()}),u.push(t))},250))}}}})}}),Object(i.extend)(V.a.prototype,"toolbarItems",function(t){var e=this;t.add("mention",m(K.a,{onclick:function(){return e.insertAtCursor("@")},icon:"fas fa-at"},app.translator.trans("flarum-mentions.forum.composer.mention_tooltip")))})}var at=n(12),ct=n.n(at),ut=function(t){function e(){return t.apply(this,arguments)||this}R(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-reply"},n.href=function(){var t=this.props.notification,e=t.subject(),n=t.content();return app.route.discussion(e.discussion(),n&&n.replyNumber)},n.content=function(){var t=this.props.notification.fromUser();return app.translator.transChoice("flarum-mentions.forum.notifications.post_mentioned_text",1,{user:t})},n.excerpt=function(){return Object(_.truncate)(this.props.notification.subject().contentPlain(),200)},e}(ct.a),pt=function(t){function e(){return t.apply(this,arguments)||this}R(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-at"},n.href=function(){var t=this.props.notification.subject();return app.route.discussion(t.discussion(),t.number())},n.content=function(){var t=this.props.notification.fromUser();return app.translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})},n.excerpt=function(){return Object(_.truncate)(this.props.notification.subject().contentPlain(),200)},e}(ct.a),ft=n(29),lt=n.n(ft),dt=n(30),mt=n.n(dt),ht=n(31),vt=function(t){function e(){return t.apply(this,arguments)||this}return R(e,t),e.prototype.loadResults=function(t){return app.store.find("posts",{filter:{type:"comment",mentioned:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})},e}(n.n(ht).a),gt=n(14),yt=n.n(gt);var bt=n(15),wt=n.n(bt);function xt(t){var e=app.store.getBy("users","username",t.getAttribute("username"));if(e)return t.setAttribute("id",e.id()),t.setAttribute("displayname",wt()(I()(e))),!0}function Ct(t){var e=app.store.getById("posts",t.getAttribute("id"));if(e)return t.setAttribute("discussionid",e.discussion().id()),t.setAttribute("number",e.number()),t.setAttribute("displayname",wt()(I()(e.user()))),!0}r.a.initializers.add("kyrne-everygreen",function(){v.a.prototype.replyTo=y.a.attribute("replyTo"),v.a.prototype.replyCount=y.a.attribute("replyCount"),a.a.replyAction=function(t,e,n){var o=m.deferred();if(r.a.session.user)if(this.canReply()){var i=r.a.composer.component;r.a.composingReplyTo(this)&&!e||(i=new w.a({user:r.a.session.user,discussion:this,replyTo:n}),r.a.composer.load(i)),r.a.composer.show(),t&&r.a.viewingDiscussion(this)&&!r.a.composer.isFullScreen()&&r.a.current.stream.goToNumber("reply"),o.resolve(i)}else o.reject();else o.reject(),r.a.modal.show(new C.a);return o.promise},Object(i.extend)(w.a.prototype,"init",function(){this.replyTo=this.props.replyTo}),Object(i.extend)(w.a.prototype,"data",function(t){t.replyTo=this.replyTo}),Object(i.override)(w.a.prototype,"onsubmit",function(){var t=this,e=this.props.discussion;this.loading=!0,m.redraw();var n=this.data();r.a.store.createRecord("posts").save(n).then(function(n){if(t.draft&&t.draft.delete(),r.a.viewingDiscussion(e))t.props.replyTo?(r.a.cache.trees[t.props.replyTo].push(n),r.a.cache.pushTree[t.props.replyTo]++,m.redraw()):r.a.current.stream.update().then(function(){return r.a.current.stream.goToNumber(n.number())});else{var o,i=f.a.component({className:"Button Button--link",children:r.a.translator.trans("core.forum.composer_reply.view_button"),onclick:function(){m.route(r.a.route.post(n)),r.a.alerts.dismiss(o)}});r.a.alerts.show(o=new u.a({type:"success",children:r.a.translator.trans("core.forum.composer_reply.posted_message"),controls:[i]}))}r.a.composer.hide()},this.loaded.bind(this))}),Object(i.extend)(d.a.prototype,"config",function(){var t=this.props.post.contentHtml();if(t!==this.oldPostContentHtml&&!this.isEditing()){this.oldPostContentHtml=t;var e=this.props.post,n=this.$();this.$(".UserMention, .PostMention").each(function(){m.route.call(this,this,!1,{},{attrs:{href:this.getAttribute("href")}})}),this.$(".PostMention").each(function(){var t,o=$(this),r=o.data("id"),i=$('