Skip to content
Snippets Groups Projects
Commit 3bfffab2 authored by Emmanuel ROHEE's avatar Emmanuel ROHEE
Browse files

Do not systematically scroll to the bottom on new events in the room

parent 0d1d9f3e
No related branches found
No related tags found
No related merge requests found
......@@ -54,8 +54,14 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
$scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) {
if (isLive && event.room_id === $scope.room_id) {
scrollToBottom();
// Do not autoscroll to the bottom to display this new event if the user is not at the bottom.
// Exception: if the event is from the user, scroll to the bottom
var objDiv = document.getElementById("messageTableWrapper");
if ( (objDiv.offsetHeight + objDiv.scrollTop >= objDiv.scrollHeight) || event.user_id === $scope.state.user_id) {
scrollToBottom();
}
if (window.Notification) {
// Show notification when the user is idle
if (matrixService.presence.offline === mPresence.getState()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment