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
4f227b46
Commit
4f227b46
authored
Jan 10, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take all messages except chat events into consideration
when determining where to insert new messages
parent
e5b256e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
spec/chatbox.js
spec/chatbox.js
+2
-2
spec/chatroom.js
spec/chatroom.js
+4
-4
src/converse-chatview.js
src/converse-chatview.js
+6
-6
src/templates/new_day.html
src/templates/new_day.html
+1
-1
No files found.
spec/chatbox.js
View file @
4f227b46
...
...
@@ -1401,7 +1401,7 @@
var
$time
=
$chat_content
.
find
(
'
time
'
);
expect
(
$time
.
length
).
toEqual
(
1
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
chat-info chat-date
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
message
chat-info chat-date
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
(
one_day_ago
.
startOf
(
'
day
'
)).
format
());
expect
(
$time
.
text
()).
toEqual
(
moment
(
one_day_ago
.
startOf
(
'
day
'
)).
format
(
"
dddd MMM Do YYYY
"
));
...
...
@@ -1421,7 +1421,7 @@
expect
(
$time
.
length
).
toEqual
(
2
);
// There are now two time elements
$time
=
$chat_content
.
find
(
'
time:last
'
);
// We check the last one
var
message_date
=
new
Date
();
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
chat-info chat-date
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
message
chat-info chat-date
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
(
message_date
).
startOf
(
'
day
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
moment
(
message_date
).
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
...
...
spec/chatroom.js
View file @
4f227b46
...
...
@@ -639,7 +639,7 @@
var
$time
=
$chat_content
.
find
(
'
time
'
);
expect
(
$time
.
length
).
toEqual
(
1
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
chat-info chat-date
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
message
chat-info chat-date
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
$chat_content
.
find
(
'
div.chat-info:first
'
).
html
()).
toBe
(
"
some1 has entered the room.
"
);
...
...
@@ -664,7 +664,7 @@
$time
=
$chat_content
.
find
(
'
time
'
);
expect
(
$time
.
length
).
toEqual
(
1
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
chat-info chat-date
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
message
chat-info chat-date
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
1
);
...
...
@@ -700,7 +700,7 @@
expect
(
$time
.
length
).
toEqual
(
2
);
$time
=
$chat_content
.
find
(
'
time:eq(1)
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
chat-info chat-date
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
message
chat-info chat-date
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
1
);
...
...
@@ -738,7 +738,7 @@
expect
(
$time
.
length
).
toEqual
(
2
);
$time
=
$chat_content
.
find
(
'
time:eq(1)
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
chat-info chat-date
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
message
chat-info chat-date
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
1
);
...
...
src/converse-chatview.js
View file @
4f227b46
...
...
@@ -468,14 +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.
/* XXX:
We avoid .chat-event messages, since they are
*
temporary and get 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
(
'
.
chat-message, .chat-date
'
,
this
.
content
),
sizzle
(
'
.
message:not(.chat-event)
'
,
this
.
content
),
Element
.
prototype
.
getAttribute
,
'
data-isodate
'
)
if
(
_
.
isObject
(
cutoff
))
{
...
...
src/templates/new_day.html
View file @
4f227b46
<time
class=
"chat-info chat-date"
data-isodate=
"{{{o.isodate}}}"
>
{{{o.datestring}}}
</time>
<time
class=
"
message
chat-info chat-date"
data-isodate=
"{{{o.isodate}}}"
>
{{{o.datestring}}}
</time>
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