Take all messages except chat events into consideration
when determining where to insert new messages
This commit is contained in:
parent
e5b256e45e
commit
4f227b467b
@ -1401,7 +1401,7 @@
|
|||||||
|
|
||||||
var $time = $chat_content.find('time');
|
var $time = $chat_content.find('time');
|
||||||
expect($time.length).toEqual(1);
|
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.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"));
|
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
|
expect($time.length).toEqual(2); // There are now two time elements
|
||||||
$time = $chat_content.find('time:last'); // We check the last one
|
$time = $chat_content.find('time:last'); // We check the last one
|
||||||
var message_date = new Date();
|
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.data('isodate')).toEqual(moment(message_date).startOf('day').format());
|
||||||
expect($time.text()).toEqual(moment(message_date).startOf('day').format("dddd MMM Do YYYY"));
|
expect($time.text()).toEqual(moment(message_date).startOf('day').format("dddd MMM Do YYYY"));
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@
|
|||||||
|
|
||||||
var $time = $chat_content.find('time');
|
var $time = $chat_content.find('time');
|
||||||
expect($time.length).toEqual(1);
|
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.data('isodate')).toEqual(moment().startOf('day').format());
|
||||||
expect($time.text()).toEqual(moment().startOf('day').format("dddd MMM Do YYYY"));
|
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.");
|
expect($chat_content.find('div.chat-info:first').html()).toBe("some1 has entered the room.");
|
||||||
@ -664,7 +664,7 @@
|
|||||||
|
|
||||||
$time = $chat_content.find('time');
|
$time = $chat_content.find('time');
|
||||||
expect($time.length).toEqual(1);
|
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.data('isodate')).toEqual(moment().startOf('day').format());
|
||||||
expect($time.text()).toEqual(moment().startOf('day').format("dddd MMM Do YYYY"));
|
expect($time.text()).toEqual(moment().startOf('day').format("dddd MMM Do YYYY"));
|
||||||
expect($chat_content.find('div.chat-info').length).toBe(1);
|
expect($chat_content.find('div.chat-info').length).toBe(1);
|
||||||
@ -700,7 +700,7 @@
|
|||||||
expect($time.length).toEqual(2);
|
expect($time.length).toEqual(2);
|
||||||
|
|
||||||
$time = $chat_content.find('time:eq(1)');
|
$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.data('isodate')).toEqual(moment().startOf('day').format());
|
||||||
expect($time.text()).toEqual(moment().startOf('day').format("dddd MMM Do YYYY"));
|
expect($time.text()).toEqual(moment().startOf('day').format("dddd MMM Do YYYY"));
|
||||||
expect($chat_content.find('div.chat-info').length).toBe(1);
|
expect($chat_content.find('div.chat-info').length).toBe(1);
|
||||||
@ -738,7 +738,7 @@
|
|||||||
expect($time.length).toEqual(2);
|
expect($time.length).toEqual(2);
|
||||||
|
|
||||||
$time = $chat_content.find('time:eq(1)');
|
$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.data('isodate')).toEqual(moment().startOf('day').format());
|
||||||
expect($time.text()).toEqual(moment().startOf('day').format("dddd MMM Do YYYY"));
|
expect($time.text()).toEqual(moment().startOf('day').format("dddd MMM Do YYYY"));
|
||||||
expect($chat_content.find('div.chat-info').length).toBe(1);
|
expect($chat_content.find('div.chat-info').length).toBe(1);
|
||||||
|
@ -468,14 +468,14 @@
|
|||||||
if (_.isNull(most_recent_date) || moment(most_recent_date).isBefore(cutoff)) {
|
if (_.isNull(most_recent_date) || moment(most_recent_date).isBefore(cutoff)) {
|
||||||
return most_recent_date;
|
return most_recent_date;
|
||||||
}
|
}
|
||||||
/* XXX: Besides .chat-message and .chat-date elements, there are also
|
/* XXX: We avoid .chat-event messages, since they are
|
||||||
* .chat-event elements. These are however temporary and
|
* temporary and get removed once a new element is
|
||||||
* removed once a new element is inserted into the chat
|
* inserted into the chat area, so we don't query for
|
||||||
* area, so we don't query for them here, otherwise we get
|
* them here, otherwise we get a null reference later
|
||||||
* a null reference later upon element insertion.
|
* upon element insertion.
|
||||||
*/
|
*/
|
||||||
const msg_dates = _.invokeMap(
|
const msg_dates = _.invokeMap(
|
||||||
sizzle('.chat-message, .chat-date', this.content),
|
sizzle('.message:not(.chat-event)', this.content),
|
||||||
Element.prototype.getAttribute, 'data-isodate'
|
Element.prototype.getAttribute, 'data-isodate'
|
||||||
)
|
)
|
||||||
if (_.isObject(cutoff)) {
|
if (_.isObject(cutoff)) {
|
||||||
|
@ -1 +1 @@
|
|||||||
<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>
|
||||||
|
Loading…
Reference in New Issue
Block a user