Skip to content

Commit

Permalink
remove logic from template
Browse files Browse the repository at this point in the history
  • Loading branch information
udanieli committed May 31, 2023
1 parent dacc9ea commit c1c7a93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/plugins/profile/modals/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
6 changes: 2 additions & 4 deletions src/plugins/profile/templates/profile_modal.js
Original file line number Diff line number Diff line change
@@ -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";


Expand Down Expand Up @@ -57,9 +57,7 @@ export default (el) => {
</li>`
);

const blocking_available = (_converse.pluggable.plugins['converse-blocking']?.enabled(_converse) && api.isBlockingAvailable());

if (blocking_available) {
if (el.isBlockingAvailable()) {
navigation_tabs.push(html`<li role="presentation" class="nav-item">
<a class="nav-link ${el.tab === "blockedusers" ? "active" : ""}"
id="blockedusers-tab"
Expand Down

0 comments on commit c1c7a93

Please sign in to comment.