From 45dd8d96568adc82fd26ae5b02c2d9e45532d8e6 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 6 Aug 2024 12:23:00 +0200 Subject: [PATCH] Fix: removing the "add to contact" button in occupant modal in singleton mode (as there is no roster). --- CHANGES.md | 1 + src/plugins/muc-views/modals/templates/occupant.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0d0d605a61..96721a797a 100644 --- a/CHANGES.md +++ b/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: diff --git a/src/plugins/muc-views/modals/templates/occupant.js b/src/plugins/muc-views/modals/templates/occupant.js index c411885190..7377fe91e0 100644 --- a/src/plugins/muc-views/modals/templates/occupant.js +++ b/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`
  • ` : ''); + 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`
  • ` : ''); return html`