瀏覽代碼

Fix: removing the "add to contact" button in occupant modal in singleton mode (as there is no roster).

John Livingston 11 月之前
父節點
當前提交
45dd8d9656
共有 2 個文件被更改,包括 6 次插入3 次删除
  1. 1 0
      CHANGES.md
  2. 5 3
      src/plugins/muc-views/modals/templates/occupant.js

+ 1 - 0
CHANGES.md

@@ -30,6 +30,7 @@
 - New loadEmojis hook, to customize emojis at runtime.
 - New `loadEmojis` hook, to customize emojis at runtime.
 - Upgrade to Bootstrap 5
+- Fix: removing the "add to contact" button in occupant modal in singleton mode (as there is no roster).
 
 ### Breaking changes:
 

+ 5 - 3
src/plugins/muc-views/modals/templates/occupant.js

@@ -28,9 +28,11 @@ export default (el) => {
     const bare_jid = _converse.session.get('bare_jid');
     const not_me =  jid != bare_jid;
 
-    const add_to_contacts = api.contacts.get(jid)
-        .then(contact => !contact && not_me && can_see_real_jids)
-        .then(add => add ? html`<li><button class="btn btn-primary" type="button" @click=${() => el.addToContacts()}>${i18n_add_to_contacts}</button></li>` : '');
+    const add_to_contacts = api.settings.get('singleton')
+        ? '' // in singleton mode, there is no roster, so adding to contact makes no sense.
+        : api.contacts.get(jid)
+            .then(contact => !contact && not_me && can_see_real_jids)
+            .then(add => add ? html`<li><button class="btn btn-primary" type="button" @click=${() => el.addToContacts()}>${i18n_add_to_contacts}</button></li>` : '');
 
     return html`
         <div class="row">