Fix(Blocked Content): Manage System Not Working

This commit is contained in:
Samidy 2026-03-29 18:05:05 +03:00
parent 022c27056b
commit edc0b5d1bd
4 changed files with 74 additions and 10 deletions

View file

@ -4501,6 +4501,64 @@
</button>
</div>
</div>
<div
id="blocked-content-list"
style="
display: none;
margin-top: 1rem;
border-top: 1px solid var(--border);
padding-top: 1rem;
"
>
<div
id="blocked-empty-message"
style="text-align: center; color: var(--muted-foreground); padding: 1rem"
>
No content blocked yet.
</div>
<div id="blocked-artists-section" style="margin-bottom: 1.5rem; display: none">
<h4
style="
font-size: 0.875rem;
font-weight: 600;
margin-bottom: 0.5rem;
color: var(--foreground);
"
>
Blocked Artists
</h4>
<ul id="blocked-artists-list" class="blocked-items-list"></ul>
</div>
<div id="blocked-albums-section" style="margin-bottom: 1.5rem; display: none">
<h4
style="
font-size: 0.875rem;
font-weight: 600;
margin-bottom: 0.5rem;
color: var(--foreground);
"
>
Blocked Albums
</h4>
<ul id="blocked-albums-list" class="blocked-items-list"></ul>
</div>
<div id="blocked-tracks-section" style="margin-bottom: 1.5rem; display: none">
<h4
style="
font-size: 0.875rem;
font-weight: 600;
margin-bottom: 0.5rem;
color: var(--foreground);
"
>
Blocked Tracks
</h4>
<ul id="blocked-tracks-list" class="blocked-items-list"></ul>
</div>
</div>
</div>
<p
id="settings-commit-info"

View file

@ -1858,8 +1858,8 @@ export async function handleTrackAction(
} else if (action === 'block-album') {
const { contentBlockingSettings } = await import('./storage.js');
const albumId = type === 'album' ? item.id : item.album?.id;
const albumTitle = type === 'album' ? item.title : item.album?.title;
const albumArtist = type === 'album' ? item.artist : item.album?.artist;
const albumTitle = type === 'album' ? (item.title || item.name) : (item.album?.title || item.album?.name);
const albumArtist = type === 'album' ? (item.artist?.name || item.artist) : (item.album?.artist?.name || item.album?.artist);
if (!albumId) {
showNotification('No album information available');

View file

@ -3718,6 +3718,8 @@ function initializeBlockedContentManager() {
e.stopPropagation();
const id = btn.dataset.id;
const type = btn.dataset.type;
const itemLi = btn.closest('li');
const itemName = itemLi ? itemLi.querySelector('.item-name').textContent : 'item';
if (type === 'artist') {
contentBlockingSettings.unblockArtist(id);
@ -3727,6 +3729,10 @@ function initializeBlockedContentManager() {
contentBlockingSettings.unblockTrack(id);
}
if (typeof showNotification === 'function') {
showNotification(`Unblocked ${type}: ${itemName}`);
}
renderBlockedLists();
});
});

View file

@ -2543,7 +2543,7 @@ export const contentBlockingSettings = {
isArtistBlocked(artistId) {
if (!artistId) return false;
return this.getBlockedArtists().some((a) => a.id === artistId);
return this.getBlockedArtists().some((a) => a.id == artistId);
},
blockArtist(artist) {
@ -2560,7 +2560,7 @@ export const contentBlockingSettings = {
},
unblockArtist(artistId) {
const blocked = this.getBlockedArtists().filter((a) => a.id !== artistId);
const blocked = this.getBlockedArtists().filter((a) => a.id != artistId);
this.setBlockedArtists(blocked);
},
@ -2580,13 +2580,13 @@ export const contentBlockingSettings = {
isTrackBlocked(trackId) {
if (!trackId) return false;
return this.getBlockedTracks().some((t) => t.id === trackId);
return this.getBlockedTracks().some((t) => t.id == trackId);
},
blockTrack(track) {
if (!track || !track.id) return;
const blocked = this.getBlockedTracks();
if (!blocked.some((t) => t.id === track.id)) {
if (!blocked.some((t) => t.id == track.id)) {
blocked.push({
id: track.id,
title: track.title || 'Unknown Track',
@ -2598,7 +2598,7 @@ export const contentBlockingSettings = {
},
unblockTrack(trackId) {
const blocked = this.getBlockedTracks().filter((t) => t.id !== trackId);
const blocked = this.getBlockedTracks().filter((t) => t.id != trackId);
this.setBlockedTracks(blocked);
},
@ -2618,13 +2618,13 @@ export const contentBlockingSettings = {
isAlbumBlocked(albumId) {
if (!albumId) return false;
return this.getBlockedAlbums().some((a) => a.id === albumId);
return this.getBlockedAlbums().some((a) => a.id == albumId);
},
blockAlbum(album) {
if (!album || !album.id) return;
const blocked = this.getBlockedAlbums();
if (!blocked.some((a) => a.id === album.id)) {
if (!blocked.some((a) => a.id == album.id)) {
blocked.push({
id: album.id,
title: album.title || 'Unknown Album',
@ -2636,7 +2636,7 @@ export const contentBlockingSettings = {
},
unblockAlbum(albumId) {
const blocked = this.getBlockedAlbums().filter((a) => a.id !== albumId);
const blocked = this.getBlockedAlbums().filter((a) => a.id != albumId);
this.setBlockedAlbums(blocked);
},