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
3b8c2d1b
Commit
3b8c2d1b
authored
Aug 16, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various bug and timing fixes due to the previous refactoring
parent
694eabfc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
61 deletions
+84
-61
spec/chatbox.js
spec/chatbox.js
+19
-8
src/converse-chatboxes.js
src/converse-chatboxes.js
+2
-2
src/converse-chatview.js
src/converse-chatview.js
+2
-2
src/converse-controlbox.js
src/converse-controlbox.js
+10
-7
src/converse-minimize.js
src/converse-minimize.js
+26
-21
src/converse-vcard.js
src/converse-vcard.js
+25
-21
No files found.
spec/chatbox.js
View file @
3b8c2d1b
...
...
@@ -1755,31 +1755,42 @@
test_utils
.
openContactsPanel
(
_converse
);
test_utils
.
waitUntil
(
function
()
{
return
_converse
.
rosterview
.
$el
.
find
(
'
dt
'
).
length
;
},
3
00
).
then
(
function
()
{
},
5
00
).
then
(
function
()
{
// Make the timeouts shorter so that we can test
_converse
.
TIMEOUTS
.
PAUSED
=
200
;
_converse
.
TIMEOUTS
.
INACTIVE
=
200
;
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
return
test_utils
.
waitUntil
(
function
()
{
return
view
.
model
.
get
(
'
chat_state
'
)
===
'
active
'
;
},
500
);
}).
then
(
function
()
{
console
.
log
(
'
chat_state set to active
'
);
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
view
.
keyPressed
({
target
:
view
.
$el
.
find
(
'
textarea.chat-textarea
'
),
keyCode
:
1
});
return
test_utils
.
waitUntil
(
function
()
{
return
view
.
model
.
get
(
'
chat_state
'
)
===
'
composing
'
;
},
500
);
}).
then
(
function
()
{
console
.
log
(
'
chat_state set to composing
'
);
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
composing
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
return
test_utils
.
waitUntil
(
function
()
{
if
(
view
.
model
.
get
(
'
chat_state
'
)
===
'
paused
'
)
{
return
true
;
}
return
false
;
},
300
);
return
view
.
model
.
get
(
'
chat_state
'
)
===
'
paused
'
;
},
500
);
}).
then
(
function
()
{
console
.
log
(
'
chat_state set to paused
'
);
return
test_utils
.
waitUntil
(
function
()
{
return
view
.
model
.
get
(
'
chat_state
'
)
===
'
inactive
'
;
},
3
00
);
},
5
00
);
}).
then
(
function
()
{
console
.
log
(
'
chat_state set to inactive
'
);
expect
(
_converse
.
connection
.
send
).
toHaveBeenCalled
();
var
calls
=
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
function
(
call
)
{
return
call
.
args
[
0
]
instanceof
Strophe
.
Builder
;
...
...
@@ -1799,7 +1810,7 @@
expect
(
$stanza
.
children
().
get
(
1
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$stanza
.
children
().
get
(
2
).
tagName
).
toBe
(
'
no-permanent-store
'
);
done
();
});
})
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
;
}));
it
(
"
is sent when the user a minimizes a chat box
"
,
...
...
src/converse-chatboxes.js
View file @
3b8c2d1b
...
...
@@ -325,8 +325,8 @@
});
_converse
.
api
.
listen
.
on
(
'
beforeTearDown
'
,
()
=>
{
this
.
chatboxes
.
remove
();
// Don't call off(), events won't get re-registered upon reconnect.
delete
this
.
chatboxes
.
browserStorage
;
_converse
.
chatboxes
.
remove
();
// Don't call off(), events won't get re-registered upon reconnect.
delete
_converse
.
chatboxes
.
browserStorage
;
});
// END: Event handlers
...
...
src/converse-chatview.js
View file @
3b8c2d1b
src/converse-controlbox.js
View file @
3b8c2d1b
...
...
@@ -93,8 +93,9 @@
this
.
__super__
.
onChatBoxesFetched
.
apply
(
this
,
arguments
);
const
{
_converse
}
=
this
.
__super__
;
if
(
!
_
.
includes
(
_
.
map
(
collection
,
'
id
'
),
'
controlbox
'
))
{
_converse
.
addControlBox
(
{
'
connected
'
:
true
}
);
_converse
.
addControlBox
();
}
this
.
get
(
'
controlbox
'
).
save
({
connected
:
true
});
},
},
...
...
@@ -184,13 +185,13 @@
const
LABEL_CONTACTS
=
__
(
'
Contacts
'
);
_converse
.
addControlBox
=
(
settings
)
=>
{
_converse
.
chatboxes
.
add
(
_
.
assign
(
{
_converse
.
addControlBox
=
()
=>
{
_converse
.
chatboxes
.
add
({
id
:
'
controlbox
'
,
box_id
:
'
controlbox
'
,
type
:
'
controlbox
'
,
closed
:
!
_converse
.
show_controlbox_by_default
}
,
settings
)
)
})
};
_converse
.
ControlBoxView
=
_converse
.
ChatBoxView
.
extend
({
...
...
@@ -211,9 +212,11 @@
this
.
model
.
on
(
'
show
'
,
this
.
show
,
this
);
this
.
model
.
on
(
'
change:closed
'
,
this
.
ensureClosedState
,
this
);
this
.
render
();
if
(
this
.
model
.
get
(
'
connected
'
))
{
_converse
.
api
.
waitUntil
(
'
rosterViewInitialized
'
)
.
then
(
this
.
insertRoster
.
bind
(
this
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
},
render
()
{
...
...
src/converse-minimize.js
View file @
3b8c2d1b
...
...
@@ -242,7 +242,8 @@
// fullscreen. In this case we don't trim.
return
;
}
const
$minimized
=
_converse
.
minimized_chats
.
$el
,
_converse
.
api
.
waitUntil
(
'
chatBoxesInitialized
'
).
then
(()
=>
{
const
$minimized
=
_
.
get
(
_converse
.
minimized_chats
,
'
$el
'
),
minimized_width
=
_
.
includes
(
this
.
model
.
pluck
(
'
minimized
'
),
true
)
?
$minimized
.
outerWidth
(
true
)
:
0
,
new_id
=
newchat
?
newchat
.
model
.
get
(
'
id
'
)
:
null
;
...
...
@@ -265,6 +266,7 @@
oldest_chat
.
minimize
();
}
}
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
},
getOldestMaximizedChat
(
exclude_ids
)
{
...
...
@@ -303,6 +305,8 @@
no_trimming
:
false
,
// Set to true for phantomjs tests (where browser apparently has no width)
});
_converse
.
api
.
promises
.
add
(
'
minimizedChatsInitialized
'
);
_converse
.
MinimizedChatBoxView
=
Backbone
.
View
.
extend
({
tagName
:
'
div
'
,
className
:
'
chat-head
'
,
...
...
@@ -490,6 +494,7 @@
_converse
.
minimized_chats
=
new
_converse
.
MinimizedChats
({
model
:
_converse
.
chatboxes
});
_converse
.
emit
(
'
minimizedChatsInitialized
'
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
_converse
.
on
(
'
chatBoxOpened
'
,
function
renderMinimizeButton
(
view
)
{
...
...
src/converse-vcard.js
View file @
3b8c2d1b
...
...
@@ -131,7 +131,10 @@
});
const
updateVCardForChatBox
=
function
(
chatbox
)
{
if
(
!
_converse
.
use_vcards
)
{
return
;
}
if
(
!
_converse
.
use_vcards
||
chatbox
.
model
.
get
(
'
type
'
)
===
'
headline
'
)
{
return
;
}
_converse
.
api
.
waitUntil
(
'
rosterInitialized
'
).
then
(()
=>
{
const
jid
=
chatbox
.
model
.
get
(
'
jid
'
),
contact
=
_converse
.
roster
.
get
(
jid
);
if
((
contact
)
&&
(
!
contact
.
get
(
'
vcard_updated
'
)))
{
...
...
@@ -153,6 +156,7 @@
}
);
}
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
};
_converse
.
on
(
'
chatBoxInitialized
'
,
updateVCardForChatBox
);
...
...
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