Ensure friends list shows unfriend button when manageable

This commit is contained in:
thePR0M3TH3AN committed 2025-10-26 20:06:02 -04:00
1 parent 9cca8996fb
commit d8f28f98e9
1 file changed
+17 -1
+17 -1
View File
@@ -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 = "";