message clumping!!!!!!!

This commit is contained in:
hippoz 2020-12-03 19:39:40 +02:00
parent 6a4112a13e
commit 4dd9540430
3 changed files with 16 additions and 4 deletions

View file

@ -155,7 +155,7 @@
<span>by <a class="md-dense cursor" v-on:click="viewProfile(post.creator._id)" v-bind:style="{ 'color': post.creator.color}">{{ post.creator.username }}</a></span>
</md-card-header>
<md-card-content v-html="post.body"></md-card-content>
<md-card-content style="white-space: break-spaces !important;" v-html="post.body"></md-card-content>
<md-card-actions>
<md-button v-for="button in cardButtons" v-bind:key="button.text" @click="button.click(post)"><md-icon>{{ button.text }}</md-icon></md-button>
@ -167,7 +167,7 @@
<a class="md-dense cursor md-title" v-on:click="viewProfile(post.author._id)" v-bind:style="{ 'color': post.author.color}"><span>{{ post.author.username }}</span></a>
</md-card-header>
<md-card-content>{{ post.content }}</md-card-content>
<md-card-content style="white-space: break-spaces !important;">{{ post.content }}</md-card-content>
</md-card>
<br>
</div>

View file

@ -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(() => {

View file

@ -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
- 2 users can have the same name if one of the letters is uppercase
notes:
- please remove excessive whitespace please