Add local user and post count to nodeinfo responses #1325
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This fixes #1307 (at least partially). The nodeinfo endpoint should now return the total users on an instance, along with their post count.
I have a couple outstanding questions, specifically around the extra bits I didn't add to the
NodeInfoUsers
struct (the active users in the past month/active users in the past 6 months).It doesn't look like there are currently database functions for querying users active since $date (and if there are, I can add those metrics to the node info response). I'm not familiar enough with the GTS database structure to be able to quickly write those queries, but I am willing to dive in and figure it out if you the maintainers would like that (and also split that bit out into a new issue and pull request because it feels like added scope).
So my main question is do you want those recently active stats in this response? Because I can see arguments around privacy both for and against it, and I don't know what your preference would be.
Checklist
Please put an x inside each checkbox to indicate that you've read and followed it:
[ ]
->[x]
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
go fmt ./...
andgolangci-lint run
.Just as a note, I have run the tests locally, but they're failing on the
internal/media
package, and I'm not sure if it's related or if it's because I'm running on an m2 macbook and there might be some weirdness there. The output log was too long for my terminal's scrollback, but I can try adjusting that and running the tests again too.I'm not sure if there are any changes necessary to the documentation, but if there are, let me know and I'll make them.
And similarly, I'm not sure if there are new tests to write or old tests to modify, thanks to my limited scrollback. I'm certainly willing to add tests, but there aren't any for the
internal/processing/federation
package yet, and I'm not entirely sure where to best look at existing tests for guidance on how to structure new tests.Let me know if this sounds good, or if there's any additional work you would like me to do.