Parcourir la source

Show groupchat messages where user is mentioned in bold.

JC Brand il y a 10 ans
Parent
commit
ba6b72011c
5 fichiers modifiés avec 22 ajouts et 3 suppressions
  1. 9 1
      converse.js
  2. 3 0
      css/converse.css
  3. 3 2
      docs/CHANGES.rst
  4. 3 0
      docs/source/index.rst
  5. 4 0
      less/converse.less

+ 9 - 1
converse.js

@@ -1095,6 +1095,7 @@
                     text = msg_dict.message,
                     match = text.match(/^\/(.*?)(?: (.*))?$/),
                     fullname = msg_dict.fullname || this.model.get('fullname'), // XXX Perhaps always use model's?
+                    extra_classes = msg_dict.delayed && 'delayed' || '',
                     template, username;
 
                 if ((match) && (match[1] === 'me')) {
@@ -1106,12 +1107,19 @@
                     username = msg_dict.sender === 'me' && __('me') || fullname;
                 }
                 $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({
                     'sender': msg_dict.sender,
                     'time': msg_time.format('hh:mm'),
                     'username': username,
                     'message': '',
-                    'extra_classes': msg_dict.delayed && 'delayed' || ''
+                    'extra_classes': extra_classes
                 });
                 $content.append($(message).children('.chat-message-content').first().text(text).addHyperlinks().addEmoticons().parent());
                 this.scrollDown();

+ 3 - 0
css/converse.css

@@ -706,6 +706,9 @@ span.spinner.hor_centered {
   margin-left: 0.3em;
   color: #808080;
 }
+#conversejs div.mentioned {
+  font-weight: bold;
+}
 #conversejs div.delayed .chat-message-them {
   color: #FB5D50;
 }

+ 3 - 2
docs/CHANGES.rst

@@ -4,8 +4,8 @@ Changelog
 0.8.1 (Unreleased)
 ------------------
 
-* Converse.js now has the ability to maintain sessions across page loads
-  (previously, the session tokens had to be handled externally and passed in).
+* Converse.js now has the ability to maintain sessions across page loads.
+  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]
 * 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]
@@ -18,6 +18,7 @@ Changelog
 * #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]
 * #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)
 ------------------

+ 3 - 0
docs/source/index.rst

@@ -940,6 +940,9 @@ Default:    ``true``
 Determines whether Converse.js will maintain the chat session across page
 loads.
 
+*Please be aware*: This is a new still relatively experimental feature and there might be some
+unhandled edge-cases.
+
 message_carbons
 ---------------
 

+ 4 - 0
less/converse.less

@@ -775,6 +775,10 @@ span.spinner.hor_centered {
     color: #808080;
 }
 
+#conversejs div.mentioned {
+    font-weight: bold;
+}
+
 #conversejs div.delayed .chat-message-them {
     color: #FB5D50;
 }