Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect /find Info for tree and plain types consistently #1685

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

paskal
Copy link
Sponsor Collaborator

@paskal paskal commented Oct 18, 2023

MakeTree calculated Info locally for historical reasons, and the results were consistent with the dataService.Info call but calculated differently. Requesting plain format comments, on the other hand, had a problem with not returning the read-only status of the page if it doesn't have any comments yet.

That change fixes that, ensuring that Info is requested in the same manner and the read-only status is returned correctly in case the post doesn't have comments but has such a status.

@github-actions
Copy link

github-actions bot commented Oct 18, 2023

Pull Request Test Coverage Report for Build 8008368310

Details

  • 0 of 26 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 84.871%

Totals Coverage Status
Change from base Build 7992566957: -0.02%
Covered Lines: 5969
Relevant Lines: 7033

💛 - Coveralls

@@ -106,7 +84,8 @@ func (t *Tree) proc(comments []store.Comment, node *Node, rd *recurData, parentI
sort.Slice(node.Replies, func(i, j int) bool {
return node.Replies[i].Comment.Timestamp.Before(node.Replies[j].Comment.Timestamp)
})
return node, rd.tsModified, rd.tsCreated
node.tsModified, node.tsCreated = rd.tsModified, rd.tsCreated
Copy link
Sponsor Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is magic, I have no idea why it doesn't mess up tsCreated or tsModified of any of the nodes. Maybe we just don't have good enough test cases to catch it.

@paskal paskal force-pushed the paskal/consistent_info branch 6 times, most recently from 427e446 to 317bdad Compare November 4, 2023 22:28
@paskal paskal force-pushed the paskal/consistent_info branch 2 times, most recently from 9c146b9 to 7e5fdf0 Compare November 12, 2023 12:32
@paskal paskal force-pushed the paskal/consistent_info branch 4 times, most recently from 4cd4ebe to dc232ae Compare February 22, 2024 17:13
MakeTree calculated Info locally for historical reasons,
and the results were consistent with the dataService.Info call
but calculated differently.

That change fixes that, ensuring that Info is requested
in the same manner.
Copy link
Owner

@umputun umputun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@umputun umputun merged commit e574318 into master Mar 16, 2024
3 checks passed
@umputun umputun deleted the paskal/consistent_info branch March 16, 2024 17:49
@paskal paskal added this to the v1.13.0 milestone Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants