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
b307d517
Commit
b307d517
authored
Apr 25, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Date handling is now done with moment.js
parent
22c72430
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
80 deletions
+38
-80
converse.js
converse.js
+27
-71
docs/CHANGES.rst
docs/CHANGES.rst
+1
-0
spec/chatbox.js
spec/chatbox.js
+10
-9
No files found.
converse.js
View file @
b307d517
This diff is collapsed.
Click to expand it.
docs/CHANGES.rst
View file @
b307d517
...
...
@@ -9,6 +9,7 @@ Changelog
2. Configuration options for the chat toolbar have changed.
Please refer to the `relevant documentation http://devbox:8890/docs/html/index.html#visible-toolbar-buttons`_.
* All date handling is now done with moment.js. [jcbrand]
* Add a new toolbar button for clearing chat messages. [jcbrand]
* Chat boxes and rooms can now be resized vertically. [jcbrand]
* Upgraded many dependencies to their latest versions. [jcbrand]
...
...
spec/chatbox.js
View file @
b307d517
...
...
@@ -57,7 +57,7 @@
chatbox
=
utils
.
openChatBoxFor
(
contact_jid
);
chatboxview
=
this
.
chatboxviews
.
get
(
contact_jid
);
spyOn
(
chatboxview
,
'
focus
'
);
var
$el
=
this
.
rosterview
.
$el
.
find
(
'
a.open-chat:contains("
'
+
chatbox
.
get
(
'
fullname
'
)
+
'
")
'
);
$el
=
this
.
rosterview
.
$el
.
find
(
'
a.open-chat:contains("
'
+
chatbox
.
get
(
'
fullname
'
)
+
'
")
'
);
jid
=
$el
.
text
().
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
view
=
this
.
rosterview
.
get
(
jid
);
spyOn
(
view
,
'
openChat
'
).
andCallThrough
();
...
...
@@ -291,7 +291,7 @@
spyOn
(
converse
,
'
emit
'
);
// First check that the button doesn't show if it's not enabled
// via "visible_toolbar_buttons"
converse
.
visible_toolbar_buttons
[
'
call
'
]
=
false
;
converse
.
visible_toolbar_buttons
.
call
=
false
;
utils
.
openChatBoxFor
(
contact_jid
);
view
=
this
.
chatboxviews
.
get
(
contact_jid
);
$toolbar
=
view
.
$el
.
find
(
'
ul.chat-toolbar
'
);
...
...
@@ -300,7 +300,7 @@
view
.
closeChat
();
// Now check that it's shown if enabled and that it emits
// onCallButtonClicked
converse
.
visible_toolbar_buttons
[
'
call
'
]
=
true
;
// enable the button
converse
.
visible_toolbar_buttons
.
call
=
true
;
// enable the button
utils
.
openChatBoxFor
(
contact_jid
);
view
=
this
.
chatboxviews
.
get
(
contact_jid
);
$toolbar
=
view
.
$el
.
find
(
'
ul.chat-toolbar
'
);
...
...
@@ -315,7 +315,7 @@
var
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
// First check that the button doesn't show if it's not enabled
// via "visible_toolbar_buttons"
converse
.
visible_toolbar_buttons
[
'
clear
'
]
=
false
;
converse
.
visible_toolbar_buttons
.
clear
=
false
;
utils
.
openChatBoxFor
(
contact_jid
);
view
=
this
.
chatboxviews
.
get
(
contact_jid
);
view
=
this
.
chatboxviews
.
get
(
contact_jid
);
...
...
@@ -325,7 +325,7 @@
view
.
closeChat
();
// Now check that it's shown if enabled and that it calls
// clearMessages
converse
.
visible_toolbar_buttons
[
'
clear
'
]
=
true
;
// enable the button
converse
.
visible_toolbar_buttons
.
clear
=
true
;
// enable the button
utils
.
openChatBoxFor
(
contact_jid
);
view
=
this
.
chatboxviews
.
get
(
contact_jid
);
$toolbar
=
view
.
$el
.
find
(
'
ul.chat-toolbar
'
);
...
...
@@ -470,7 +470,8 @@
var
contact_jid
=
contact_name
.
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
utils
.
clearChatBoxMessages
(
contact_jid
);
var
one_day_ago
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
-
1
));
var
one_day_ago
=
moment
()
one_day_ago
.
subtract
(
'
days
'
,
1
);
var
message
=
'
This is a day old message
'
;
var
chatbox
=
this
.
chatboxes
.
get
(
contact_jid
);
var
chatboxview
=
this
.
chatboxviews
.
get
(
contact_jid
);
...
...
@@ -483,9 +484,9 @@
from
:
contact_jid
,
to
:
this
.
connection
.
jid
,
type
:
'
chat
'
,
id
:
one_day_ago
.
getTime
()
id
:
one_day_ago
.
unix
()
}).
c
(
'
body
'
).
t
(
message
).
up
()
.
c
(
'
delay
'
,
{
xmlns
:
'
urn:xmpp:delay
'
,
from
:
'
localhost
'
,
stamp
:
converse
.
toISOString
(
one_day_ago
)
})
.
c
(
'
delay
'
,
{
xmlns
:
'
urn:xmpp:delay
'
,
from
:
'
localhost
'
,
stamp
:
one_day_ago
.
format
(
)
})
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
();
this
.
chatboxes
.
onMessage
(
msg
);
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onMessage
'
,
msg
);
...
...
@@ -517,7 +518,7 @@
expect
(
$time
.
length
).
toEqual
(
1
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
chat-date
'
);
expect
(
$time
.
attr
(
'
datetime
'
)).
toEqual
(
moment
(
message_date
).
format
(
"
YYYY-MM-DD
"
));
expect
(
$time
.
text
()).
toEqual
(
moment
(
message_date
).
format
(
"
dddd
, M
MMM Do YYYY
"
));
expect
(
$time
.
text
()).
toEqual
(
moment
(
message_date
).
format
(
"
dddd
MMM Do YYYY
"
));
// Normal checks for the 2nd message
expect
(
chatbox
.
messages
.
length
).
toEqual
(
2
);
...
...
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