Use a more descriptive function name

pull/4771/head
crobibero 4 years ago
parent 8f4a4a3cc5
commit ee23d06154

@ -129,12 +129,12 @@ namespace Emby.Server.Implementations.Library
if (!query.IncludeHidden)
{
list = list.Where(i => !user.GetPreference<Guid>(PreferenceKind.MyMediaExcludes).Contains(i.Id)).ToList();
list = list.Where(i => !user.GetPreferenceValues<Guid>(PreferenceKind.MyMediaExcludes).Contains(i.Id)).ToList();
}
var sorted = _libraryManager.Sort(list, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
var orders = user.GetPreference<Guid>(PreferenceKind.OrderedViews);
var orders = user.GetPreferenceValues<Guid>(PreferenceKind.OrderedViews);
return list
.OrderBy(i =>
@ -280,7 +280,7 @@ namespace Emby.Server.Implementations.Library
{
parents = _libraryManager.GetUserRootFolder().GetChildren(user, true)
.Where(i => i is Folder)
.Where(i => !user.GetPreference<Guid>(PreferenceKind.LatestItemExcludes)
.Where(i => !user.GetPreferenceValues<Guid>(PreferenceKind.LatestItemExcludes)
.Contains(i.Id))
.ToList();
}

@ -75,7 +75,7 @@ namespace Emby.Server.Implementations.TV
{
parents = _libraryManager.GetUserRootFolder().GetChildren(user, true)
.Where(i => i is Folder)
.Where(i => !user.GetPreference<Guid>(PreferenceKind.LatestItemExcludes).Contains(i.Id))
.Where(i => !user.GetPreferenceValues<Guid>(PreferenceKind.LatestItemExcludes).Contains(i.Id))
.ToArray();
}

@ -254,9 +254,9 @@ namespace Jellyfin.Api.Controllers
includeItemTypes = new[] { "Playlist" };
}
var enabledChannels = user!.GetPreference<Guid>(PreferenceKind.EnabledChannels);
var enabledChannels = user!.GetPreferenceValues<Guid>(PreferenceKind.EnabledChannels);
bool isInEnabledFolder = Array.IndexOf(user.GetPreference<Guid>(PreferenceKind.EnabledFolders), item.Id) != -1
bool isInEnabledFolder = Array.IndexOf(user.GetPreferenceValues<Guid>(PreferenceKind.EnabledFolders), item.Id) != -1
// Assume all folders inside an EnabledChannel are enabled
|| Array.IndexOf(enabledChannels, item.Id) != -1
// Assume all items inside an EnabledChannel are enabled
@ -265,7 +265,7 @@ namespace Jellyfin.Api.Controllers
var collectionFolders = _libraryManager.GetCollectionFolders(item);
foreach (var collectionFolder in collectionFolders)
{
if (user.GetPreference<Guid>(PreferenceKind.EnabledFolders).Contains(collectionFolder.Id))
if (user.GetPreferenceValues<Guid>(PreferenceKind.EnabledFolders).Contains(collectionFolder.Id))
{
isInEnabledFolder = true;
}
@ -786,7 +786,7 @@ namespace Jellyfin.Api.Controllers
var ancestorIds = Array.Empty<Guid>();
var excludeFolderIds = user.GetPreference<Guid>(PreferenceKind.LatestItemExcludes);
var excludeFolderIds = user.GetPreferenceValues<Guid>(PreferenceKind.LatestItemExcludes);
if (parentIdGuid.Equals(Guid.Empty) && excludeFolderIds.Length > 0)
{
ancestorIds = _libraryManager.GetUserRootFolder().GetChildren(user, true)

@ -419,7 +419,7 @@ namespace Jellyfin.Data.Entities
/// <param name="preference">The preference kind.</param>
/// <typeparam name="T">Type of preference.</typeparam>
/// <returns>A {T} array containing the user's preference.</returns>
public T[] GetPreference<T>(PreferenceKind preference)
public T[] GetPreferenceValues<T>(PreferenceKind preference)
{
var val = Preferences.First(p => p.Kind == preference).Value;
if (string.IsNullOrEmpty(val))
@ -499,7 +499,7 @@ namespace Jellyfin.Data.Entities
/// <returns><c>True</c> if the folder is in the user's grouped folders.</returns>
public bool IsFolderGrouped(Guid id)
{
return Array.IndexOf(GetPreference<Guid>(PreferenceKind.GroupedFolders), id) != -1;
return Array.IndexOf(GetPreferenceValues<Guid>(PreferenceKind.GroupedFolders), id) != -1;
}
private static bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date)

@ -376,14 +376,14 @@ namespace Jellyfin.Server.Implementations.Users
EnablePublicSharing = user.HasPermission(PermissionKind.EnablePublicSharing),
AccessSchedules = user.AccessSchedules.ToArray(),
BlockedTags = user.GetPreference(PreferenceKind.BlockedTags),
EnabledChannels = user.GetPreference<Guid>(PreferenceKind.EnabledChannels),
EnabledChannels = user.GetPreferenceValues<Guid>(PreferenceKind.EnabledChannels),
EnabledDevices = user.GetPreference(PreferenceKind.EnabledDevices),
EnabledFolders = user.GetPreference<Guid>(PreferenceKind.EnabledFolders),
EnabledFolders = user.GetPreferenceValues<Guid>(PreferenceKind.EnabledFolders),
EnableContentDeletionFromFolders = user.GetPreference(PreferenceKind.EnableContentDeletionFromFolders),
SyncPlayAccess = user.SyncPlayAccess,
BlockedChannels = user.GetPreference<Guid>(PreferenceKind.BlockedChannels),
BlockedMediaFolders = user.GetPreference<Guid>(PreferenceKind.BlockedMediaFolders),
BlockUnratedItems = user.GetPreference<UnratedItem>(PreferenceKind.BlockUnratedItems)
BlockedChannels = user.GetPreferenceValues<Guid>(PreferenceKind.BlockedChannels),
BlockedMediaFolders = user.GetPreferenceValues<Guid>(PreferenceKind.BlockedMediaFolders),
BlockUnratedItems = user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems)
}
};
}

