Skip to content

Commit

Permalink
#527 - Ignore sort order setting
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Aug 2, 2023
1 parent de2d587 commit 6b4faa6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 6 additions & 3 deletions uSync.Core/Serialization/Serializers/ContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ protected override SyncAttempt<IContent> DeserializeCore(XElement node, SyncSeri

details.AddRange(propertiesAttempt.Result);

// sort order
var sortOrder = node.Element("Info").Element("SortOrder").ValueOrDefault(-1);
details.AddNotNull(HandleSortOrder(item, sortOrder));
if (!options.GetSetting<bool>("IgnoreSortOrder", false))
{
// sort order
var sortOrder = node.Element("Info").Element("SortOrder").ValueOrDefault(-1);
details.AddNotNull(HandleSortOrder(item, sortOrder));
}

var publishTimer = Stopwatch.StartNew();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ protected virtual XElement SerializeInfo(TObject item, SyncSerializerOptions opt
}
info.Add(title);

info.Add(new XElement(uSyncConstants.Xml.SortOrder, item.SortOrder));
if (!options.GetSetting<bool>("IgnoreSortOrder", false))
{
info.Add(new XElement(uSyncConstants.Xml.SortOrder, item.SortOrder));
}

return info;
}
Expand Down
7 changes: 5 additions & 2 deletions uSync.Core/Serialization/Serializers/MediaSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ protected override SyncAttempt<IMedia> DeserializeCore(XElement node, SyncSerial

var info = node.Element("Info");

var sortOrder = info.Element("SortOrder").ValueOrDefault(-1);
HandleSortOrder(item, sortOrder);
if (!options.GetSetting<bool>("IgnoreSortOrder", false))
{
var sortOrder = info.Element("SortOrder").ValueOrDefault(-1);
HandleSortOrder(item, sortOrder);
}


if (details.HasWarning() && options.FailOnWarnings())
Expand Down

0 comments on commit 6b4faa6

Please sign in to comment.