Commit d97deaea authored by JC Brand's avatar JC Brand

Fixes #1369

* Add test and changelog entry
* Also show message subject if available
parent 3c0e3d3f
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
## 4.1.1 (unreleased) ## 4.1.1 (unreleased)
- Accessibility: Tag the chat-content as an ARIA live region, for screen readers - Accessibility: Tag the chat-content as an ARIA live region, for screen readers
- #1369 Don't wrongly interpret message with `subject` as a topic change.
- #1408 new config option `roomconfig_whitelist` - #1408 new config option `roomconfig_whitelist`
- #1421 fix direct invite for membersonly room - #1421 fix direct invite for membersonly room
......
...@@ -11912,6 +11912,9 @@ body.converse-fullscreen { ...@@ -11912,6 +11912,9 @@ body.converse-fullscreen {
padding-right: 0.5em; } padding-right: 0.5em; }
#conversejs .message.chat-msg.headline .chat-msg__body { #conversejs .message.chat-msg.headline .chat-msg__body {
margin-left: 0; } margin-left: 0; }
#conversejs .message.chat-msg .chat-msg__subject {
font-weight: bold;
clear: right; }
#conversejs .message.chat-msg .chat-msg__text { #conversejs .message.chat-msg .chat-msg__text {
padding: 0; padding: 0;
color: var(--message-text-color); color: var(--message-text-color);
......
...@@ -93518,6 +93518,12 @@ __e(o.spoiler_hint) + ...@@ -93518,6 +93518,12 @@ __e(o.spoiler_hint) +
__e(o.label_show) + __e(o.label_show) +
'</a>\n </div>\n '; '</a>\n </div>\n ';
} ; } ;
__p += '\n ';
if (o.subject) { ;
__p += '\n <div class="chat-msg__subject">' +
__e( o.subject ) +
'</div>\n ';
} ;
__p += '\n <div class="chat-msg__text'; __p += '\n <div class="chat-msg__text';
if (o.is_spoiler) { ; if (o.is_spoiler) { ;
__p += ' spoiler collapsed'; __p += ' spoiler collapsed';
...@@ -149,6 +149,11 @@ ...@@ -149,6 +149,11 @@
} }
} }
.chat-msg__subject {
font-weight: bold;
clear: right;
}
.chat-msg__text { .chat-msg__text {
padding: 0; padding: 0;
color: var(--message-text-color); color: var(--message-text-color);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
Backbone = converse.env.Backbone, Backbone = converse.env.Backbone,
u = converse.env.utils; u = converse.env.utils;
describe("Chatrooms", function () { describe("Groupchats", function () {
describe("The \"rooms\" API", function () { describe("The \"rooms\" API", function () {
...@@ -1937,7 +1937,7 @@ ...@@ -1937,7 +1937,7 @@
await test_utils.openAndEnterChatRoom(_converse, 'jdev', 'conference.jabber.org', 'jc'); await test_utils.openAndEnterChatRoom(_converse, 'jdev', 'conference.jabber.org', 'jc');
const text = 'Jabber/XMPP Development | RFCs and Extensions: http://xmpp.org/ | Protocol and XSF discussions: xsf@muc.xmpp.org'; const text = 'Jabber/XMPP Development | RFCs and Extensions: http://xmpp.org/ | Protocol and XSF discussions: xsf@muc.xmpp.org';
const stanza = Strophe.xmlHtmlNode( let stanza = Strophe.xmlHtmlNode(
'<message xmlns="jabber:client" to="jc@opkode.com/_converse.js-60429116" type="groupchat" from="jdev@conference.jabber.org/ralphm">'+ '<message xmlns="jabber:client" to="jc@opkode.com/_converse.js-60429116" type="groupchat" from="jdev@conference.jabber.org/ralphm">'+
' <subject>'+text+'</subject>'+ ' <subject>'+text+'</subject>'+
' <delay xmlns="urn:xmpp:delay" stamp="2014-02-04T09:35:39Z" from="jdev@conference.jabber.org"/>'+ ' <delay xmlns="urn:xmpp:delay" stamp="2014-02-04T09:35:39Z" from="jdev@conference.jabber.org"/>'+
...@@ -1945,11 +1945,26 @@ ...@@ -1945,11 +1945,26 @@
'</message>').firstChild; '</message>').firstChild;
_converse.connection._dataRecv(test_utils.createRequest(stanza)); _converse.connection._dataRecv(test_utils.createRequest(stanza));
const view = _converse.chatboxviews.get('jdev@conference.jabber.org'); const view = _converse.chatboxviews.get('jdev@conference.jabber.org');
await new Promise((resolve, reject) => view.once('messageInserted', resolve)); await new Promise((resolve, reject) => view.model.once('change:subject', resolve));
const chat_content = view.el.querySelector('.chat-content'); let chat_content = view.el.querySelector('.chat-content');
expect(sizzle('.chat-event:last').pop().textContent).toBe('Topic set by ralphm'); expect(sizzle('.chat-event:last').pop().textContent).toBe('Topic set by ralphm');
expect(sizzle('.chat-topic:last').pop().textContent).toBe(text); expect(sizzle('.chat-topic:last').pop().textContent).toBe(text);
expect(view.el.querySelector('.chatroom-description').textContent).toBe(text); expect(view.el.querySelector('.chatroom-description').textContent).toBe(text);
stanza = Strophe.xmlHtmlNode(
`<message xmlns="jabber:client" to="jc@opkode.com/_converse.js-60429116" type="groupchat" from="jdev@conference.jabber.org/ralphm">
<subject>This is a message subject</subject>
<body>This is a message</body>
</message>`).firstChild;
_converse.connection._dataRecv(test_utils.createRequest(stanza));
await new Promise((resolve, reject) => view.once('messageInserted', resolve));
chat_content = view.el.querySelector('.chat-content');
expect(sizzle('.chat-topic').length).toBe(1);
expect(sizzle('.chat-msg__subject').length).toBe(1);
expect(sizzle('.chat-msg__subject').pop().textContent).toBe('This is a message subject');
expect(sizzle('.chat-msg__text').length).toBe(1);
expect(sizzle('.chat-msg__text').pop().textContent).toBe('This is a message');
expect(view.el.querySelector('.chatroom-description').textContent).toBe(text);
done(); done();
})); }));
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
<a class="badge badge-info spoiler-toggle" data-toggle-state="closed" href="#"><i class="fa fa-eye"></i>{{{o.label_show}}}</a> <a class="badge badge-info spoiler-toggle" data-toggle-state="closed" href="#"><i class="fa fa-eye"></i>{{{o.label_show}}}</a>
</div> </div>
{[ } ]} {[ } ]}
{[ if (o.subject) { ]}
<div class="chat-msg__subject">{{{ o.subject }}}</div>
{[ } ]}
<div class="chat-msg__text{[ if (o.is_spoiler) { ]} spoiler collapsed{[ } ]}"><!-- message gets added here via renderMessage --></div> <div class="chat-msg__text{[ if (o.is_spoiler) { ]} spoiler collapsed{[ } ]}"><!-- message gets added here via renderMessage --></div>
<div class="chat-msg__media"></div> <div class="chat-msg__media"></div>
{[ if (!o.is_me_message) { ]}</div>{[ } ]} {[ if (!o.is_me_message) { ]}</div>{[ } ]}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment