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
63a0c639
Commit
63a0c639
authored
Mar 29, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bugs with moving events
parent
f8977035
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
192 additions
and
179 deletions
+192
-179
dist/converse.js
dist/converse.js
+138
-126
spec/roster.js
spec/roster.js
+2
-2
src/converse-minimize.js
src/converse-minimize.js
+6
-6
src/converse-roomslist.js
src/converse-roomslist.js
+6
-6
src/converse-rosterview.js
src/converse-rosterview.js
+7
-8
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+10
-11
src/headless/converse-core.js
src/headless/converse-core.js
+3
-2
src/headless/converse-roster.js
src/headless/converse-roster.js
+1
-0
src/headless/dist/converse-headless.js
src/headless/dist/converse-headless.js
+14
-11
tests/mock.js
tests/mock.js
+5
-7
No files found.
dist/converse.js
View file @
63a0c639
This diff is collapsed.
Click to expand it.
spec/roster.js
View file @
63a0c639
...
@@ -32,11 +32,11 @@
...
@@ -32,11 +32,11 @@
it
(
"
is populated once we have registered a presence handler
"
,
it
(
"
is populated once we have registered a presence handler
"
,
mock
.
initConverse
(
mock
.
initConverse
(
{
'
_converse
'
:
[
'
emit
'
]},
null
,
{},
null
,
[
'
rosterGroupsFetched
'
]
,
{},
async
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
spyOn
(
_converse
.
api
,
"
trigger
"
).
and
.
callThrough
();
const
IQs
=
_converse
.
connection
.
IQ_stanzas
;
const
IQs
=
_converse
.
connection
.
IQ_stanzas
;
await
test_utils
.
waitUntil
(()
=>
_converse
.
api
.
trigger
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterGroupsFetched
'
));
const
node
=
await
test_utils
.
waitUntil
(
const
node
=
await
test_utils
.
waitUntil
(
()
=>
_
.
filter
(
IQs
,
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq query[xmlns="jabber:iq:roster"]
'
)).
pop
());
()
=>
_
.
filter
(
IQs
,
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq query[xmlns="jabber:iq:roster"]
'
)).
pop
());
expect
(
_converse
.
api
.
trigger
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterContactsFetched
'
)).
toBeFalsy
();
expect
(
_converse
.
api
.
trigger
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterContactsFetched
'
)).
toBeFalsy
();
...
...
src/converse-minimize.js
View file @
63a0c639
...
@@ -400,12 +400,6 @@ converse.plugins.add('converse-minimize', {
...
@@ -400,12 +400,6 @@ converse.plugins.add('converse-minimize', {
this
.
model
.
on
(
"
destroy
"
,
this
.
removeChat
,
this
);
this
.
model
.
on
(
"
destroy
"
,
this
.
removeChat
,
this
);
this
.
model
.
on
(
"
change:minimized
"
,
this
.
onChanged
,
this
);
this
.
model
.
on
(
"
change:minimized
"
,
this
.
onChanged
,
this
);
this
.
model
.
on
(
'
change:num_unread
'
,
this
.
updateUnreadMessagesCounter
,
this
);
this
.
model
.
on
(
'
change:num_unread
'
,
this
.
updateUnreadMessagesCounter
,
this
);
/**
* Triggered once the _converse.MinimizedChats instance has been * initialized
* @event _converse#minimizedChatsInitialized
* @example _converse.api.listen.on('minimizedChatsInitialized', () => { ... });
*/
_converse
.
api
.
trigger
(
'
minimizedChatsInitialized
'
);
},
},
render
()
{
render
()
{
...
@@ -533,6 +527,12 @@ converse.plugins.add('converse-minimize', {
...
@@ -533,6 +527,12 @@ converse.plugins.add('converse-minimize', {
_converse
.
minimized_chats
=
new
_converse
.
MinimizedChats
({
_converse
.
minimized_chats
=
new
_converse
.
MinimizedChats
({
model
:
_converse
.
chatboxes
model
:
_converse
.
chatboxes
});
});
/**
* Triggered once the _converse.MinimizedChats instance has been * initialized
* @event _converse#minimizedChatsInitialized
* @example _converse.api.listen.on('minimizedChatsInitialized', () => { ... });
*/
_converse
.
api
.
trigger
(
'
minimizedChatsInitialized
'
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
...
...
src/converse-roomslist.js
View file @
63a0c639
...
@@ -177,12 +177,6 @@ converse.plugins.add('converse-roomslist', {
...
@@ -177,12 +177,6 @@ converse.plugins.add('converse-roomslist', {
this
.
list_model
.
fetch
();
this
.
list_model
.
fetch
();
this
.
render
();
this
.
render
();
this
.
sortAndPositionAllItems
();
this
.
sortAndPositionAllItems
();
/**
* Triggered once the _converse.RoomsListView has been created and initialized.
* @event _converse#roomsListInitialized
* @example _converse.api.listen.on('roomsListInitialized', status => { ... });
*/
_converse
.
api
.
trigger
(
'
roomsListInitialized
'
);
},
},
render
()
{
render
()
{
...
@@ -276,6 +270,12 @@ converse.plugins.add('converse-roomslist', {
...
@@ -276,6 +270,12 @@ converse.plugins.add('converse-roomslist', {
model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
_converse
.
rooms_list_view
=
new
_converse
.
RoomsListView
({
'
model
'
:
model
});
_converse
.
rooms_list_view
=
new
_converse
.
RoomsListView
({
'
model
'
:
model
});
/**
* Triggered once the _converse.RoomsListView has been created and initialized.
* @event _converse#roomsListInitialized
* @example _converse.api.listen.on('roomsListInitialized', status => { ... });
*/
_converse
.
api
.
trigger
(
'
roomsListInitialized
'
);
};
};
_converse
.
api
.
listen
.
on
(
'
connected
'
,
async
()
=>
{
_converse
.
api
.
listen
.
on
(
'
connected
'
,
async
()
=>
{
...
...
src/converse-rosterview.js
View file @
63a0c639
...
@@ -824,14 +824,6 @@ converse.plugins.add('converse-rosterview', {
...
@@ -824,14 +824,6 @@ converse.plugins.add('converse-rosterview', {
this
.
trigger
(
'
rosterContactsFetchedAndProcessed
'
);
this
.
trigger
(
'
rosterContactsFetchedAndProcessed
'
);
});
});
this
.
createRosterFilter
();
this
.
createRosterFilter
();
_converse
.
rosterview
.
render
();
/**
* Triggered once the _converse.RosterView instance has been created and initialized.
* @event _converse#rosterViewInitialized
* @example _converse.api.listen.on('rosterViewInitialized', () => { ... });
*/
_converse
.
api
.
trigger
(
'
rosterViewInitialized
'
);
},
},
render
()
{
render
()
{
...
@@ -1039,6 +1031,13 @@ converse.plugins.add('converse-rosterview', {
...
@@ -1039,6 +1031,13 @@ converse.plugins.add('converse-rosterview', {
_converse
.
rosterview
=
new
_converse
.
RosterView
({
_converse
.
rosterview
=
new
_converse
.
RosterView
({
'
model
'
:
_converse
.
rostergroups
'
model
'
:
_converse
.
rostergroups
});
});
_converse
.
rosterview
.
render
();
/**
* Triggered once the _converse.RosterView instance has been created and initialized.
* @event _converse#rosterViewInitialized
* @example _converse.api.listen.on('rosterViewInitialized', () => { ... });
*/
_converse
.
api
.
trigger
(
'
rosterViewInitialized
'
);
}
}
_converse
.
api
.
listen
.
on
(
'
rosterInitialized
'
,
initRoster
);
_converse
.
api
.
listen
.
on
(
'
rosterInitialized
'
,
initRoster
);
_converse
.
api
.
listen
.
on
(
'
rosterReadyAfterReconnection
'
,
initRoster
);
_converse
.
api
.
listen
.
on
(
'
rosterReadyAfterReconnection
'
,
initRoster
);
...
...
src/headless/converse-chatboxes.js
View file @
63a0c639
...
@@ -761,16 +761,6 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -761,16 +761,6 @@ converse.plugins.add('converse-chatboxes', {
return
new
_converse
.
ChatBox
(
attrs
,
options
);
return
new
_converse
.
ChatBox
(
attrs
,
options
);
},
},
initialize
()
{
/**
* Triggered once the _converse.ChatBoxes collection has been initialized.
* @event _converse#chatBoxesInitialized
* @example _converse.api.listen.on('chatBoxesInitialized', () => { ... });
* @example _converse.api.waitUntil('chatBoxesInitialized').then(() => { ... });
*/
_converse
.
api
.
trigger
(
'
chatBoxesInitialized
'
);
},
registerMessageHandler
()
{
registerMessageHandler
()
{
_converse
.
connection
.
addHandler
(
stanza
=>
{
_converse
.
connection
.
addHandler
(
stanza
=>
{
this
.
onMessage
(
stanza
);
this
.
onMessage
(
stanza
);
...
@@ -1048,7 +1038,16 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -1048,7 +1038,16 @@ converse.plugins.add('converse-chatboxes', {
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
OUTOFBAND
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
OUTOFBAND
);
});
});
_converse
.
api
.
listen
.
on
(
'
pluginsInitialized
'
,
()
=>
(
_converse
.
chatboxes
=
new
_converse
.
ChatBoxes
()));
_converse
.
api
.
listen
.
on
(
'
pluginsInitialized
'
,
()
=>
{
_converse
.
chatboxes
=
new
_converse
.
ChatBoxes
();
/**
* Triggered once the _converse.ChatBoxes collection has been initialized.
* @event _converse#chatBoxesInitialized
* @example _converse.api.listen.on('chatBoxesInitialized', () => { ... });
* @example _converse.api.waitUntil('chatBoxesInitialized').then(() => { ... });
*/
_converse
.
api
.
trigger
(
'
chatBoxesInitialized
'
);
});
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
()
=>
_converse
.
chatboxes
.
onConnected
());
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
()
=>
_converse
.
chatboxes
.
onConnected
());
/************************ END Event Handlers ************************/
/************************ END Event Handlers ************************/
...
...
src/headless/converse-core.js
View file @
63a0c639
...
@@ -359,6 +359,7 @@ function initPlugins() {
...
@@ -359,6 +359,7 @@ function initPlugins() {
},
},
'
_converse
'
:
_converse
'
_converse
'
:
_converse
},
whitelist
,
_converse
.
blacklisted_plugins
);
},
whitelist
,
_converse
.
blacklisted_plugins
);
/**
/**
* Triggered once all plugins have been initialized. This is a useful event if you want to
* Triggered once all plugins have been initialized. This is a useful event if you want to
* register event handlers but would like your own handlers to be overridable by
* register event handlers but would like your own handlers to be overridable by
...
@@ -1404,9 +1405,9 @@ _converse.api = {
...
@@ -1404,9 +1405,9 @@ _converse.api = {
*
*
* @method _converse.api.trigger
* @method _converse.api.trigger
*/
*/
'
trigger
'
()
{
'
trigger
'
(
name
)
{
/* Event emitter and promise resolver */
/* Event emitter and promise resolver */
_converse
.
trigger
.
apply
(
this
,
arguments
);
_converse
.
trigger
.
apply
(
_converse
,
arguments
);
const
promise
=
_converse
.
promises
[
name
];
const
promise
=
_converse
.
promises
[
name
];
if
(
!
_
.
isUndefined
(
promise
))
{
if
(
!
_
.
isUndefined
(
promise
))
{
promise
.
resolve
();
promise
.
resolve
();
...
...
src/headless/converse-roster.js
View file @
63a0c639
...
@@ -109,6 +109,7 @@ converse.plugins.add('converse-roster', {
...
@@ -109,6 +109,7 @@ converse.plugins.add('converse-roster', {
* position roster groups.
* position roster groups.
* @event _converse#rosterGroupsFetched
* @event _converse#rosterGroupsFetched
* @example _converse.api.listen.on('rosterGroupsFetched', () => { ... });
* @example _converse.api.listen.on('rosterGroupsFetched', () => { ... });
* @example _converse.api.waitUntil('rosterGroupsFetched').then(() => { ... });
*/
*/
_converse
.
api
.
trigger
(
'
rosterGroupsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterGroupsFetched
'
);
await
_converse
.
roster
.
fetchRosterContacts
();
await
_converse
.
roster
.
fetchRosterContacts
();
...
...
src/headless/dist/converse-headless.js
View file @
63a0c639
...
@@ -41038,16 +41038,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -41038,16 +41038,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
return new _converse.ChatBox(attrs, options);
return new _converse.ChatBox(attrs, options);
},
},
initialize() {
/**
* Triggered once the _converse.ChatBoxes collection has been initialized.
* @event _converse#chatBoxesInitialized
* @example _converse.api.listen.on('chatBoxesInitialized', () => { ... });
* @example _converse.api.waitUntil('chatBoxesInitialized').then(() => { ... });
*/
_converse.api.trigger('chatBoxesInitialized');
},
registerMessageHandler() {
registerMessageHandler() {
_converse.connection.addHandler(stanza => {
_converse.connection.addHandler(stanza => {
this.onMessage(stanza);
this.onMessage(stanza);
...
@@ -41352,7 +41342,20 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -41352,7 +41342,20 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
_converse.api.disco.own.features.add(Strophe.NS.OUTOFBAND);
_converse.api.disco.own.features.add(Strophe.NS.OUTOFBAND);
});
});
_converse.api.listen.on('pluginsInitialized', () => _converse.chatboxes = new _converse.ChatBoxes());
_converse.api.listen.on('pluginsInitialized', () => {
_converse.chatboxes = new _converse.ChatBoxes();
_converse.emit('chatBoxesInitialized');
/**
* Triggered once the _converse.ChatBoxes collection has been initialized.
* @event _converse#chatBoxesInitialized
* @example _converse.api.listen.on('chatBoxesInitialized', () => { ... });
* @example _converse.api.waitUntil('chatBoxesInitialized').then(() => { ... });
*/
_converse.api.trigger('chatBoxesInitialized');
});
_converse.api.listen.on('presencesInitialized', () => _converse.chatboxes.onConnected());
_converse.api.listen.on('presencesInitialized', () => _converse.chatboxes.onConnected());
/************************ END Event Handlers ************************/
/************************ END Event Handlers ************************/
tests/mock.js
View file @
63a0c639
...
@@ -239,13 +239,11 @@
...
@@ -239,13 +239,11 @@
promise_names
=
null
promise_names
=
null
settings
=
null
;
settings
=
null
;
}
}
return
done
=>
{
return
async
done
=>
{
initConverse
(
settings
,
spies
).
then
(
_converse
=>
{
const
_converse
=
await
initConverse
(
settings
,
spies
);
const
promises
=
_
.
map
(
promise_names
,
_converse
.
api
.
waitUntil
);
const
promises
=
_
.
map
(
promise_names
,
_converse
.
api
.
waitUntil
);
Promise
.
all
(
promises
)
await
Promise
.
all
(
promises
);
.
then
(
_
.
partial
(
func
,
done
,
_converse
))
func
(
done
,
_converse
);
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
});
}
}
};
};
return
mock
;
return
mock
;
...
...
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