diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index 2a6b8fae..ad25144b 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -4883,6 +4883,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"); @@ -4936,9 +4937,9 @@ export class ProfileModalController { actions.appendChild(copyButton); } - if (hex && !usedModerationService) { + if (hex && canRemoveFriends) { const removeButton = this.createRemoveButton({ - label: "Remove", + label: "Unfriend", onRemove: () => this.handleRemoveFriend(hex), }); if (removeButton) { @@ -4973,6 +4974,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 = "";