mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
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:
1 file changed
+18
-2
@@ -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 = "";
|
||||
|
||||
Reference in new issue
Block a user