From 4dd9540430cd8c008cc41d0f74f800c298fdd691 Mon Sep 17 00:00:00 2001 From: hippoz Date: Thu, 3 Dec 2020 19:39:40 +0200 Subject: [PATCH] message clumping!!!!!!! --- app/app.html | 4 ++-- app/resources/js/app.js | 11 ++++++++++- notes.txt | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/app.html b/app/app.html index 8477e53..9990150 100755 --- a/app/app.html +++ b/app/app.html @@ -155,7 +155,7 @@ by {{ post.creator.username }} - + {{ button.text }} @@ -167,7 +167,7 @@ {{ post.author.username }} - {{ post.content }} + {{ post.content }}
diff --git a/app/resources/js/app.js b/app/resources/js/app.js index f668d35..9aeb6b9 100755 --- a/app/resources/js/app.js +++ b/app/resources/js/app.js @@ -261,7 +261,16 @@ const app = new Vue({ }, processMessage: async function(messageObject) { if (!this.messages[messageObject.category._id]) this.$set(this.messages, messageObject.category._id, []); - this.messages[messageObject.category._id].push(messageObject); + const categoryMessageList = this.messages[messageObject.category._id]; + + const lastMessageIndex = categoryMessageList.length-1; + const lastMessage = categoryMessageList[lastMessageIndex]; + if (lastMessage && lastMessage.author._id === messageObject.author._id) { + categoryMessageList[lastMessageIndex].content += `\n${messageObject.content}` + } else { + this.messages[messageObject.category._id].push(messageObject); + } + if (messageObject.category._id === this.selection.category._id) { this.$nextTick(() => { diff --git a/notes.txt b/notes.txt index 4a3f212..7b9db78 100755 --- a/notes.txt +++ b/notes.txt @@ -1,3 +1,6 @@ vulns: - you can send a malformed request and express will send the full error - - 2 users can have the same name if one of the letters is uppercase \ No newline at end of file + - 2 users can have the same name if one of the letters is uppercase + +notes: + - please remove excessive whitespace please \ No newline at end of file