Просмотр исходного кода

Revert "Don't show `typing from different device` CSN messages"

This reverts commit 7303e96cdb6c0c4d102183b5d6efedfd11a2938d.

Instead of dropping the feature entirely, we can check if the CSN is a
carbon message.
JC Brand 7 лет назад
Родитель
Сommit
3d29567ab6
2 измененных файлов с 18 добавлено и 17 удалено
  1. 10 5
      src/converse-chatview.js
  2. 8 12
      src/converse-muc-views.js

+ 10 - 5
src/converse-chatview.js

@@ -685,18 +685,23 @@
 
                 showChatStateNotification (message) {
                     /* Support for XEP-0085, Chat State Notifications */
-                    if (message.get('sender') === 'me') {
-                        return;
-                    }
                     let text;
                     const from = message.get('from');
                     const data = `data-csn=${from}`;
                     this.clearChatStateNotification(from);
 
                     if (message.get('chat_state') === _converse.COMPOSING) {
-                        text = message.get('fullname')+' '+__('is typing');
+                        if (message.get('sender') === 'me') {
+                            text = __('Typing from another device');
+                        } else {
+                            text = message.get('fullname')+' '+__('is typing');
+                        }
                     } else if (message.get('chat_state') === _converse.PAUSED) {
-                        text = message.get('fullname')+' '+__('has stopped typing');
+                        if (message.get('sender') === 'me') {
+                            text = __('Stopped typing on the other device');
+                        } else {
+                            text = message.get('fullname')+' '+__('has stopped typing');
+                        }
                     } else if (message.get('chat_state') === _converse.GONE) {
                         text = message.get('fullname')+' '+__('has gone away');
                     } else {

+ 8 - 12
src/converse-muc-views.js

@@ -754,15 +754,11 @@
                         // <gone/> is not applicable within MUC context
                         return;
                     }
-                    const msgid = _converse.connection.getUniqueId();
                     _converse.connection.send(
-                        $msg({
-                            'to':this.model.get('jid'),
-                            'id': msgid,
-                            'type': 'groupchat'
-                        }).c(chat_state, {'xmlns': Strophe.NS.CHATSTATES}).up()
-                          .c('no-store', {'xmlns': Strophe.NS.HINTS}).up()
-                          .c('no-permanent-store', {'xmlns': Strophe.NS.HINTS})
+                        $msg({'to':this.model.get('jid'), 'type': 'groupchat'})
+                            .c(chat_state, {'xmlns': Strophe.NS.CHATSTATES}).up()
+                            .c('no-store', {'xmlns': Strophe.NS.HINTS}).up()
+                            .c('no-permanent-store', {'xmlns': Strophe.NS.HINTS})
                     );
                 },
 
@@ -776,10 +772,10 @@
                     text = u.httpToGeoUri(emojione.shortnameToUnicode(text), _converse)
                     const msgid = _converse.connection.getUniqueId();
                     const msg = $msg({
-                        'to': this.model.get('jid'),
-                        'from': _converse.connection.jid,
-                        'type': 'groupchat',
-                        'id': msgid
+                        to: this.model.get('jid'),
+                        from: _converse.connection.jid,
+                        type: 'groupchat',
+                        id: msgid
                     }).c("body").t(text).up()
                     .c("x", {xmlns: "jabber:x:event"}).c(_converse.COMPOSING);
                     _converse.connection.send(msg);