fix(inbox): display correct UN for outbound user

This commit is contained in:
Sabe Jones
2018-11-01 16:05:14 -05:00
parent 6ab08a7d52
commit 6c71abfac8
2 changed files with 8 additions and 3 deletions

View File

@@ -33,7 +33,7 @@
h3(:class="userLevelStyle(conversation)") {{ conversation.name }} h3(:class="userLevelStyle(conversation)") {{ conversation.name }}
.svg-icon(v-html="tierIcon(conversation)") .svg-icon(v-html="tierIcon(conversation)")
.time .time
span.mr-1 @{{ conversation.username }} span.mr-1(v-if='conversation.username') @{{ conversation.username }}
span {{ conversation.date | timeAgo }} span {{ conversation.date | timeAgo }}
div {{conversation.lastMessageText ? conversation.lastMessageText.substring(0, 30) : ''}} div {{conversation.lastMessageText ? conversation.lastMessageText.substring(0, 30) : ''}}
.col-8.messages.d-flex.flex-column.justify-content-between .col-8.messages.d-flex.flex-column.justify-content-between
@@ -261,7 +261,8 @@ export default {
} }
this.initiatedConversation = { this.initiatedConversation = {
user: data.userName, user: data.displayName,
username: data.username,
uuid: data.userIdToMessage, uuid: data.userIdToMessage,
}; };
@@ -426,6 +427,7 @@ export default {
if (messageIndex !== -1) this.messages.splice(messageIndex, 1); if (messageIndex !== -1) this.messages.splice(messageIndex, 1);
if (this.selectedConversationMessages.length === 0) this.initiatedConversation = { if (this.selectedConversationMessages.length === 0) this.initiatedConversation = {
user: this.selectedConversation.name, user: this.selectedConversation.name,
username: this.selectedConversation.username,
uuid: this.selectedConversation.key, uuid: this.selectedConversation.key,
}; };
}, },
@@ -456,6 +458,7 @@ export default {
text: this.newMessage, text: this.newMessage,
timestamp: new Date(), timestamp: new Date(),
user: this.selectedConversation.name, user: this.selectedConversation.name,
username: this.selectedConversation.username,
uuid: this.selectedConversation.key, uuid: this.selectedConversation.key,
contributor: this.user.contributor, contributor: this.user.contributor,
}); });
@@ -488,6 +491,7 @@ export default {
this.$root.$emit('bv::hide::modal', 'inbox-modal'); this.$root.$emit('bv::hide::modal', 'inbox-modal');
}, },
tierIcon (message) { tierIcon (message) {
if (!message.contributor) return;
const isNPC = Boolean(message.backer && message.backer.npc); const isNPC = Boolean(message.backer && message.backer.npc);
if (isNPC) { if (isNPC) {
return this.icons.tierNPC; return this.icons.tierNPC;

View File

@@ -470,7 +470,8 @@ export default {
sendMessage () { sendMessage () {
this.$root.$emit('habitica::new-inbox-message', { this.$root.$emit('habitica::new-inbox-message', {
userIdToMessage: this.user._id, userIdToMessage: this.user._id,
userName: this.user.profile.name, displayName: this.user.profile.name,
username: this.user.auth.local.username,
}); });
}, },
getProgressDisplay () { getProgressDisplay () {