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
3d4bad4b
Commit
3d4bad4b
authored
Nov 15, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't mark info messages as followups
parent
657dd1e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
13 deletions
+37
-13
sass/_messages.scss
sass/_messages.scss
+0
-8
spec/muc_messages.js
spec/muc_messages.js
+31
-0
src/converse-chatview.js
src/converse-chatview.js
+6
-5
No files found.
sass/_messages.scss
View file @
3d4bad4b
...
...
@@ -52,9 +52,6 @@
font-size
:
90%
;
padding
:
0
.17rem
1rem
;
&
.chat-msg--followup
{
margin-left
:
2
.75rem
;
}
&
.badge
{
color
:
var
(
--
chat-head-text-color
);
}
...
...
@@ -348,11 +345,6 @@
}
}
}
&
.chat-info
{
&
.chat-msg--followup
{
margin-left
:
0
;
}
}
}
}
...
...
spec/muc_messages.js
View file @
3d4bad4b
...
...
@@ -11,6 +11,37 @@
describe
(
"
A Groupchat Message
"
,
function
()
{
describe
(
"
an info message
"
,
function
()
{
it
(
"
is not rendered as a followup message
"
,
mock
.
initConverse
(
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
async
function
(
done
,
_converse
)
{
const
muc_jid
=
'
lounge@montague.lit
'
;
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
muc_jid
,
'
romeo
'
);
const
view
=
_converse
.
api
.
chatviews
.
get
(
muc_jid
);
const
presence
=
u
.
toStanza
(
`
<presence xmlns="jabber:client" to="
${
_converse
.
jid
}
" from="
${
muc_jid
}
/romeo">
<x xmlns="http://jabber.org/protocol/muc#user">
<status code="201"/>
<item role="moderator" affiliation="owner" jid="
${
_converse
.
jid
}
"/>
<status code="110"/>
</x>
</presence>
`
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelectorAll
(
'
.chat-info
'
).
length
===
2
);
const
messages
=
view
.
el
.
querySelectorAll
(
'
.chat-info
'
);
expect
(
u
.
hasClass
(
'
chat-msg--followup
'
,
messages
[
0
])).
toBe
(
false
);
expect
(
u
.
hasClass
(
'
chat-msg--followup
'
,
messages
[
1
])).
toBe
(
false
);
done
();
}));
});
it
(
"
is rejected if it's an unencapsulated forwarded message
"
,
mock
.
initConverse
(
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
...
...
src/converse-chatview.js
View file @
3d4bad4b
...
...
@@ -658,12 +658,13 @@ converse.plugins.add('converse-chatview', {
* @param { HTMLElement } el - The message element
*/
markFollowups
(
el
)
{
const
from
=
el
.
getAttribute
(
'
data-from
'
)
,
previous_el
=
el
.
previousElementSibling
,
date
=
dayjs
(
el
.
getAttribute
(
'
data-isodate
'
)),
next_el
=
el
.
nextElementSibling
;
const
from
=
el
.
getAttribute
(
'
data-from
'
)
;
const
previous_el
=
el
.
previousElementSibling
;
const
date
=
dayjs
(
el
.
getAttribute
(
'
data-isodate
'
));
const
next_el
=
el
.
nextElementSibling
;
if
(
!
u
.
hasClass
(
'
chat-msg--action
'
,
el
)
&&
!
u
.
hasClass
(
'
chat-msg--action
'
,
previous_el
)
&&
!
u
.
hasClass
(
'
chat-info
'
,
el
)
&&
!
u
.
hasClass
(
'
chat-info
'
,
previous_el
)
&&
previous_el
.
getAttribute
(
'
data-from
'
)
===
from
&&
date
.
isBefore
(
dayjs
(
previous_el
.
getAttribute
(
'
data-isodate
'
)).
add
(
10
,
'
minutes
'
))
&&
el
.
getAttribute
(
'
data-encrypted
'
)
===
previous_el
.
getAttribute
(
'
data-encrypted
'
))
{
...
...
@@ -671,7 +672,7 @@ converse.plugins.add('converse-chatview', {
}
if
(
!
next_el
)
{
return
;
}
if
(
!
u
.
hasClass
(
'
chat-msg--action
'
,
el
)
&&
if
(
!
u
.
hasClass
(
'
chat-msg--action
'
,
el
)
&&
u
.
hasClass
(
'
chat-info
'
,
el
)
&&
next_el
.
getAttribute
(
'
data-from
'
)
===
from
&&
dayjs
(
next_el
.
getAttribute
(
'
data-isodate
'
)).
isBefore
(
date
.
add
(
10
,
'
minutes
'
))
&&
el
.
getAttribute
(
'
data-encrypted
'
)
===
next_el
.
getAttribute
(
'
data-encrypted
'
))
{
...
...
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