From dd2c767cc3d9fc01b5a5896ecdfaf5b4f40bb8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 27 Oct 2018 06:50:08 -0400 Subject: [PATCH] closeshttps://github.com/NodeBB/NodeBB/issues/6865 --- lib/modules/quickreply.js | 13 ++++++++----- library.js | 7 +++++++ templates/partials/topic/quickreply.tpl | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/modules/quickreply.js b/lib/modules/quickreply.js index a79ae83..f87aaeb 100644 --- a/lib/modules/quickreply.js +++ b/lib/modules/quickreply.js @@ -4,9 +4,9 @@ define('persona/quickreply', ['components'], function(components) { var QuickReply = {}; - + QuickReply.init = function() { - + var element = components.get('topic/quickreply/text'); var data = { element: element, @@ -20,11 +20,11 @@ define('persona/quickreply', ['components'], function(components) { } } }; - + $(window).trigger('composer:autocomplete:init', data); data.element.textcomplete(data.strategies, data.options); $('.textcomplete-wrapper').css('height', '100%').find('textarea').css('height', '100%'); - + components.get('topic/quickreply/button').on('click', function(e) { e.preventDefault(); var replyMsg = components.get('topic/quickreply/text').val(); @@ -38,10 +38,13 @@ define('persona/quickreply', ['components'], function(components) { if (err) { app.alertError(err.message); } + if (data && data.queued) { + app.alertSuccess(data.message); + } components.get('topic/quickreply/text').val(''); }); }); }; - + return QuickReply; }); diff --git a/library.js b/library.js index d4872eb..f215b3a 100644 --- a/library.js +++ b/library.js @@ -111,6 +111,13 @@ library.addUserToTopic = function(data, callback) { callback(null, data); }); } else { + data.templateData.loggedInUser = { + uid: 0, + username: '[[global:guest]]', + picture: user.getDefaultAvatar(), + 'icon:text': '?', + 'icon:bgColor': '#aaa', + }; callback(null, data); } }; diff --git a/templates/partials/topic/quickreply.tpl b/templates/partials/topic/quickreply.tpl index 4604133..5c3dccb 100644 --- a/templates/partials/topic/quickreply.tpl +++ b/templates/partials/topic/quickreply.tpl @@ -1,4 +1,4 @@ - +
- +