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
acbcf3fd
Commit
acbcf3fd
authored
Mar 27, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indicate on the chatbox when messages span different days.
parent
43434043
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
converse.js
converse.js
+16
-13
No files found.
converse.js
View file @
acbcf3fd
...
...
@@ -311,18 +311,24 @@
},
showMessage
:
function
(
message
)
{
/*
* FIXME: we don't use client storage anymore
var msg = xmppchat.storage.getLastMessage(this.model.get('jid'));
if (typeof msg !== 'undefined') {
var prev_date = new Date(Date(msg.split(' ', 2)[0]));
if (this.isDifferentDay(prev_date, now)) {
var
time
=
message
.
get
(
'
time
'
),
times
=
this
.
model
.
messages
.
pluck
(
'
time
'
),
this_date
=
xmppchat
.
parseISO8601
(
time
),
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
),
previous_message
,
idx
,
prev_date
;
// If this message is on a different day than the one received
// prior, then indicate it on the chatbox.
idx
=
_
.
indexOf
(
times
,
time
)
-
1
;
if
(
idx
>=
0
)
{
previous_message
=
this
.
model
.
messages
.
at
(
idx
);
prev_date
=
xmppchat
.
parseISO8601
(
previous_message
.
get
(
'
time
'
));
if
(
this
.
isDifferentDay
(
prev_date
,
this_date
))
{
$chat_content
.
append
(
$
(
'
<div class="chat-date"> </div>
'
));
$chat_content.append($('<div class="chat-date"></div>').text(
now
.toString().substring(0,15)));
$chat_content
.
append
(
$
(
'
<div class="chat-date"></div>
'
).
text
(
this_date
.
toString
().
substring
(
0
,
15
)));
}
}
*/
var
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
);
if
(
xmppchat
.
xmppstatus
.
getStatus
()
===
'
offline
'
)
{
// only update the UI if the user is not offline
return
;
...
...
@@ -332,12 +338,10 @@
return
;
}
else
{
$chat_content
.
find
(
'
div.chat-event
'
).
remove
();
// TODO use toJSON here
var
time
=
xmppchat
.
parseISO8601
(
message
.
get
(
'
time
'
)).
toLocaleTimeString
().
substring
(
0
,
5
);
$chat_content
.
append
(
this
.
message_template
({
'
sender
'
:
message
.
get
(
'
sender
'
),
'
time
'
:
t
ime
,
'
time
'
:
t
his_date
.
toLocaleTimeString
().
substring
(
0
,
5
)
,
'
message
'
:
message
.
get
(
'
message
'
),
'
username
'
:
message
.
get
(
'
fullname
'
),
'
extra_classes
'
:
message
.
get
(
'
delayed
'
)
&&
'
delayed
'
||
''
...
...
@@ -887,7 +891,6 @@
},
onChatRoomPresence
:
function
(
presence
,
room
)
{
// TODO see if nick is useful
var
nick
=
room
.
nick
,
$presence
=
$
(
presence
),
from
=
$presence
.
attr
(
'
from
'
);
...
...
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