Skip to content

Commit 647de40

Browse files
committed
Merge branch 'bugfix/Attributes-IsDirty' into release/5.1.0
If a topic is loaded in the OnTopic Editor and immediately saved without making changes, then no updates to the database should be made. In practice, however, the `LastModified` and `LastModifiedBy` attributes were getting saved in this scenario. This was due to two bugs. The first is because of a string comparison issue in the underlying `TrackedRecordCollection<>.SetValue()` used to compare attribute values; this was fixed in OnTopic 5.1.0 RC1 (OnTopicCMS/OnTopic-Library#86, f354499). The second was an issue with CRLFs (`\r\n`) getting reduced to line feeds (`\n`) in SQL's XML column, and thus mismatching form submissions which still contained CRLFs for line breaks; this was fixed by cleaning the `AttributeBindingModel.Value` before setting it via `Topic.Attributes.SetValue()` (e10c666). Together, these resolve #48.
2 parents db0983c + e10c666 commit 647de40

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

OnTopic.Editor.AspNetCore.Attributes/OnTopic.Editor.AspNetCore.Attributes.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<PrivateAssets>all</PrivateAssets>
2626
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2727
</PackageReference>
28-
<PackageReference Include="OnTopic" Version="5.1.0-beta.0" />
28+
<PackageReference Include="OnTopic" Version="5.1.0-rc.1" />
2929
</ItemGroup>
3030

3131
<ItemGroup>

OnTopic.Editor.AspNetCore.Host/OnTopic.Editor.AspNetCore.Host.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="OnTopic.Data.Caching" Version="5.1.0-beta.0" />
15-
<PackageReference Include="OnTopic.Data.Sql" Version="5.1.0-beta.0" />
14+
<PackageReference Include="OnTopic.Data.Caching" Version="5.1.0-rc.1" />
15+
<PackageReference Include="OnTopic.Data.Sql" Version="5.1.0-rc.1" />
1616
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.5" />
1717
</ItemGroup>
1818

OnTopic.Editor.AspNetCore/Controllers/EditorController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ public async Task<IActionResult> Edit(
444444
topic.Attributes.SetValue(attribute.Key, attribute.DefaultValue);
445445
}
446446
else {
447-
topic.Attributes.SetValue(attribute.Key, attributeValue.Value);
447+
var value = attributeValue.Value?.Replace("\r\n", "\n", StringComparison.Ordinal);
448+
topic.Attributes.SetValue(attribute.Key, value);
448449
}
449450

450451
}

OnTopic.Editor.AspNetCore/OnTopic.Editor.AspNetCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
<PrivateAssets>all</PrivateAssets>
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
</PackageReference>
27-
<PackageReference Include="OnTopic" Version="5.1.0-beta.0" />
27+
<PackageReference Include="OnTopic" Version="5.1.0-rc.1" />
2828
<PackageReference Include="OnTopic.Data.Transfer" Version="2.0.0" />
29-
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="5.1.0-beta.0" />
29+
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="5.1.0-rc.1" />
3030
</ItemGroup>
3131

3232
</Project>

0 commit comments

Comments
 (0)