Skip to content

Commit

Permalink
Fix: removing the "add to contact" button in occupant modal in single…
Browse files Browse the repository at this point in the history
…ton mode (as there is no roster).
  • Loading branch information
JohnXLivingston authored and jcbrand committed Aug 6, 2024
1 parent 8b5b8e6 commit 45dd8d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
8 changes: 5 additions & 3 deletions src/plugins/muc-views/modals/templates/occupant.js
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 45dd8d9

Please sign in to comment.