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
fa85fc71
Commit
fa85fc71
authored
Mar 22, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use async/await
parent
76b32bea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
66 deletions
+45
-66
dist/converse.js
dist/converse.js
+22
-32
src/converse-mam-views.js
src/converse-mam-views.js
+23
-34
No files found.
dist/converse.js
View file @
fa85fc71
...
...
@@ -52439,7 +52439,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
});
},
fetchArchivedMessages(options) {
async
fetchArchivedMessages(options) {
const _converse = this.__super__._converse;
if (this.disable_mam) {
...
...
@@ -52457,17 +52457,15 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
message_handler = _converse.chatboxes.onMessage.bind(_converse.chatboxes);
}
_converse.api.disco.supports(Strophe.NS.MAM, mam_jid).then(results => {
// Success
if (!results
.length) {
const supported = await _converse.api.disco.supports(Strophe.NS.MAM, mam_jid);
if (!supported
.length) {
return;
}
this.addSpinner();
_converse.api.archive.query( // TODO: only query from the last message we have
// in our history
_.extend({
_converse.api.archive.query(_.extend({
'groupchat': is_groupchat,
'before': '',
// Page backwards from the most recent message
...
...
@@ -52486,14 +52484,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.log(e, Strophe.LogLevel.ERROR);
});
}, () => {
// Error
_converse.log("Error or timeout while checking for MAM support", Strophe.LogLevel.ERROR);
}).catch(msg => {
this.clearSpinner();
_converse.log(msg, Strophe.LogLevel.FATAL);
});
},
onScroll(ev) {
src/converse-mam-views.js
View file @
fa85fc71
...
...
@@ -80,7 +80,7 @@ converse.plugins.add('converse-mam-views', {
});
},
fetchArchivedMessages
(
options
)
{
async
fetchArchivedMessages
(
options
)
{
const
{
_converse
}
=
this
.
__super__
;
if
(
this
.
disable_mam
)
{
return
;
}
...
...
@@ -95,20 +95,20 @@ converse.plugins.add('converse-mam-views', {
message_handler
=
_converse
.
chatboxes
.
onMessage
.
bind
(
_converse
.
chatboxes
)
}
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
MAM
,
mam_jid
).
then
(
(
results
)
=>
{
// Success
if
(
!
results
.
length
)
{
return
;
}
const
supported
=
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
MAM
,
mam_jid
);
if
(
!
supported
.
length
)
{
return
;
}
this
.
addSpinner
();
_converse
.
api
.
archive
.
query
(
// TODO: only query from the last message we have
// in our history
_
.
extend
({
'
groupchat
'
:
is_groupchat
,
'
before
'
:
''
,
// Page backwards from the most recent message
'
max
'
:
_converse
.
archived_messages_page_size
,
'
with
'
:
this
.
model
.
get
(
'
jid
'
),
},
options
),
(
messages
)
=>
{
// Success
messages
=>
{
// Success
this
.
clearSpinner
();
_
.
each
(
messages
,
message_handler
);
},
...
...
@@ -121,17 +121,6 @@ converse.plugins.add('converse-mam-views', {
}
);
},
()
=>
{
// Error
_converse
.
log
(
"
Error or timeout while checking for MAM support
"
,
Strophe
.
LogLevel
.
ERROR
);
}
).
catch
((
msg
)
=>
{
this
.
clearSpinner
();
_converse
.
log
(
msg
,
Strophe
.
LogLevel
.
FATAL
);
});
},
onScroll
(
ev
)
{
const
{
_converse
}
=
this
.
__super__
;
...
...
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