mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-64099 message: Add sender name to conversation preview in overview
This commit is contained in:
parent
302586a5bc
commit
71b13a84a4
File diff suppressed because one or more lines are too long
@ -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);
|
||||
|
@ -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>
|
||||
|
||||
|
@ -630,7 +630,9 @@
|
||||
width: 24px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
.muted;
|
||||
}
|
||||
.dir-rtl {
|
||||
.dir-rtl-hide {
|
||||
display: none;
|
||||
|
@ -22337,6 +22337,9 @@ ul.indented-list {
|
||||
height: 24px !important;
|
||||
width: 24px !important;
|
||||
}
|
||||
.text-muted {
|
||||
color: #999;
|
||||
}
|
||||
.dir-rtl .dir-rtl-hide {
|
||||
display: none;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user