diff --git a/src/plugins/profile/modals/profile.js b/src/plugins/profile/modals/profile.js index 51da14b4b0..6b0cd53f7f 100644 --- a/src/plugins/profile/modals/profile.js +++ b/src/plugins/profile/modals/profile.js @@ -87,6 +87,15 @@ export default class ProfileModal extends BaseModal { }); } } + + async isBlockingAvailable() { + if (_converse.pluggable.plugins['converse-blocking']?.enabled(_converse)) { + const is_available = await api.isBlockingAvailable(); + return is_available; + } + + return false; + } } api.elements.define('converse-profile-modal', ProfileModal); diff --git a/src/plugins/profile/templates/profile_modal.js b/src/plugins/profile/templates/profile_modal.js index 012133f61b..f296c5ad20 100644 --- a/src/plugins/profile/templates/profile_modal.js +++ b/src/plugins/profile/templates/profile_modal.js @@ -1,6 +1,6 @@ import "shared/components/image-picker.js"; import { __ } from 'i18n'; -import { _converse, api } from "@converse/headless/core"; +import { _converse } from "@converse/headless/core"; import { html } from "lit"; @@ -57,9 +57,7 @@ export default (el) => { ` ); - const blocking_available = (_converse.pluggable.plugins['converse-blocking']?.enabled(_converse) && api.isBlockingAvailable()); - - if (blocking_available) { + if (el.isBlockingAvailable()) { navigation_tabs.push(html`