Merge pull request #949 from PR0M3TH3AN/codex/add-unfriend-button-to-friends-list

Add unfriend option to profile friends list
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2025-10-26 20:08:21 -04:00
commit 6b7f8835ca
1 file changed
+18 -2
+18 -2
View File
@@ -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 = "";