MDL-64099 message: Add sender name to conversation preview in overview

This commit is contained in:
Bas Brands 2018-11-22 12:09:42 +01:00 committed by Ryan Wyllie
parent 302586a5bc
commit 71b13a84a4
5 changed files with 22 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -160,7 +160,9 @@ function(
*/
var render = function(contentContainer, conversations, userId) {
var formattedConversations = conversations.map(function(conversation) {
var lastMessage = conversation.messages.length ? conversation.messages[conversation.messages.length - 1] : null;
var formattedConversation = {
id: conversation.id,
imageurl: conversation.imageurl,
@ -186,6 +188,15 @@ function(
formattedConversation.isblocked = otherUser.isblocked;
}
if (conversation.type == MessageDrawerViewConversationContants.CONVERSATION_TYPES.PUBLIC) {
formattedConversation.lastsendername = conversation.members.reduce(function(carry, member) {
if (!carry && member.id == lastMessage.useridfrom) {
carry = member.fullname;
}
return carry;
}, null) + ':';
}
return formattedConversation;
});
@ -368,6 +379,8 @@ function(
if (message.fromLoggedInUser) {
lastMessage = youString + ' ' + lastMessage;
} else {
lastMessage = message.userFrom.fullname + ': ' + lastMessage;
}
element.find(SELECTORS.LAST_MESSAGE).html(lastMessage);

View File

@ -75,7 +75,8 @@
{{/subname}}
<p class="m-0 font-weight-light text-truncate" data-region="last-message">
{{#sentfromcurrentuser}}{{#str}} you, core_message {{/str}}{{/sentfromcurrentuser}}
{{lastmessage}}
{{^sentfromcurrentuser}}{{lastsendername}}{{/sentfromcurrentuser}}
<span class="text-muted">{{lastmessage}}</span>
</p>
</div>

View File

@ -630,7 +630,9 @@
width: 24px !important;
}
}
.text-muted {
.muted;
}
.dir-rtl {
.dir-rtl-hide {
display: none;

View File

@ -22337,6 +22337,9 @@ ul.indented-list {
height: 24px !important;
width: 24px !important;
}
.text-muted {
color: #999;
}
.dir-rtl .dir-rtl-hide {
display: none;
}