From 3f76213071d9057522ab01eb3d6dd4b93b4661d1 Mon Sep 17 00:00:00 2001 From: kraktus Date: Fri, 6 Aug 2021 08:56:19 +0200 Subject: [PATCH] Make click-to-note safer to use. Include the username to avoid noting messages from user B on user A. --- public/javascripts/inquiry.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/javascripts/inquiry.js b/public/javascripts/inquiry.js index ba47f589b8..10fc1c252a 100644 --- a/public/javascripts/inquiry.js +++ b/public/javascripts/inquiry.js @@ -39,8 +39,11 @@ $(function () { }); $('#communication').on('click', '.line.author, .post.author', function () { + // Need to take username from the communcation page so that when being in inquiry for user A and checking communication of user B + // the notes cannot be mistakenly attributed to user A. + const username = $('#communication').find('.title').text().split(' ')[0]; const message = $(this).find('.message').text(); const storedNote = noteStore.get(); - noteStore.set((storedNote ? storedNote + ', ' : '') + `"${message}"`); + noteStore.set((storedNote ? storedNote + ', ' : '') + `${username}: "${message}"`); }); });