mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-10-26 16:45:09 +00:00
Backport pull request #18236 from jellyfin/release-12.z
Fix user preferences when renaming libraries
Original-merge: 9203258175
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
1 parent
8c7878afaa
commit
d624b7c57a
4 files changed
+321
-47
No files matched your search
@@ -3052,14 +3052,7 @@ namespace Emby.Server.Implementations.Library
|
||||
CollectionType? viewType,
|
||||
string sortName)
|
||||
{
|
||||
var parentIdString = parentId.IsEmpty()
|
||||
? null
|
||||
: parentId.ToString("N", CultureInfo.InvariantCulture);
|
||||
|
||||
// The name is either localized (grouped views) or the library folder's own name.
|
||||
var idValues = "38_namedview_" + user.Id.ToString("N", CultureInfo.InvariantCulture) + (parentIdString ?? string.Empty) + (viewType?.ToString() ?? string.Empty);
|
||||
|
||||
var id = GetNewItemId(idValues, typeof(UserView));
|
||||
var id = GetNamedViewId(user, parentId, viewType);
|
||||
|
||||
var path = Path.Combine(_configurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N", CultureInfo.InvariantCulture));
|
||||
|
||||
@@ -3117,6 +3110,18 @@ namespace Emby.Server.Implementations.Library
|
||||
return item;
|
||||
}
|
||||
|
||||
public Guid GetNamedViewId(User user, Guid parentId, CollectionType? viewType)
|
||||
{
|
||||
var parentIdString = parentId.IsEmpty()
|
||||
? null
|
||||
: parentId.ToString("N", CultureInfo.InvariantCulture);
|
||||
|
||||
// The name is either localized (grouped views) or the library folder's own name.
|
||||
var idValues = "38_namedview_" + user.Id.ToString("N", CultureInfo.InvariantCulture) + (parentIdString ?? string.Empty) + (viewType?.ToString() ?? string.Empty);
|
||||
|
||||
return GetNewItemId(idValues, typeof(UserView));
|
||||
}
|
||||
|
||||
public UserView GetShadowView(
|
||||
BaseItem parent,
|
||||
CollectionType? viewType,
|
||||
@@ -3126,10 +3131,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var name = parent.Name;
|
||||
var parentId = parent.Id;
|
||||
|
||||
var idValues = "38_namedview_" + name + parentId + (viewType?.ToString() ?? string.Empty);
|
||||
|
||||
var id = GetNewItemId(idValues, typeof(UserView));
|
||||
var id = GetShadowViewId(name, parentId, viewType);
|
||||
|
||||
var path = parent.Path;
|
||||
|
||||
@@ -3181,6 +3183,13 @@ namespace Emby.Server.Implementations.Library
|
||||
return item;
|
||||
}
|
||||
|
||||
public Guid GetShadowViewId(string name, Guid parentId, CollectionType? viewType)
|
||||
{
|
||||
var idValues = "38_namedview_" + name + parentId + (viewType?.ToString() ?? string.Empty);
|
||||
|
||||
return GetNewItemId(idValues, typeof(UserView));
|
||||
}
|
||||
|
||||
public UserView GetNamedView(
|
||||
string name,
|
||||
Guid parentId,
|
||||
|
||||
Reference in new issue
Block a user