Skip to content

Commit

Permalink
Update ParatextData to 9.5.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pmachapman authored and Nateowami committed Dec 20, 2024
1 parent f7f6503 commit 1c7d572
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Migrations/BackoutCommits/BackoutCommits.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ItemGroup>
<ProjectReference Include="..\..\SIL.XForge.Scripture\SIL.XForge.Scripture.csproj" />
<ProjectReference Include="..\..\SIL.XForge\SIL.XForge.csproj" />
<PackageReference Include="ParatextData" Version="9.5.0.5" />
<PackageReference Include="ParatextData" Version="9.5.0.8" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.1.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/SIL.XForge.Scripture/SIL.XForge.Scripture.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<PackageReference Include="NPOI" Version="2.7.2" />
<!-- When using a new major or minor version of ParatextData, update where dependencies.yml copies the
InternetSettings.xml file. Also update server config scriptureforge.org_v2.yml. -->
<PackageReference Include="ParatextData" Version="9.5.0.5" />
<PackageReference Include="ParatextData" Version="9.5.0.8" />
<PackageReference Include="Serval.Client" Version="1.8.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.6.2" />
Expand Down
7 changes: 5 additions & 2 deletions src/SIL.XForge.Scripture/Services/NotesFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,11 @@ private static void ParseContents(XElement? contentElem, Comment comment)
contents = sb.ToString();
}

comment.AddTextToContent(string.Empty, false);
comment.Contents.InnerXml = contents;
// Since PTX-23738 we must create the contents node,
// as the setter for Contents reads and stores the OuterXml
XmlElement contentsElement = comment.GetOrCreateCommentNode();
contentsElement.InnerXml = contents;
comment.Contents = contentsElement;
}

private static void ParseParagraph(XElement paraElem, StringBuilder sb)
Expand Down
21 changes: 15 additions & 6 deletions src/SIL.XForge.Scripture/Services/ParatextService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MongoDB.Driver.Linq;
using Newtonsoft.Json.Linq;
using Paratext.Data;
using Paratext.Data.Languages;
Expand Down Expand Up @@ -1050,7 +1049,8 @@ public async Task<int> PutBookText(
scrText.ScrStylesheet(bookNum),
usx.CreateNavigator(),
XPathExpression.Compile("*[false()]"),
out string usfm
out string usfm,
scrText.Settings.AllowInvisibleChars
);
log.AppendLine($"Created usfm of {usfm}");
// Among other things, normalizing the USFM will remove trailing spaces at the end of verses,
Expand Down Expand Up @@ -2911,9 +2911,11 @@ Dictionary<string, ParatextUserProfile> ptProjectUsers
{
try
{
if (comment.Contents == null)
comment.AddTextToContent(string.Empty, false);
comment.Contents!.InnerXml = xml;
// Since PTX-23738 we must create the contents node,
// as the setter for Contents reads and stores the OuterXml
XmlElement contentsElement = comment.GetOrCreateCommentNode();
contentsElement.InnerXml = xml;
comment.Contents = contentsElement;
comment.VersionNumber++;
commentUpdated = true;
}
Expand Down Expand Up @@ -3181,7 +3183,14 @@ bool isFirstComment
comment.Deleted = note.Deleted;

if (!string.IsNullOrEmpty(note.Content))
comment.GetOrCreateCommentNode().InnerXml = GetCommentContentsFromNote(note, displayNames, ptProjectUsers);
{
// Since PTX-23738 we must create the contents node,
// as the setter for Contents reads and stores the OuterXml
XmlElement contentsElement = comment.GetOrCreateCommentNode();
contentsElement.InnerXml = GetCommentContentsFromNote(note, displayNames, ptProjectUsers) ?? string.Empty;
comment.Contents = contentsElement;
}

if (!_userSecretRepository.Query().Any(u => u.Id == note.OwnerRef))
comment.ExternalUser = note.OwnerRef;
comment.TagsAdded =
Expand Down
13 changes: 9 additions & 4 deletions test/SIL.XForge.Scripture.Tests/Services/DeltaUsxMapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Newtonsoft.Json.Linq;
using NSubstitute;
using NUnit.Framework;
using Paratext.Data;
using SIL.XForge.Realtime.RichText;
using SIL.XForge.Scripture.Models;

Expand All @@ -24,6 +25,7 @@ public class DeltaUsxMapperTests
private IGuidService _testGuidService;
private ILogger<DeltaUsxMapper> _logger;
private IExceptionHandler _exceptionHandler;
private ScrText _scrText;

[SetUp]
public void Init()
Expand All @@ -32,6 +34,7 @@ public void Init()
_testGuidService = new TestGuidService();
_logger = Substitute.For<ILogger<DeltaUsxMapper>>();
_exceptionHandler = Substitute.For<IExceptionHandler>();
_scrText = new MockScrText(new SFParatextUser("ptUser01"), new ProjectName());
}

[Test]
Expand Down Expand Up @@ -2825,8 +2828,9 @@ public void ToDelta_TableInMiddleFollowedByCharStyle()
\p E
\v 2 F \nd ND\nd*
""";
XmlDocument usfmToUsxLoading = Paratext.Data.UsfmToUsx.ConvertToXmlDocument(
new Paratext.Data.MockScrStylesheet("usfm.sty"),
XmlDocument usfmToUsxLoading = UsfmToUsx.ConvertToXmlDocument(
_scrText,
new MockScrStylesheet("usfm.sty"),
bookUsfm
);
using XmlNodeReader nodeReader = new(usfmToUsxLoading);
Expand Down Expand Up @@ -3703,8 +3707,9 @@ private bool DoesRoundtrip(string bookUsfm, out string errorMessage)
{
string bookCode = ExtractBookCode(bookUsfm);

XmlDocument bookUsxLoading = Paratext.Data.UsfmToUsx.ConvertToXmlDocument(
new Paratext.Data.MockScrStylesheet("usfm.sty"),
XmlDocument bookUsxLoading = UsfmToUsx.ConvertToXmlDocument(
_scrText,
new MockScrStylesheet("usfm.sty"),
bookUsfm
);
using XmlNodeReader nodeReader = new(bookUsxLoading);
Expand Down
2 changes: 1 addition & 1 deletion tools/CommentGenerator/CommentGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="NLipsum" Version="1.1.0" />
<PackageReference Include="ParatextData" Version="9.5.0.5" />
<PackageReference Include="ParatextData" Version="9.5.0.8" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tools/RepoInfo/RepoInfo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ParatextData" Version="9.5.0.5" />
<PackageReference Include="ParatextData" Version="9.5.0.8" />
</ItemGroup>

</Project>

0 comments on commit 1c7d572

Please sign in to comment.