Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion frontend/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,21 @@ button {
border-radius: 50%;
}

.message .user {
font-weight: bold; /* differentiate username from message text */
margin-right: 0.25rem; /* spacing before the message body */
}

.message .text {
/* Allow the message body to consume remaining space so the
timestamp and read receipt align to the right */
flex: 1;
margin-left: 0.25rem;
}

.message .time {
color: #777;
margin-left: auto;
margin-left: 0.5rem; /* space after the message text */
font-size: 0.8rem;
}

Expand Down
11 changes: 8 additions & 3 deletions frontend/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,16 @@ function appendDirectMessage(m) {
// delivered.
const outgoing = m.from === currentUser.username;
const receipt = outgoing
? `<span class="read${m.isRead ? ' read-true' : ''}">${m.isRead ? '✔✔' : (m.isDelivered ? '' : '')}</span>`
? `<span class="read${m.isRead ? ' read-true' : ''}">${m.isRead ? '&#10003;&#10003;' : (m.isDelivered ? '&#10003;' : '')}</span>`
: '';

// Place the timestamp and read receipt at the end of the flex container so
// the layout resembles common chat apps.
div.innerHTML = `
<img class="avatar" src="${getGravatarUrl(m.from)}" alt="avatar">
<span class="user">${m.from}</span>
<span class="time">${time}</span>
<span class="text">${m.text}</span>${receipt}`;
<span class="text">${m.text}</span>
<span class="time">${time}</span>${receipt}`;
list.appendChild(div);
}

Expand Down Expand Up @@ -365,6 +367,9 @@ function selectUser(name) {
currentChannel = null; // hide channel context
clearUnread(name);
loadMessages();
// Explicitly mark any previously unread messages as read now that
// the conversation is open to keep badge counts in sync.
markMessagesRead(name);
}

// Verify the user is logged in before showing the dashboard
Expand Down