Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
solid-xmpp-chat
Manage
Activity
Members
Labels
Plan
Issues
45
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Components
solid-xmpp-chat
Commits
3873fb4b
Commit
3873fb4b
authored
4 years ago
by
ubermanu
Browse files
Options
Downloads
Patches
Plain Diff
add debug infos
parent
546581d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!113
History, Reply to messages and RAI
,
!110
History loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/sib-history-improved.js
+6
-0
6 additions, 0 deletions
src/plugins/sib-history-improved.js
with
6 additions
and
0 deletions
src/plugins/sib-history-improved.js
+
6
−
0
View file @
3873fb4b
...
@@ -37,6 +37,7 @@ converse.plugins.add('sib-history-improved', {
...
@@ -37,6 +37,7 @@ converse.plugins.add('sib-history-improved', {
},
},
initialize
()
{
initialize
()
{
const
{
api
}
=
this
.
_converse
;
const
{
api
}
=
this
.
_converse
;
const
{
log
}
=
converse
.
env
;
let
counter
=
0
;
let
counter
=
0
;
// Forces the loading of the real number of messages (or more)
// Forces the loading of the real number of messages (or more)
...
@@ -53,10 +54,13 @@ converse.plugins.add('sib-history-improved', {
...
@@ -53,10 +54,13 @@ converse.plugins.add('sib-history-improved', {
// Stop if there are less messages available than the page size
// Stop if there are less messages available than the page size
// Stop if the counter registers more messages than the max value
// Stop if the counter registers more messages than the max value
if
(
!
max
||
messages
.
length
<
max
||
counter
>=
max
)
{
if
(
!
max
||
messages
.
length
<
max
||
counter
>=
max
)
{
log
.
debug
(
`Chatbox has enough messages or cannot get more, count:
${
counter
}
`
);
counter
=
0
;
counter
=
0
;
return
;
return
;
}
}
log
.
debug
(
`Chatbox needs more messages, count:
${
counter
}
`
);
const
is_groupchat
=
data
.
chatbox
.
get
(
'
type
'
)
===
converse
.
CHATROOMS_TYPE
;
const
is_groupchat
=
data
.
chatbox
.
get
(
'
type
'
)
===
converse
.
CHATROOMS_TYPE
;
const
oldest_message
=
messages
.
pop
();
const
oldest_message
=
messages
.
pop
();
...
@@ -65,10 +69,12 @@ converse.plugins.add('sib-history-improved', {
...
@@ -65,10 +69,12 @@ converse.plugins.add('sib-history-improved', {
const
stanza_id
=
oldest_message
&&
oldest_message
[
'
stanza_id
'
.
concat
(
by_jid
)];
const
stanza_id
=
oldest_message
&&
oldest_message
[
'
stanza_id
'
.
concat
(
by_jid
)];
if
(
stanza_id
)
{
if
(
stanza_id
)
{
log
.
debug
(
`Loading messages before stanza:
${
stanza_id
}
`
);
await
data
.
chatbox
.
fetchArchivedMessages
({
await
data
.
chatbox
.
fetchArchivedMessages
({
'
before
'
:
stanza_id
,
'
before
'
:
stanza_id
,
});
});
}
else
{
}
else
{
log
.
debug
(
`Loading messages before time:
${
oldest_message
[
'
time
'
]}
`
);
await
data
.
chatbox
.
fetchArchivedMessages
({
await
data
.
chatbox
.
fetchArchivedMessages
({
'
end
'
:
oldest_message
[
'
time
'
],
'
end
'
:
oldest_message
[
'
time
'
],
});
});
...
...
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