From bce03c4f6ed71c3de145ff8fe5692dab9385f04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A4r=20Halberkamp?= Date: Mon, 3 Oct 2016 22:28:20 +0200 Subject: [PATCH] Port /reply to the client (#773) --- js/client-chat.js | 6 ++++++ js/client.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/js/client-chat.js b/js/client-chat.js index c3920ff3e..759a0a4fe 100644 --- a/js/client-chat.js +++ b/js/client-chat.js @@ -148,6 +148,12 @@ e.preventDefault(); e.stopPropagation(); } + } else if (app.user.lastPM && (textbox.value === '/reply' || textbox.value === '/r') && e.keyCode === 32) { // '/reply ' is being written + e.preventDefault(); + e.stopPropagation(); + var val = '/pm ' + app.user.lastPM + ', '; + textbox.value = val; + e.setSelectionRange(val.length, val.length); } }, clickUsername: function (e) { diff --git a/js/client.js b/js/client.js index 8070f7aa9..963b04544 100644 --- a/js/client.js +++ b/js/client.js @@ -957,6 +957,9 @@ parts = dataLines[i].slice(1).split('|'); var message = parts.slice(3).join('|'); this.rooms[''].addPM(parts[1], message, parts[2]); + if (toUserid(parts[1]) !== app.user.get('userid')) { + app.user.lastPM = toUserid(parts[1]); + } } break;