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
cb0b99ac
Commit
cb0b99ac
authored
Mar 17, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Show message author in spoiler messages
parent
f0ae8c44
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
20 deletions
+28
-20
CHANGES.md
CHANGES.md
+4
-0
spec/spoilers.js
spec/spoilers.js
+20
-11
src/converse-chatview.js
src/converse-chatview.js
+2
-4
src/templates/spoiler_button.html
src/templates/spoiler_button.html
+2
-5
No files found.
CHANGES.md
View file @
cb0b99ac
...
...
@@ -26,6 +26,10 @@ boxes can no longer be resized horizontally (or diagonally). Perhaps a solution
for this can again be found, but time constraints meant that this feature had
to be removed.
### Bugfixes
-
Spoiler messages didn't include the message author's name.
## 3.3.4 (2018-03-05)
...
...
spec/spoilers.js
View file @
cb0b99ac
...
...
@@ -44,6 +44,8 @@
_converse
.
chatboxes
.
onMessage
(
msg
);
var
view
=
_converse
.
chatboxviews
.
get
(
sender_jid
);
expect
(
_
.
includes
(
view
.
el
.
querySelector
(
'
.chat-msg-author
'
).
textContent
,
'
Max Frankfurter
'
)).
toBeTruthy
();
var
message_content
=
view
.
el
.
querySelector
(
'
.chat-msg-content
'
);
expect
(
message_content
.
textContent
).
toBe
(
spoiler
);
...
...
@@ -78,6 +80,8 @@
_converse
.
chatboxes
.
onMessage
(
msg
);
var
view
=
_converse
.
chatboxviews
.
get
(
sender_jid
);
expect
(
_
.
includes
(
view
.
el
.
querySelector
(
'
.chat-msg-author
'
).
textContent
,
'
Max Frankfurter
'
)).
toBeTruthy
();
var
message_content
=
view
.
el
.
querySelector
(
'
.chat-msg-content
'
);
expect
(
message_content
.
textContent
).
toBe
(
spoiler
);
...
...
@@ -124,17 +128,17 @@
expect
(
view
.
onMessageSubmitted
).
toHaveBeenCalled
();
/* Test the XML stanza
*
* <message from="dummy@localhost/resource"
* to="max.frankfurter@localhost"
* type="chat"
* id="4547c38b-d98b-45a5-8f44-b4004dbc335e"
* xmlns="jabber:client">
* <body>This is the spoiler</body>
* <active xmlns="http://jabber.org/protocol/chatstates"/>
* <spoiler xmlns="urn:xmpp:spoiler:0"/>
* </message>"
*/
*
* <message from="dummy@localhost/resource"
* to="max.frankfurter@localhost"
* type="chat"
* id="4547c38b-d98b-45a5-8f44-b4004dbc335e"
* xmlns="jabber:client">
* <body>This is the spoiler</body>
* <active xmlns="http://jabber.org/protocol/chatstates"/>
* <spoiler xmlns="urn:xmpp:spoiler:0"/>
* </message>"
*/
var
stanza
=
_converse
.
connection
.
send
.
calls
.
argsFor
(
0
)[
0
].
tree
();
var
spoiler_el
=
stanza
.
querySelector
(
'
spoiler[xmlns="urn:xmpp:spoiler:0"]
'
);
expect
(
_
.
isNull
(
spoiler_el
)).
toBeFalsy
();
...
...
@@ -144,6 +148,8 @@
expect
(
body_el
.
textContent
).
toBe
(
'
This is the spoiler
'
);
/* Test the HTML spoiler message */
expect
(
view
.
el
.
querySelector
(
'
.chat-msg-author
'
).
textContent
.
split
(
'
:
'
)[
1
].
trim
().
split
(
'
'
)[
1
]).
toBe
(
'
me
'
);
var
spoiler_msg_el
=
view
.
el
.
querySelector
(
'
.chat-msg-content.spoiler
'
);
expect
(
spoiler_msg_el
.
textContent
).
toBe
(
'
This is the spoiler
'
);
expect
(
_
.
includes
(
spoiler_msg_el
.
classList
,
'
collapsed
'
)).
toBeTruthy
();
...
...
@@ -213,6 +219,7 @@
*/
var
stanza
=
_converse
.
connection
.
send
.
calls
.
argsFor
(
0
)[
0
].
tree
();
var
spoiler_el
=
stanza
.
querySelector
(
'
spoiler[xmlns="urn:xmpp:spoiler:0"]
'
);
expect
(
_
.
isNull
(
spoiler_el
)).
toBeFalsy
();
expect
(
spoiler_el
.
textContent
).
toBe
(
'
This is the hint
'
);
...
...
@@ -220,6 +227,8 @@
expect
(
body_el
.
textContent
).
toBe
(
'
This is the spoiler
'
);
/* Test the HTML spoiler message */
expect
(
view
.
el
.
querySelector
(
'
.chat-msg-author
'
).
textContent
.
split
(
'
:
'
)[
1
].
trim
().
split
(
'
'
)[
1
]).
toBe
(
'
me
'
);
var
spoiler_msg_el
=
view
.
el
.
querySelector
(
'
.chat-msg-content.spoiler
'
);
expect
(
spoiler_msg_el
.
textContent
).
toBe
(
'
This is the spoiler
'
);
expect
(
_
.
includes
(
spoiler_msg_el
.
classList
,
'
collapsed
'
)).
toBeTruthy
();
...
...
src/converse-chatview.js
View file @
cb0b99ac
...
...
@@ -611,11 +611,9 @@
}
else
{
username
=
attrs
.
fullname
;
}
}
else
if
(
attrs
.
is_spoiler
)
{
template
=
tpl_spoiler_message
;
}
else
{
template
=
tpl_message
;
}
else
{
username
=
attrs
.
sender
===
'
me
'
&&
__
(
'
me
'
)
||
fullname
;
template
=
attrs
.
is_spoiler
?
tpl_spoiler_message
:
tpl_message
;
}
const
msg_time
=
moment
(
attrs
.
time
)
||
moment
;
...
...
src/templates/spoiler_button.html
View file @
cb0b99ac
<li
class=
"toggle-compose-spoiler"
>
<a
class=
"
{[ if (o.composing_spoiler) { ]} icon-eye-blocked {[ } ]}
{[ if (!o.composing_spoiler) { ]} icon-eye {[ } ]}"
title=
"{{ o.label_toggle_spoiler }}"
></a>
<li
class=
"toggle-compose-spoiler fa {[ if (o.composing_spoiler) { ]} fa-eye-slash {[ } ]} {[ if (!o.composing_spoiler) { ]} fa-eye {[ } ]}"
title=
"{{ o.label_toggle_spoiler }}"
></a>
</li>
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