@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Channels
{
public override bool IsVisible(User user)
{
var blockedChannelsPreference = user.GetPreference<Guid>(PreferenceKind.BlockedChannels);
var blockedChannelsPreference = user.GetPreferenceValues<Guid>(PreferenceKind.BlockedChannels);
if (blockedChannelsPreference.Length != 0)
{
if (blockedChannelsPreference.Contains(Id))
@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.Channels
else
{
if (!user.HasPermission(PermissionKind.EnableAllChannels)
&& !user.GetPreference<Guid>(PreferenceKind.EnabledChannels).Contains(Id))
&& !user.GetPreferenceValues<Guid>(PreferenceKind.EnabledChannels).Contains(Id))
{
return false;
}

@ -120,7 +120,7 @@ namespace MediaBrowser.Controller.Entities.Audio
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music);
return user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music);
}
public override UnratedItem GetBlockUnratedType()

@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.Entities.Audio
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music);
return user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music);
}
public override UnratedItem GetBlockUnratedType()

@ -480,7 +480,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
var allowed = user.GetPreference<Guid>(PreferenceKind.EnableContentDeletionFromFolders);
var allowed = user.GetPreferenceValues<Guid>(PreferenceKind.EnableContentDeletionFromFolders);
if (SourceType == SourceType.Channel)
{
@ -1909,7 +1909,7 @@ namespace MediaBrowser.Controller.Entities
return false;
}
return user.GetPreference<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(GetBlockUnratedType());
return user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(GetBlockUnratedType());
}
/// <summary>

@ -186,7 +186,7 @@ namespace MediaBrowser.Controller.Entities
{
if (this is ICollectionFolder && !(this is BasePluginFolder))
{
var blockedMediaFolders = user.GetPreference<Guid>(PreferenceKind.BlockedMediaFolders);
var blockedMediaFolders = user.GetPreferenceValues<Guid>(PreferenceKind.BlockedMediaFolders);
if (blockedMediaFolders.Length > 0)
{
if (blockedMediaFolders.Contains(Id))
@ -197,7 +197,7 @@ namespace MediaBrowser.Controller.Entities
else
{
if (!user.HasPermission(PermissionKind.EnableAllFolders)
&& !user.GetPreference<Guid>(PreferenceKind.EnabledFolders).Contains(Id))
&& !user.GetPreferenceValues<Guid>(PreferenceKind.EnabledFolders).Contains(Id))
{
return false;
}

@ -49,7 +49,7 @@ namespace MediaBrowser.Controller.Entities.Movies
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Movie);
return user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Movie);
}
public override double GetDefaultPrimaryImageAspectRatio()

@ -452,7 +452,7 @@ namespace MediaBrowser.Controller.Entities.TV
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Series);
return user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Series);
}
public override UnratedItem GetBlockUnratedType()

Loading…
Cancel
Save