Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
2a81d2e6
Commit
2a81d2e6
authored
Dec 04, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converse-mam: Don't fetch MAM messages on each page load.
parent
3b3720c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
docs/CHANGES.md
docs/CHANGES.md
+1
-0
src/converse-mam.js
src/converse-mam.js
+4
-1
src/converse-muc.js
src/converse-muc.js
+6
-5
No files found.
docs/CHANGES.md
View file @
2a81d2e6
...
...
@@ -3,6 +3,7 @@
## 2.0.4 (Unreleased)
-
Bugfix. Switching from bookmarks form to config form shows only the spinner. [jcbrand]
-
Bugfix. Other room occupants sometimes not shown when reloading the page. [jcbrand]
-
Optimize fetching of MAM messages (in some cases happened on each page load). [jcbrand]
## 2.0.3 (2016-11-30)
-
#735 Room configuration button not visible. [jcbrand]
...
...
src/converse-mam.js
View file @
2a81d2e6
...
...
@@ -69,12 +69,15 @@
if
(
this
.
disable_mam
||
!
converse
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MAM
}))
{
return
this
.
__super__
.
afterMessagesFetched
.
apply
(
this
,
arguments
);
}
if
(
this
.
model
.
messages
.
length
<
converse
.
archived_messages_page_size
)
{
if
(
!
this
.
model
.
get
(
'
mam_initialized
'
)
&&
this
.
model
.
messages
.
length
<
converse
.
archived_messages_page_size
)
{
this
.
fetchArchivedMessages
({
'
before
'
:
''
,
// Page backwards from the most recent message
'
with
'
:
this
.
model
.
get
(
'
jid
'
),
'
max
'
:
converse
.
archived_messages_page_size
});
this
.
model
.
save
({
'
mam_initialized
'
:
true
});
}
return
this
.
__super__
.
afterMessagesFetched
.
apply
(
this
,
arguments
);
},
...
...
src/converse-muc.js
View file @
2a81d2e6
...
...
@@ -1583,6 +1583,7 @@
* Then, upon receiving them, call onChatRoomMessage
* so that they are displayed inside it.
*/
var
that
=
this
;
if
(
!
converse
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MAM
}))
{
converse
.
log
(
"
Attempted to fetch archived messages but this user's server doesn't support XEP-0313
"
);
return
;
...
...
@@ -1590,15 +1591,15 @@
this
.
addSpinner
();
converse_api
.
archive
.
query
(
_
.
extend
(
options
,
{
'
groupchat
'
:
true
}),
function
(
messages
)
{
th
is
.
clearSpinner
();
th
at
.
clearSpinner
();
if
(
messages
.
length
)
{
_
.
map
(
messages
,
th
is
.
onChatRoomMessage
.
bind
(
this
));
_
.
map
(
messages
,
th
at
.
onChatRoomMessage
.
bind
(
that
));
}
}
.
bind
(
this
)
,
},
function
()
{
th
is
.
clearSpinner
();
th
at
.
clearSpinner
();
converse
.
log
(
"
Error while trying to fetch archived messages
"
,
"
error
"
);
}
.
bind
(
this
)
}
);
}
});
...
...
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