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
59e216ad
Commit
59e216ad
authored
Oct 28, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
muc: no need for `message_queue`...
since we create the `fetched` promise earlier
parent
c750748b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
38 deletions
+2
-38
spec/smacks.js
spec/smacks.js
+2
-7
src/headless/converse-muc.js
src/headless/converse-muc.js
+0
-31
No files found.
spec/smacks.js
View file @
59e216ad
...
...
@@ -262,17 +262,12 @@ describe("XEP-0198 Stream Management", function () {
await
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
);
const
muc
=
_converse
.
chatboxes
.
get
(
muc_jid
);
await
u
.
waitUntil
(()
=>
muc
.
message_queue
.
length
===
1
);
const
view
=
_converse
.
chatboxviews
.
get
(
muc_jid
);
await
mock
.
getRoomFeatures
(
_converse
,
muc_jid
);
await
mock
.
receiveOwnMUCPresence
(
_converse
,
muc_jid
,
nick
);
await
u
.
waitUntil
(()
=>
(
view
.
model
.
session
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
ENTERED
));
await
view
.
model
.
messages
.
fetched
;
await
u
.
waitUntil
(()
=>
(
muc
.
session
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
ENTERED
));
await
muc
.
messages
.
fetched
;
await
u
.
waitUntil
(()
=>
muc
.
messages
.
length
);
expect
(
muc
.
messages
.
at
(
0
).
get
(
'
message
'
)).
toBe
(
'
First message
'
)
delete
_converse
.
no_connection_on_bind
;
done
();
}));
...
...
src/headless/converse-muc.js
View file @
59e216ad
...
...
@@ -475,13 +475,6 @@ converse.plugins.add('converse-muc', {
return
this
;
},
async
fetchMessages
()
{
await
_converse
.
ChatBox
.
prototype
.
fetchMessages
.
call
(
this
);
const
queued_messages
=
this
.
message_queue
.
map
(
m
=>
this
.
queueMessage
(
m
));
this
.
message_queue
=
[];
return
Promise
.
all
(
queued_messages
);
},
async
clearCache
()
{
this
.
session
.
save
(
'
connection_status
'
,
converse
.
ROOMSTATUS
.
DISCONNECTED
);
if
(
this
.
occupants
.
length
)
{
...
...
@@ -533,11 +526,6 @@ converse.plugins.add('converse-muc', {
return
this
.
join
();
},
initMessages
()
{
this
.
message_queue
=
[];
_converse
.
ChatBox
.
prototype
.
initMessages
.
call
(
this
);
},
async
onConnectionStatusChanged
()
{
if
(
this
.
session
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
ENTERED
)
{
await
this
.
occupants
.
fetchMembers
();
...
...
@@ -1935,24 +1923,6 @@ converse.plugins.add('converse-muc', {
return
false
;
},
/**
* Queue an incoming message stanza meant for this {@link _converse.Chatroom} for processing.
* @async
* @private
* @method _converse.ChatRoom#queueMessage
* @param { Promise<MessageAttributes> } attrs - A promise which resolves to the message attributes
*/
queueMessage
(
attrs
)
{
if
(
this
.
messages
?.
fetched
)
{
this
.
msg_chain
=
(
this
.
msg_chain
||
this
.
messages
.
fetched
);
this
.
msg_chain
=
this
.
msg_chain
.
then
(()
=>
this
.
onMessage
(
attrs
));
return
this
.
msg_chain
;
}
else
{
this
.
message_queue
.
push
(
attrs
);
return
Promise
.
resolve
();
}
},
/**
* @param {String} actor - The nickname of the actor that caused the notification
* @param {String|Array<String>} states - The state or states representing the type of notificcation
...
...
@@ -2752,7 +2722,6 @@ converse.plugins.add('converse-muc', {
const
muc
=
_converse
.
chatboxes
.
get
(
muc_jid
);
if
(
muc
)
{
await
muc
.
initialized
;
await
muc
.
messages
.
fetched
muc
.
message_handler
.
run
(
stanza
);
}
});
...
...
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