mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Fixes sept 1 (#9016)
* Added avatars to inbox * Added ordering of inbox messages * Fixed blurb not converting to string * Added message to member modal * Added quest invites * Moved filters to server
This commit is contained in:
@@ -30,6 +30,10 @@
|
||||
span.timeago {{conversation.date | timeAgo}}
|
||||
div {{conversation.lastMessageText.substring(0, 30)}}
|
||||
.col-8.messages
|
||||
.empty-messages.text-center(v-if='activeChat.length === 0')
|
||||
.svg-icon.envelope(v-html="icons.messageIcon")
|
||||
h4(v-once) Nothing Here Yet
|
||||
p(v-once) Select a conversation on the left
|
||||
chat-message.container-fluid.message-scroll(:chat.sync='activeChat', :inbox='true', ref="chatscroll")
|
||||
|
||||
// @TODO: Implement new message header here when we fix the above
|
||||
@@ -142,7 +146,7 @@
|
||||
import Vue from 'vue';
|
||||
import moment from 'moment';
|
||||
import filter from 'lodash/filter';
|
||||
// import sortBy from 'lodash/sortBy';
|
||||
import sortBy from 'lodash/sortBy';
|
||||
import { mapState } from 'client/libs/store';
|
||||
import styleHelper from 'client/mixins/styleHelper';
|
||||
|
||||
@@ -184,11 +188,6 @@ export default {
|
||||
let message = this.user.inbox.messages[messageId];
|
||||
let userId = message.uuid;
|
||||
|
||||
if (!this.selectedConversation) {
|
||||
this.selectedConversation = userId;
|
||||
this.selectConversation(userId);
|
||||
}
|
||||
|
||||
if (!conversations[userId]) {
|
||||
conversations[userId] = {
|
||||
name: message.user,
|
||||
@@ -197,10 +196,19 @@ export default {
|
||||
};
|
||||
}
|
||||
|
||||
conversations[userId].messages.push({
|
||||
let newMessage = {
|
||||
text: message.text,
|
||||
timestamp: message.timestamp,
|
||||
});
|
||||
user: message.user,
|
||||
uuid: message.uuid,
|
||||
};
|
||||
|
||||
if (message.sent) {
|
||||
newMessage.user = this.user.profile.name;
|
||||
newMessage.uuid = this.user._id;
|
||||
}
|
||||
|
||||
conversations[userId].messages.push(newMessage);
|
||||
conversations[userId].lastMessageText = message.text;
|
||||
conversations[userId].date = message.timestamp;
|
||||
}
|
||||
@@ -225,11 +233,13 @@ export default {
|
||||
selectConversation (key) {
|
||||
this.selectedConversation = key;
|
||||
let activeChat = this.conversations[this.selectedConversation].messages;
|
||||
// @TODO: I think I did this wrong
|
||||
// activeChat = sortBy(this.activeChat, [(o) => {
|
||||
// return o.timestamp;
|
||||
// }]);
|
||||
|
||||
activeChat = sortBy(activeChat, [(o) => {
|
||||
return moment(o.timestamp).toDate();
|
||||
}]);
|
||||
|
||||
this.$set(this, 'activeChat', activeChat);
|
||||
|
||||
Vue.nextTick(() => {
|
||||
let chatscroll = this.$refs.chatscroll.$el;
|
||||
chatscroll.scrollTop = chatscroll.scrollHeight;
|
||||
@@ -244,6 +254,8 @@ export default {
|
||||
this.conversations[this.selectedConversation].messages.push({
|
||||
text: this.newMessage,
|
||||
timestamp: new Date(),
|
||||
user: this.user.profile.name,
|
||||
uuid: this.user._id,
|
||||
});
|
||||
|
||||
this.activeChat = this.conversations[this.selectedConversation].messages;
|
||||
|
||||
@@ -411,6 +411,9 @@ export default {
|
||||
// @TODO: this common code should handle the above
|
||||
this.achievements = achievementsLib.getAchievementsForProfile(user);
|
||||
|
||||
// @TODO For some reason markdown doesn't seem to be handling numbers or maybe undefined?
|
||||
user.profile.blurb = `${user.profile.blurb}`;
|
||||
|
||||
return user;
|
||||
},
|
||||
incentivesProgress () {
|
||||
|
||||
Reference in New Issue
Block a user