[bugfix] Use ptr for instance stats entries to avoid skipping 0 values (#2666)

* [bugfix] Use ptr for instance stats entries to avoid skipping 0 values

* comment explaining why stats values are pointers
This commit is contained in:
tobi
2024-02-19 13:17:14 +01:00
committed by GitHub
parent 0554550acb
commit d10226e912
3 changed files with 10 additions and 8 deletions

View File

@@ -74,7 +74,9 @@ type InstanceV1 struct {
// URLs of interest for client applications.
URLs InstanceV1URLs `json:"urls,omitempty"`
// Statistics about the instance: number of posts, accounts, etc.
Stats map[string]int `json:"stats,omitempty"`
// Values are pointers because we don't want to skip 0 values when
// rendering stats via web templates.
Stats map[string]*int `json:"stats,omitempty"`
// URL of the instance avatar/banner image.
// example: https://example.org/files/instance/thumbnail.jpeg
Thumbnail string `json:"thumbnail"`