Sfoglia il codice sorgente

Fixes #144. Fall back to JID if name is not available

JC Brand 6 anni fa
parent
commit
d300be58cc
4 ha cambiato i file con 5 aggiunte e 4 eliminazioni
  1. 1 0
      CHANGES.md
  2. 2 2
      dist/converse.js
  3. 1 1
      src/converse-rosterview.js
  4. 1 1
      src/headless/converse-roster.js

+ 1 - 0
CHANGES.md

@@ -30,6 +30,7 @@
 - #1467: Fix rendering of URLs enclosed with sharp brackets such as <https://example.org>
 - #1479: Allow file upload by drag & drop also in MUCs
 - #1487: New config option [muc_respect_autojoin](https://conversejs.org/docs/html/configuration.html#muc-respect-autojoin)
+- #1488: In error message, fall back to JID if name is not available.
 - #1501: Don't prompt for a reason if [auto_join_on_invite](https://conversejs.org/docs/html/configuration.html#auto-join-on-invite) is `true`
 - #1507: Make message id and origin-id identical in order to fix LMC with Conversations
 - #1508: Minimized bookmarked chatboxes should not be always maximized after page reload.

+ 2 - 2
dist/converse.js

@@ -59548,7 +59548,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
         } catch (e) {
           _converse.log(e, Strophe.LogLevel.ERROR);
 
-          _converse.api.alert.show(Strophe.LogLevel.ERROR, __('Sorry, there was an error while trying to remove %1$s as a contact.', name));
+          _converse.api.alert.show(Strophe.LogLevel.ERROR, __('Sorry, there was an error while trying to remove %1$s as a contact.', this.model.getDisplayName()));
         }
       },
 
@@ -68687,7 +68687,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
         } catch (e) {
           _converse.log(e, Strophe.LogLevel.ERROR);
 
-          alert(__('Sorry, there was an error while trying to add %1$s as a contact.', name));
+          alert(__('Sorry, there was an error while trying to add %1$s as a contact.', name || jid));
           return e;
         }
 

+ 1 - 1
src/converse-rosterview.js

@@ -563,7 +563,7 @@ converse.plugins.add('converse-rosterview', {
                     _converse.log(e, Strophe.LogLevel.ERROR);
                     _converse.api.alert.show(
                         Strophe.LogLevel.ERROR,
-                        __('Sorry, there was an error while trying to remove %1$s as a contact.', name)
+                        __('Sorry, there was an error while trying to remove %1$s as a contact.', this.model.getDisplayName())
                     );
                 }
             },

+ 1 - 1
src/headless/converse-roster.js

@@ -478,7 +478,7 @@ converse.plugins.add('converse-roster', {
                     await this.sendContactAddIQ(jid, name, groups);
                 } catch (e) {
                     _converse.log(e, Strophe.LogLevel.ERROR);
-                    alert(__('Sorry, there was an error while trying to add %1$s as a contact.', name));
+                    alert(__('Sorry, there was an error while trying to add %1$s as a contact.', name || jid));
                     return e;
                 }
                 return this.create(_.assignIn({