Skip to content

Commit

Permalink
SAK-41698 chat should not group messages from same user over more tha…
Browse files Browse the repository at this point in the history
…n 10 minute span (sakaiproject#6833)

* SAK-41698 chat should not group messages from same user over more than 10 minute span

* SAK-41698 change to 5 minutes per Laura G
  • Loading branch information
ottenhoff authored Apr 18, 2019
1 parent 98029d7 commit 6556c9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ public String getTime()
{
return ldt.format(DateTimeFormatter.ofLocalizedTime(FormatStyle.LONG).withLocale(rl.getLocale()));
}


public String getTimeInMillis()
{
return ldt.toInstant().toEpochMilli() + "";
}

public String getId()
{
return ldt.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS", rl.getLocale()));
Expand Down
5 changes: 4 additions & 1 deletion chat/chat-tool/tool/src/webapp/jsp/roomMonitor.jspf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<c:set var="deleteUrl" value="${ChatTool.toolContext}/sakai.chat.deleteMessage.helper/deleteMessageConfirm?session.current_message=" />
<c:set var="serial" value="0" />
<c:set var="lastMessageOwnerId" value="0" />
<c:set var="lastMessageMillis" value="0" />
<ul id="topForm:chatList" class="chatList">
<li id="chatListItem" class="hide">
<c:out value="
Expand All @@ -28,8 +29,9 @@
</span>${msgs['new_messages']}" escapeXml="false" />
</li>
<c:forEach items="${ChatTool.roomMessages}" var="message">
<c:set var="timestampDiff" value="${message.timeInMillis - lastMessageMillis}" />
<c:choose>
<c:when test="${lastMessageOwnerId eq message.chatMessage.owner}">
<c:when test="${lastMessageOwnerId eq message.chatMessage.owner && timestampDiff < (5*60*1000)}">
<c:out value="<li data-message-id='${message.chatMessage.id}' data-owner-id='${message.chatMessage.owner}' class='nestedMessage'>" escapeXml="false" />
</c:when>
<c:otherwise>
Expand Down Expand Up @@ -74,6 +76,7 @@
<c:out value="</li>" escapeXml="false" />
<c:set var="serial" value="${serial + 1}" />
<c:set var="lastMessageOwnerId" value="${message.chatMessage.owner}" />
<c:set var="lastMessageMillis" value="${message.timeInMillis}" />
</c:forEach>
</ul>

Expand Down

0 comments on commit 6556c9a

Please sign in to comment.