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
11da69b0
Commit
11da69b0
authored
Jun 26, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use native methods instead of DayJS
Results in a 4x speedup
parent
9ee0b681
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
src/converse-muc-views.js
src/converse-muc-views.js
+11
-9
src/utils/html.js
src/utils/html.js
+1
-1
No files found.
src/converse-muc-views.js
View file @
11da69b0
...
...
@@ -1312,24 +1312,26 @@ converse.plugins.add('converse-muc-views', {
},
/**
* Working backwards, get the first join/leave notification
* from the same user, on the same day and BEFORE any chat
* messages were received.
* Working backwards, get today's most recent join/leave notification
* from the same user (if any exists) after the most recent chat message.
* @private
* @method _converse.ChatRoomView#getPreviousJoinOrLeaveNotification
* @param {HTMLElement} el
* @param {string} nick
*/
getPreviousJoinOrLeaveNotification
(
el
,
nick
)
{
while
(
!
_
.
isNil
(
el
))
{
const
data
=
_
.
get
(
el
,
'
dataset
'
,
{});
if
(
!
_
.
includes
(
_
.
get
(
el
,
'
classList
'
,
[]),
'
chat-info
'
))
{
const
today
=
(
new
Date
()).
toISOString
().
split
(
'
T
'
)[
0
];
while
(
el
!==
null
)
{
if
(
!
el
.
classList
.
contains
(
'
chat-info
'
))
{
return
;
}
if
(
!
dayjs
(
el
.
getAttribute
(
'
data-isodate
'
)).
isSame
(
new
Date
(),
"
day
"
))
{
el
=
el
.
previousElementSibling
;
continue
;
// Check whether el is still from today.
// We don't use `Dayjs.same` here, since it's about 4 times slower.
const
date
=
el
.
getAttribute
(
'
data-isodate
'
);
if
(
date
&&
date
.
split
(
'
T
'
)[
0
]
!==
today
)
{
return
;
}
const
data
=
_
.
get
(
el
,
'
dataset
'
,
{});
if
(
data
.
join
===
nick
||
data
.
leave
===
nick
||
data
.
leavejoin
===
nick
||
...
...
src/utils/html.js
View file @
11da69b0
...
...
@@ -258,7 +258,7 @@ u.getLastChildElement = function (el, selector='*') {
}
u
.
hasClass
=
function
(
className
,
el
)
{
return
Array
.
from
(
el
.
classList
).
include
s
(
className
);
return
el
.
classList
.
contain
s
(
className
);
};
u
.
addClass
=
function
(
className
,
el
)
{
...
...
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