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
fc2dfa8f
Commit
fc2dfa8f
authored
Jan 09, 2018
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
10066785
da1f1035
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
18 deletions
+55
-18
spec/chatbox.js
spec/chatbox.js
+39
-11
src/converse-chatview.js
src/converse-chatview.js
+16
-7
No files found.
spec/chatbox.js
View file @
fc2dfa8f
...
...
@@ -972,7 +972,7 @@
'
to
'
:
_converse
.
bare_jid
,
'
from
'
:
sender_jid
,
'
type
'
:
'
chat
'
})
.
c
(
'
body
'
).
t
(
"
message
from today
"
)
.
c
(
'
body
'
).
t
(
"
message
"
)
.
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
...
...
@@ -996,7 +996,7 @@
'
to
'
:
_converse
.
bare_jid
,
'
from
'
:
sender_jid
,
'
type
'
:
'
chat
'
})
.
c
(
'
body
'
).
t
(
"
Inbetween message
"
)
.
c
(
'
body
'
).
t
(
"
Inbetween message
"
)
.
up
()
.
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
...
...
@@ -1020,7 +1020,7 @@
'
to
'
:
_converse
.
bare_jid
,
'
from
'
:
sender_jid
,
'
type
'
:
'
chat
'
})
.
c
(
'
body
'
).
t
(
"
An earlier message
to
day
"
)
.
c
(
'
body
'
).
t
(
"
An earlier message
on the next
day
"
)
.
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
...
...
@@ -1032,7 +1032,31 @@
'
to
'
:
_converse
.
bare_jid
,
'
from
'
:
sender_jid
,
'
type
'
:
'
chat
'
})
.
c
(
'
body
'
).
t
(
"
newer message from today
"
)
.
c
(
'
body
'
).
t
(
"
newer message from the next day
"
)
.
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
// Insert <composing> message, to also check that
// text messages are inserted correctly with
// temporary chat events in the chat contents.
msg
=
$msg
({
'
id
'
:
'
aeb219
'
,
'
to
'
:
_converse
.
bare_jid
,
'
xmlns
'
:
'
jabber:client
'
,
'
from
'
:
sender_jid
,
'
type
'
:
'
chat
'
})
.
c
(
'
composing
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
}).
up
()
.
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
msg
=
$msg
({
'
id
'
:
'
aeb220
'
,
'
to
'
:
_converse
.
bare_jid
,
'
xmlns
'
:
'
jabber:client
'
,
'
from
'
:
sender_jid
,
'
type
'
:
'
chat
'
})
.
c
(
'
composing
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
}).
up
()
.
c
(
'
body
'
).
t
(
"
latest message
"
)
.
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
...
...
@@ -1041,7 +1065,7 @@
chatboxview
.
clearSpinner
();
//cleanup
var
$time
=
$chat_content
.
find
(
'
time
'
);
expect
(
$time
.
length
).
toEqual
(
3
);
expect
(
$time
.
length
).
toEqual
(
4
);
$time
=
$chat_content
.
find
(
'
time:first
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
'
2017-12-31T00:00:00+00:00
'
);
...
...
@@ -1058,15 +1082,19 @@
$el
=
$chat_content
.
find
(
'
.chat-message:eq(2)
'
);
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
another inbetween message
'
);
$time
=
$chat_content
.
find
(
'
time:
last
'
);
$time
=
$chat_content
.
find
(
'
time:
nth(2)
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
'
2018-01-02T00:00:00+00:00
'
);
expect
(
$time
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toBe
(
'
An earlier message
to
day
'
);
expect
(
$time
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toBe
(
'
An earlier message
on the next
day
'
);
$el
=
$chat_content
.
find
(
'
.chat-message:eq(3)
'
);
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
An earlier message
to
day
'
);
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
An earlier message
on the next
day
'
);
$el
=
$chat_content
.
find
(
'
.chat-message:eq(4)
'
);
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
message from today
'
);
expect
(
$el
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toEqual
(
'
newer message from today
'
);
expect
(
$el
.
find
(
'
.chat-msg-content
'
).
text
()).
toEqual
(
'
message
'
);
expect
(
$el
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toEqual
(
'
newer message from the next day
'
);
$time
=
$chat_content
.
find
(
'
time:last
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$time
[
0
].
nextElementSibling
.
querySelector
(
'
.chat-msg-content
'
).
textContent
).
toBe
(
'
latest message
'
);
done
();
});
}));
...
...
src/converse-chatview.js
View file @
fc2dfa8f
...
...
@@ -468,8 +468,14 @@
if
(
_
.
isNull
(
most_recent_date
)
||
moment
(
most_recent_date
).
isBefore
(
cutoff
))
{
return
most_recent_date
;
}
/* XXX: Besides .chat-message and .chat-date elements, there are also
* .chat-event elements. These are however temporary and
* removed once a new element is inserted into the chat
* area, so we don't query for them here, otherwise we get
* a null reference later upon element insertion.
*/
const
msg_dates
=
_
.
invokeMap
(
sizzle
(
'
.
message, .chat-info
'
,
this
.
content
),
sizzle
(
'
.
chat-message, .chat-date
'
,
this
.
content
),
Element
.
prototype
.
getAttribute
,
'
data-isodate
'
)
if
(
_
.
isObject
(
cutoff
))
{
...
...
@@ -498,7 +504,6 @@
* attributes.
*/
const
current_msg_date
=
moment
(
attrs
.
time
)
||
moment
,
prepend_html
=
_
.
bind
(
this
.
content
.
insertAdjacentHTML
,
this
.
content
,
'
afterbegin
'
),
previous_msg_date
=
this
.
getLastMessageDate
(
current_msg_date
),
message_el
=
this
.
renderMessage
(
attrs
);
...
...
@@ -622,6 +627,7 @@
}
else
if
(
message
.
get
(
'
chat_state
'
)
===
_converse
.
GONE
)
{
this
.
showStatusNotification
(
message
.
get
(
'
fullname
'
)
+
'
'
+
__
(
'
has gone away
'
));
}
return
message
;
},
shouldShowOnTextMessage
()
{
...
...
@@ -675,11 +681,14 @@
}
if
(
message
.
get
(
'
type
'
)
===
'
error
'
)
{
this
.
handleErrorMessage
(
message
);
}
else
if
(
!
message
.
get
(
'
message
'
))
{
this
.
handleChatStateMessage
(
message
);
}
else
{
if
(
message
.
get
(
'
chat_state
'
))
{
this
.
handleChatStateMessage
(
message
);
}
if
(
message
.
get
(
'
message
'
))
{
this
.
handleTextMessage
(
message
);
}
}
_converse
.
emit
(
'
messageAdded
'
,
{
'
message
'
:
message
,
'
chatbox
'
:
this
.
model
...
...
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