Commit ba6b7201 authored by JC Brand's avatar JC Brand

Show groupchat messages where user is mentioned in bold.

parent eefce828
...@@ -1095,6 +1095,7 @@ ...@@ -1095,6 +1095,7 @@
text = msg_dict.message, text = msg_dict.message,
match = text.match(/^\/(.*?)(?: (.*))?$/), match = text.match(/^\/(.*?)(?: (.*))?$/),
fullname = msg_dict.fullname || this.model.get('fullname'), // XXX Perhaps always use model's? fullname = msg_dict.fullname || this.model.get('fullname'), // XXX Perhaps always use model's?
extra_classes = msg_dict.delayed && 'delayed' || '',
template, username; template, username;
if ((match) && (match[1] === 'me')) { if ((match) && (match[1] === 'me')) {
...@@ -1106,12 +1107,19 @@ ...@@ -1106,12 +1107,19 @@
username = msg_dict.sender === 'me' && __('me') || fullname; username = msg_dict.sender === 'me' && __('me') || fullname;
} }
$content.find('div.chat-event').remove(); $content.find('div.chat-event').remove();
if (this.is_chatroom && msg_dict.sender == 'them' && (new RegExp("\\b"+this.model.get('nick')+"\\b")).test(text)) {
// Add special class to mark groupchat messages in which we
// are mentioned.
extra_classes += ' mentioned';
}
var message = template({ var message = template({
'sender': msg_dict.sender, 'sender': msg_dict.sender,
'time': msg_time.format('hh:mm'), 'time': msg_time.format('hh:mm'),
'username': username, 'username': username,
'message': '', 'message': '',
'extra_classes': msg_dict.delayed && 'delayed' || '' 'extra_classes': extra_classes
}); });
$content.append($(message).children('.chat-message-content').first().text(text).addHyperlinks().addEmoticons().parent()); $content.append($(message).children('.chat-message-content').first().text(text).addHyperlinks().addEmoticons().parent());
this.scrollDown(); this.scrollDown();
......
...@@ -706,6 +706,9 @@ span.spinner.hor_centered { ...@@ -706,6 +706,9 @@ span.spinner.hor_centered {
margin-left: 0.3em; margin-left: 0.3em;
color: #808080; color: #808080;
} }
#conversejs div.mentioned {
font-weight: bold;
}
#conversejs div.delayed .chat-message-them { #conversejs div.delayed .chat-message-them {
color: #FB5D50; color: #FB5D50;
} }
......
...@@ -4,8 +4,8 @@ Changelog ...@@ -4,8 +4,8 @@ Changelog
0.8.1 (Unreleased) 0.8.1 (Unreleased)
------------------ ------------------
* Converse.js now has the ability to maintain sessions across page loads * Converse.js now has the ability to maintain sessions across page loads.
(previously, the session tokens had to be handled externally and passed in). Previously, the session tokens had to be handled externally and passed in.
See the `keepalive <https://conversejs.org/docs/html/index.html#keepalive`_ configuration setting. [jcbrand] See the `keepalive <https://conversejs.org/docs/html/index.html#keepalive`_ configuration setting. [jcbrand]
* Allow changing of nickname in a chat room via /nick command. [jcbrand] * Allow changing of nickname in a chat room via /nick command. [jcbrand]
* Allow a chat room user to be muted or unmuted with the /mute and /voice commands. [jcbrand] * Allow a chat room user to be muted or unmuted with the /mute and /voice commands. [jcbrand]
...@@ -18,6 +18,7 @@ Changelog ...@@ -18,6 +18,7 @@ Changelog
* #212 Bugfix. Groups weren't being show again after the live filter was cleared. [jcbrand] * #212 Bugfix. Groups weren't being show again after the live filter was cleared. [jcbrand]
* #215 (and also #75) XEP-0249: Direct MUC Invitations. [jcbrand] * #215 (and also #75) XEP-0249: Direct MUC Invitations. [jcbrand]
* #216 Contacts tab empty when using xhr_user_search. [hcderaad and jcbrand] * #216 Contacts tab empty when using xhr_user_search. [hcderaad and jcbrand]
* #219 New contacts added need page refresh to be accepted and become visible [hcderaad and jcbrand]
0.8.1 (2014-08-23) 0.8.1 (2014-08-23)
------------------ ------------------
......
...@@ -940,6 +940,9 @@ Default: ``true`` ...@@ -940,6 +940,9 @@ Default: ``true``
Determines whether Converse.js will maintain the chat session across page Determines whether Converse.js will maintain the chat session across page
loads. loads.
*Please be aware*: This is a new still relatively experimental feature and there might be some
unhandled edge-cases.
message_carbons message_carbons
--------------- ---------------
......
...@@ -775,6 +775,10 @@ span.spinner.hor_centered { ...@@ -775,6 +775,10 @@ span.spinner.hor_centered {
color: #808080; color: #808080;
} }
#conversejs div.mentioned {
font-weight: bold;
}
#conversejs div.delayed .chat-message-them { #conversejs div.delayed .chat-message-them {
color: #FB5D50; color: #FB5D50;
} }
......
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