JC Brand před 6 roky
rodič
revize
7455ce1b07
3 změnil soubory, kde provedl 4 přidání a 10 odebrání
  1. 3 0
      CHANGES.md
  2. 0 5
      spec/controlbox.js
  3. 1 5
      src/converse-rosterview.js

+ 3 - 0
CHANGES.md

@@ -35,12 +35,15 @@
 - #1330: Missing room name in MUC invitation popup
 - #1445: Participants list uses big font in embedded mode
 - #1465: When highlighting a roster contact, they're incorrectly shown as online
+- #1502: Fatal error when using prebind
 - #1532: Converse reloads on enter pressed in the filter box
+- #1538: Allow adding self as contact
 - #1550: Legitimate carbons being blocked due to erroneous forgery check
 - #1554: Room auto-configuration broke if the config form contained fields with type `fixed`
 - #1558: `this.get` is not a function error when `forward_messages` is set to `true`.
 - #1572: In `fullscreen` view mode the top is cut off on iOS
 - #1576: Converse gets stuck with spinner when logging out with `auto_login` set to `true`
+- #1579: Trim spaces at the beginning and end of a JID (when adding contact)
 - #1586: Not possible to kick someone with a space in their nickname
 
 ### Breaking changes

+ 0 - 5
spec/controlbox.js

@@ -382,11 +382,6 @@
             expect(feedback_el.textContent).toBe('Sorry, could not find a contact with that name');
             feedback_el.textContent = '';
 
-            input_el.value = 'romeo';
-            modal.el.querySelector('button[type="submit"]').click();
-            feedback_el = modal.el.querySelector('.invalid-feedback');
-            expect(feedback_el.textContent).toBe('You cannot add yourself as a contact');
-
             input_el.value = 'existing';
             modal.el.querySelector('button[type="submit"]').click();
             feedback_el = modal.el.querySelector('.invalid-feedback');

+ 1 - 5
src/converse-rosterview.js

@@ -163,10 +163,6 @@ converse.plugins.add('converse-rosterview', {
                     u.addClass('is-invalid', this.el.querySelector('input[name="jid"]'));
                     u.addClass('d-block', el);
                     return false;
-                } else if (Strophe.getBareJidFromJid(jid) === _converse.bare_jid) {
-                    el.textContent = __('You cannot add yourself as a contact')
-                    u.addClass('d-block', el);
-                    return false;
                 } else if (_converse.roster.get(Strophe.getBareJidFromJid(jid))) {
                     el.textContent = __('This contact has already been added')
                     u.addClass('d-block', el);
@@ -185,7 +181,7 @@ converse.plugins.add('converse-rosterview', {
             addContactFromForm (ev) {
                 ev.preventDefault();
                 const data = new FormData(ev.target),
-                      jid = data.get('jid');
+                      jid = (data.get('jid') || '').trim();
 
                 if (!jid && _converse.xhr_user_search_url && _.isString(_converse.xhr_user_search_url)) {
                     const input_el = this.el.querySelector('input[name="name"]');