SF-3709 Hide resolved note threads when importing questions from PT#3684
SF-3709 Hide resolved note threads when importing questions from PT#3684RaymondLuong3 wants to merge 2 commits intomasterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3684 +/- ##
=======================================
Coverage 81.84% 81.84%
=======================================
Files 619 619
Lines 38608 38610 +2
Branches 6290 6313 +23
=======================================
+ Hits 31600 31602 +2
+ Misses 6047 6034 -13
- Partials 961 974 +13 ☔ View full report in Codecov by Sentry. |
Nateowami
left a comment
There was a problem hiding this comment.
@Nateowami reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @RaymondLuong3).
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 45 at r1 (raw file):
CommentTags? commentTags, Func<CommentThread, bool>? predicate = null, bool activeThreadsOnly = true
I spent a good while on this line and didn't come to a single clear conclusion, but here are findings regarding this line are in order:
- It looks like you just changed the default behavior of this method (inverting what the default value is for the last arg). That means every use of this method potentially needs to be updated, and it doesn't look like that happened.
- OK, finding all references and then excluding tests and interfaces shows
ParatextService.GetNoteThreadsis the only thing that calls it, which is a little surprising. And the only caller of that method isParatextController.GetNotesAsync. So maybe it's OK? It's kind of odd thatParatextService.GetNotesdoesn't callParatextDataHelper.GetNotes, butParatextService.GetNoteThreadsdoes. It also feels wrong that we have a method that takes a predicate and a boolean flag, and only one consumer of that method, which doesn't use either. - The interface
IParatextDataHelperstill has the final property namedincludeInactiveThreads
I'm not completely certain I have 1 and 2 correct, but 3 definitely should be changed. If my analysis is correct though, we can probably just remove the predicate and final boolean flag and simplify this a lot. And then the method name could be updated to clearly indicate whether only active notes are going to be returned.
78170b8 to
6df7829
Compare
RaymondLuong3
left a comment
There was a problem hiding this comment.
@RaymondLuong3 made 1 comment.
Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @Nateowami).
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 45 at r1 (raw file):
Previously, Nateowami wrote…
I spent a good while on this line and didn't come to a single clear conclusion, but here are findings regarding this line are in order:
- It looks like you just changed the default behavior of this method (inverting what the default value is for the last arg). That means every use of this method potentially needs to be updated, and it doesn't look like that happened.
- OK, finding all references and then excluding tests and interfaces shows
ParatextService.GetNoteThreadsis the only thing that calls it, which is a little surprising. And the only caller of that method isParatextController.GetNotesAsync. So maybe it's OK? It's kind of odd thatParatextService.GetNotesdoesn't callParatextDataHelper.GetNotes, butParatextService.GetNoteThreadsdoes. It also feels wrong that we have a method that takes a predicate and a boolean flag, and only one consumer of that method, which doesn't use either.- The interface
IParatextDataHelperstill has the final property namedincludeInactiveThreadsI'm not completely certain I have 1 and 2 correct, but 3 definitely should be changed. If my analysis is correct though, we can probably just remove the predicate and final boolean flag and simplify this a lot. And then the method name could be updated to clearly indicate whether only active notes are going to be returned.
Great points. Thanks for the thoughtful review. I agree, knowing that there is currently no use case for specifying a predicate or a desire for inactive notes and there likely will not be in the future, I've simplified this based on your suggestions.
Nateowami
left a comment
There was a problem hiding this comment.
@Nateowami reviewed 3 files and all commit messages, made 5 comments, and resolved 1 discussion.
Reviewable status: 3 of 4 files reviewed, 3 unresolved discussions (waiting on @RaymondLuong3).
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 45 at r1 (raw file):
Previously, RaymondLuong3 (Raymond Luong) wrote…
Great points. Thanks for the thoughtful review. I agree, knowing that there is currently no use case for specifying a predicate or a desire for inactive notes and there likely will not be in the future, I've simplified this based on your suggestions.
Looks good.
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 41 at r2 (raw file):
} public IReadOnlyList<ParatextNote> GetNotes(CommentManager? commentManager, CommentTags? commentTags)
Why is the comment manager optional? Why are we passing in commentTags? I realize you didn't write this method, but it sure feels like the implementation and usage is mismatched.
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 48 at r2 (raw file):
// Only return note threads that are not resolved and active IEnumerable<CommentThread> threads = commentManager.FindThreads( t => t.Status != NoteStatus.Resolved,
Isn't this redundant with activeOnly: true?
test/SIL.XForge.Scripture.Tests/Services/ParatextDataHelperTests.cs line 138 at r2 (raw file):
commentTags.InitializeTagList([5]); TestEnvironment.AddComment(scrText, "thread-04", "RUT 1:4", "Note to resolve", "5"); TestEnvironment.AddComment(scrText, "thread-04", "RUT 1:4", "This is resolved", "5", resolved: true);
I did not realize C# had named arguments.
test/SIL.XForge.Scripture.Tests/Services/ParatextDataHelperTests.cs line 345 at r2 (raw file):
string? tagValue, bool deleted = false, bool resolved = false
Maybe it would make more sense to pass a NoteStatus here, rather than a boolean flag? It's more obvious what it does when calling it, even without a named argument, and more flexible.
Nateowami
left a comment
There was a problem hiding this comment.
@Nateowami made 1 comment.
Reviewable status: 3 of 4 files reviewed, 3 unresolved discussions (waiting on @RaymondLuong3).
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 41 at r2 (raw file):
Previously, Nateowami wrote…
Why is the comment manager optional? Why are we passing in commentTags? I realize you didn't write this method, but it sure feels like the implementation and usage is mismatched.
It made me wonder if it might be copied from elsewhere, but I wasn't able to find where that might be. It was added quite recently.
This PR updates the behaviour for importing community checking questions. Previously all threads for a particular tag were included, but resolved noted threads are hidden in PT and so it makes sense to exclude resolved threads and not allow users to choose them for importing questions.
This also fixes incorrect value assigned to the activeOnly parameter in CommentManager.FindThreads()
This change is