Check all tags for allow/block (#11206)

This commit is contained in:
Cody Robibero 2024-03-25 07:15:24 -06:00 committed by GitHub
parent 775815d09c
commit 5437936bb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1586,18 +1586,24 @@ namespace MediaBrowser.Controller.Entities
list.AddRange(parent.Tags);
}
foreach (var folder in LibraryManager.GetCollectionFolders(this))
{
list.AddRange(folder.Tags);
}
return list.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
}
private bool IsVisibleViaTags(User user)
{
if (user.GetPreference(PreferenceKind.BlockedTags).Any(i => Tags.Contains(i, StringComparison.OrdinalIgnoreCase)))
var allTags = GetInheritedTags();
if (user.GetPreference(PreferenceKind.BlockedTags).Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase)))
{
return false;
}
var allowedTagsPreference = user.GetPreference(PreferenceKind.AllowedTags);
if (allowedTagsPreference.Any() && !allowedTagsPreference.Any(i => Tags.Contains(i, StringComparison.OrdinalIgnoreCase)))
if (allowedTagsPreference.Length != 0 && !allowedTagsPreference.Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase)))
{
return false;
}