summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-05 10:40:59 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-05 10:40:59 +0200
commit3bfffab2011262b21e1ae24250d88788477aa32e (patch)
tree7e0a3ca6eec357c05d21889ce0bd3d41172276df
parentmerge spec changes (diff)
downloadsynapse-3bfffab2011262b21e1ae24250d88788477aa32e.tar.xz
Do not systematically scroll to the bottom on new events in the room
Diffstat (limited to '')
-rw-r--r--webclient/room/room-controller.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 6e6d6e6356..d8716de020 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -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()) {