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
7eb6b13f
Commit
7eb6b13f
authored
May 02, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't mark /me messages are followup messages.
parent
911ede28
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
23 deletions
+50
-23
css/converse.css
css/converse.css
+6
-2
css/inverse.css
css/inverse.css
+6
-2
sass/_messages.scss
sass/_messages.scss
+4
-0
spec/chatbox.js
spec/chatbox.js
+22
-4
src/converse-chatview.js
src/converse-chatview.js
+12
-15
No files found.
css/converse.css
View file @
7eb6b13f
...
@@ -8433,8 +8433,12 @@ body.reset {
...
@@ -8433,8 +8433,12 @@ body.reset {
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-time
{
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-time
{
padding-left
:
0.25em
;
padding-left
:
0.25em
;
color
:
#9d9d9d
;
}
color
:
#9d9d9d
;
}
#conversejs
.message.chat-msg.chat-action
.chat-msg-heading
{
#conversejs
.message.chat-msg.chat-action
{
margin-top
:
0
;
}
display
:
block
;
}
#conversejs
.message.chat-msg.chat-action
.chat-msg-heading
{
float
:
left
;
margin-top
:
0
;
padding-bottom
:
0
;
}
#conversejs
.message.chat-msg.chat-msg-followup
.chat-msg-heading
,
#conversejs
.message.chat-msg.chat-msg-followup
.chat-msg-heading
,
#conversejs
.message.chat-msg.chat-msg-followup
.avatar
{
#conversejs
.message.chat-msg.chat-msg-followup
.avatar
{
display
:
none
;
}
display
:
none
;
}
...
...
css/inverse.css
View file @
7eb6b13f
...
@@ -8621,8 +8621,12 @@ body {
...
@@ -8621,8 +8621,12 @@ body {
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-time
{
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-time
{
padding-left
:
0.25em
;
padding-left
:
0.25em
;
color
:
#9d9d9d
;
}
color
:
#9d9d9d
;
}
#conversejs
.message.chat-msg.chat-action
.chat-msg-heading
{
#conversejs
.message.chat-msg.chat-action
{
margin-top
:
0
;
}
display
:
block
;
}
#conversejs
.message.chat-msg.chat-action
.chat-msg-heading
{
float
:
left
;
margin-top
:
0
;
padding-bottom
:
0
;
}
#conversejs
.message.chat-msg.chat-msg-followup
.chat-msg-heading
,
#conversejs
.message.chat-msg.chat-msg-followup
.chat-msg-heading
,
#conversejs
.message.chat-msg.chat-msg-followup
.avatar
{
#conversejs
.message.chat-msg.chat-msg-followup
.avatar
{
display
:
none
;
}
display
:
none
;
}
...
...
sass/_messages.scss
View file @
7eb6b13f
...
@@ -144,8 +144,12 @@
...
@@ -144,8 +144,12 @@
}
}
}
}
&
.chat-action
{
&
.chat-action
{
display
:
block
;
.chat-msg-heading
{
.chat-msg-heading
{
float
:
left
;
margin-top
:
0
;
margin-top
:
0
;
padding-bottom
:
0
;
}
}
}
}
&
.chat-msg-followup
{
&
.chat-msg-followup
{
...
...
spec/chatbox.js
View file @
7eb6b13f
...
@@ -58,11 +58,8 @@
...
@@ -58,11 +58,8 @@
var
view
;
var
view
;
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
localhost
'
,
[],
[
'
vcard-temp
'
])
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
localhost
'
,
[],
[
'
vcard-temp
'
])
.
then
(()
=>
test_utils
.
waitUntil
(()
=>
_converse
.
xmppstatus
.
get
(
'
fullname
'
)),
300
)
.
then
(
function
()
{
.
then
(
function
()
{
return
test_utils
.
waitUntil
(
function
()
{
return
_converse
.
xmppstatus
.
get
(
'
fullname
'
);
},
300
);
}).
then
(
function
()
{
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
expect
(
_converse
.
chatboxes
.
length
).
toEqual
(
1
);
expect
(
_converse
.
chatboxes
.
length
).
toEqual
(
1
);
var
sender_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
sender_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
...
@@ -81,14 +78,35 @@
...
@@ -81,14 +78,35 @@
test_utils
.
waitUntil
(
function
()
{
test_utils
.
waitUntil
(
function
()
{
return
u
.
isVisible
(
view
.
el
);
return
u
.
isVisible
(
view
.
el
);
}).
then
(
function
()
{
}).
then
(
function
()
{
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-action
'
).
length
).
toBe
(
1
);
expect
(
_
.
includes
(
view
.
el
.
querySelector
(
'
.chat-msg-author
'
).
textContent
,
'
**Max Frankfurter
'
)).
toBeTruthy
();
expect
(
_
.
includes
(
view
.
el
.
querySelector
(
'
.chat-msg-author
'
).
textContent
,
'
**Max Frankfurter
'
)).
toBeTruthy
();
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg-text
'
).
text
()).
toBe
(
'
is tired
'
);
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg-text
'
).
text
()).
toBe
(
'
is tired
'
);
message
=
'
/me is as well
'
;
message
=
'
/me is as well
'
;
test_utils
.
sendMessage
(
view
,
message
);
test_utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-action
'
).
length
).
toBe
(
2
);
expect
(
_
.
includes
(
$
(
view
.
el
).
find
(
'
.chat-msg-author:last
'
).
text
(),
'
**Max Mustermann
'
)).
toBeTruthy
();
expect
(
_
.
includes
(
$
(
view
.
el
).
find
(
'
.chat-msg-author:last
'
).
text
(),
'
**Max Mustermann
'
)).
toBeTruthy
();
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg-text:last
'
).
text
()).
toBe
(
'
is as well
'
);
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg-text:last
'
).
text
()).
toBe
(
'
is as well
'
);
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg:last
'
).
hasClass
(
'
chat-msg-followup
'
)).
toBe
(
false
);
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg:last
'
).
hasClass
(
'
chat-msg-followup
'
)).
toBe
(
false
);
// Check that /me messages after a normal message don't
// get the 'chat-msg-followup' class.
message
=
'
This a normal message
'
;
test_utils
.
sendMessage
(
view
,
message
);
let
message_el
=
view
.
el
.
querySelector
(
'
.message:last-child
'
);
expect
(
u
.
hasClass
(
'
chat-msg-followup
'
,
message_el
)).
toBeFalsy
();
message
=
'
/me wrote a 3rd person message
'
;
test_utils
.
sendMessage
(
view
,
message
);
message_el
=
view
.
el
.
querySelector
(
'
.message:last-child
'
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-action
'
).
length
).
toBe
(
3
);
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg-text:last
'
).
text
()).
toBe
(
'
wrote a 3rd person message
'
);
expect
(
$
(
view
.
el
).
find
(
'
.chat-msg-author:last
'
).
is
(
'
:visible
'
)).
toBeTruthy
();
expect
(
u
.
hasClass
(
'
chat-msg-followup
'
,
message_el
)).
toBeFalsy
();
message
=
'
This a normal message
'
;
done
();
done
();
});
});
});
});
...
...
src/converse-chatview.js
View file @
7eb6b13f
...
@@ -683,25 +683,22 @@
...
@@ -683,25 +683,22 @@
*/
*/
const
from
=
el
.
getAttribute
(
'
data-from
'
),
const
from
=
el
.
getAttribute
(
'
data-from
'
),
previous_el
=
el
.
previousElementSibling
,
previous_el
=
el
.
previousElementSibling
,
date
=
moment
(
el
.
getAttribute
(
'
data-isodate
'
));
date
=
moment
(
el
.
getAttribute
(
'
data-isodate
'
)),
next_el
=
el
.
nextElementSibling
;
if
(
previous_el
.
getAttribute
(
'
data-from
'
)
===
from
&&
date
.
isBefore
(
moment
(
previous_el
.
getAttribute
(
'
data-isodate
'
)).
add
(
10
,
'
minutes
'
)))
{
if
(
!
u
.
hasClass
(
'
chat-action
'
,
el
)
&&
!
u
.
hasClass
(
'
chat-action
'
,
previous_el
)
&&
previous_el
.
getAttribute
(
'
data-from
'
)
===
from
&&
date
.
isBefore
(
moment
(
previous_el
.
getAttribute
(
'
data-isodate
'
)).
add
(
10
,
'
minutes
'
)))
{
u
.
addClass
(
'
chat-msg-followup
'
,
el
);
u
.
addClass
(
'
chat-msg-followup
'
,
el
);
}
}
const
next_el
=
el
.
nextElementSibling
;
if
(
!
next_el
)
{
return
;
}
if
(
!
next_el
)
{
return
;
if
(
!
u
.
hasClass
(
'
chat-action
'
,
'
el
'
)
&&
}
next_el
.
getAttribute
(
'
data-from
'
)
===
from
&&
if
(
next_el
.
getAttribute
(
'
data-from
'
)
!==
from
)
{
moment
(
next_el
.
getAttribute
(
'
data-isodate
'
)).
isBefore
(
date
.
add
(
10
,
'
minutes
'
))
)
{
u
.
remove
Class
(
'
chat-msg-followup
'
,
next_el
);
u
.
add
Class
(
'
chat-msg-followup
'
,
next_el
);
}
else
{
}
else
{
if
(
moment
(
next_el
.
getAttribute
(
'
data-isodate
'
)).
isBefore
(
date
.
add
(
10
,
'
minutes
'
)))
{
u
.
removeClass
(
'
chat-msg-followup
'
,
next_el
);
u
.
addClass
(
'
chat-msg-followup
'
,
next_el
);
}
else
{
u
.
removeClass
(
'
chat-msg-followup
'
,
next_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