Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
12a23f01
Commit
12a23f01
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
autoscroll down(if the scroller was already at the bottom) when receiving member events
parent
3a888089
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webclient/room/room-controller.js
+18
-13
18 additions, 13 deletions
webclient/room/room-controller.js
with
18 additions
and
13 deletions
webclient/room/room-controller.js
+
18
−
13
View file @
12a23f01
...
...
@@ -42,23 +42,24 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
$scope
.
imageURLToSend
=
""
;
$scope
.
userIDToInvite
=
""
;
var
scrollToBottom
=
function
()
{
var
scrollToBottom
=
function
(
force
)
{
console
.
log
(
"
Scrolling to bottom
"
);
$timeout
(
function
()
{
var
objDiv
=
document
.
getElementById
(
"
messageTableWrapper
"
);
objDiv
.
scrollTop
=
objDiv
.
scrollHeight
;
},
0
);
// Do not autoscroll to the bottom to display the new event if the user is not at the bottom.
// Exception: in case where the event is from the user, we want to force scroll to the bottom
var
objDiv
=
document
.
getElementById
(
"
messageTableWrapper
"
);
if
((
objDiv
.
offsetHeight
+
objDiv
.
scrollTop
>=
objDiv
.
scrollHeight
)
||
force
)
{
$timeout
(
function
()
{
objDiv
.
scrollTop
=
objDiv
.
scrollHeight
;
},
0
);
}
};
$scope
.
$on
(
eventHandlerService
.
MSG_EVENT
,
function
(
ngEvent
,
event
,
isLive
)
{
if
(
isLive
&&
event
.
room_id
===
$scope
.
room_id
)
{
// 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
();
}
scrollToBottom
();
if
(
window
.
Notification
)
{
// Show notification when the user is idle
...
...
@@ -80,6 +81,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
$scope
.
$on
(
eventHandlerService
.
MEMBER_EVENT
,
function
(
ngEvent
,
event
,
isLive
)
{
if
(
isLive
)
{
scrollToBottom
();
updateMemberList
(
event
);
}
});
...
...
@@ -288,6 +290,8 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
return
;
}
scrollToBottom
(
true
);
var
promise
;
var
isCmd
=
false
;
...
...
@@ -614,7 +618,8 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
};
$scope
.
sendImage
=
function
(
url
,
body
)
{
scrollToBottom
(
true
);
matrixService
.
sendImageMessage
(
$scope
.
room_id
,
url
,
body
).
then
(
function
()
{
console
.
log
(
"
Image sent
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment