diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index d050d2d1..cb4cf64f 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -3893,6 +3893,7 @@ export class ProfileModalController { : (value) => (typeof value === "string" ? value : ""); const entriesNeedingFetch = new Set(); + const canRemoveFriends = this.canManageFriendsList(); deduped.forEach(({ hex, label }) => { const item = document.createElement("li"); @@ -3946,7 +3947,7 @@ export class ProfileModalController { actions.appendChild(copyButton); } - if (hex && !usedModerationService) { + if (hex && canRemoveFriends) { const removeButton = this.createRemoveButton({ label: "Unfriend", onRemove: () => this.handleRemoveFriend(hex), @@ -3983,6 +3984,21 @@ export class ProfileModalController { } } + canManageFriendsList() { + if ( + this.moderationService && + (!this.subscriptionsService || + typeof this.subscriptionsService.removeChannel !== "function") + ) { + return false; + } + + return ( + this.subscriptionsService && + typeof this.subscriptionsService.removeChannel === "function" + ); + } + clearFriendsList() { if (this.friendList instanceof HTMLElement) { this.friendList.innerHTML = "";