Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
f7bca06b
Commit
f7bca06b
authored
Aug 09, 2016
by
Vladimir Baranov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rref #5392. Don't try to restore scroll position if new messages not loaded
parent
2b3db94c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
messaging.js
app/components/messaging/messaging.js
+13
-6
No files found.
app/components/messaging/messaging.js
View file @
f7bca06b
...
@@ -276,6 +276,9 @@ angular.module("ulakbus.messaging")
...
@@ -276,6 +276,9 @@ angular.module("ulakbus.messaging")
iScope
.
selectedChannel
=
result
;
iScope
.
selectedChannel
=
result
;
iScope
.
selectedChannel
.
read_only
=
channel
.
read_only
;
iScope
.
selectedChannel
.
read_only
=
channel
.
read_only
;
iScope
.
selectedChannel
.
messages
=
result
.
last_messages
;
iScope
.
selectedChannel
.
messages
=
result
.
last_messages
;
if
(
iScope
.
selectedChannel
.
messages
.
length
<
15
){
iScope
.
allMessagesLoaded
=
true
;
}
updateLastMessage
(
channel
.
messages
);
updateLastMessage
(
channel
.
messages
);
reportLastSeenMessage
();
reportLastSeenMessage
();
});
});
...
@@ -380,6 +383,7 @@ angular.module("ulakbus.messaging")
...
@@ -380,6 +383,7 @@ angular.module("ulakbus.messaging")
}
}
// prepend loaded messages to current channel messages list
// prepend loaded messages to current channel messages list
messages
.
unshift
.
apply
(
messages
,
result
.
messages
);
messages
.
unshift
.
apply
(
messages
,
result
.
messages
);
return
true
;
});
});
}
}
};
};
...
@@ -460,14 +464,17 @@ angular.module("ulakbus.messaging")
...
@@ -460,14 +464,17 @@ angular.module("ulakbus.messaging")
var
id
=
elem
.
find
(
"[id]"
).
first
().
attr
(
'id'
);
var
id
=
elem
.
find
(
"[id]"
).
first
().
attr
(
'id'
);
$timeout
(
function
(){
iScope
.
loading
=
true
});
$timeout
(
function
(){
iScope
.
loading
=
true
});
$q
.
when
(
iScope
.
loadMoreCallback
())
$q
.
when
(
iScope
.
loadMoreCallback
())
.
finally
(
function
(){
.
finally
(
function
(
loaded
){
$timeout
(
function
(){
$timeout
(
function
(){
iScope
.
loading
=
false
;
iScope
.
loading
=
false
;
// try to restore last scroll position;
// if new elements loaded
var
lastTopElem
=
elem
.
find
(
"#"
+
id
);
if
(
loaded
){
if
(
lastTopElem
){
// try to restore last scroll position;
var
top
=
lastTopElem
.
offset
().
top
-
elem
.
offset
().
top
-
100
;
var
lastTopElem
=
elem
.
find
(
"#"
+
id
);
elem
.
scrollTop
(
top
);
if
(
lastTopElem
){
var
top
=
lastTopElem
.
offset
().
top
-
elem
.
offset
().
top
-
100
;
elem
.
scrollTop
(
top
);
}
}
}
});
});
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment