diff --git a/categories.go b/categories.go index 38ce694..1f5a595 100644 --- a/categories.go +++ b/categories.go @@ -28,13 +28,13 @@ type Category struct { // means "default: everyone full" — for restricted categories set it // explicitly, e.g. {"staff": 3, "trust_level_0": 1}. type CreateCategoryRequest struct { - Name string `json:"name"` - Color string `json:"color"` // 6 hex digits, no '#' - TextColor string `json:"text_color"` // 6 hex digits, no '#' - Permissions map[string]int `json:"permissions,omitempty"` - Position int `json:"position,omitempty"` - ParentCategoryID int `json:"parent_category_id,omitempty"` - Description string `json:"description,omitempty"` + Name string `json:"name"` + Color string `json:"color"` // 6 hex digits, no '#' + TextColor string `json:"text_color"` // 6 hex digits, no '#' + Permissions map[string]int `json:"permissions,omitempty"` + Position int `json:"position,omitempty"` + ParentCategoryID int `json:"parent_category_id,omitempty"` + Description string `json:"description,omitempty"` } // ListCategories returns the instance's categories (one request; the diff --git a/discourse_test.go b/discourse_test.go index 303d9e4..e50fed7 100644 --- a/discourse_test.go +++ b/discourse_test.go @@ -82,15 +82,15 @@ func newFake(t *testing.T) *fakeDiscourse { } if req.Name == "denied" { // simulate a non-admin key writeJSON(w, 403, map[string]any{ - "errors": []string{"You are not permitted to view the requested resource."}, - "error_description": "Access denied", + "errors": []string{"You are not permitted to view the requested resource."}, + "error_description": "Access denied", }) return } f.mu.Lock() cat := Category{ ID: f.nextCat, Name: req.Name, - Slug: strings.ToLower(strings.ReplaceAll(req.Name, " ", "-")), + Slug: strings.ToLower(strings.ReplaceAll(req.Name, " ", "-")), Color: req.Color, TextColor: req.TextColor, Position: req.Position, } f.nextCat++ @@ -158,7 +158,7 @@ func newFake(t *testing.T) *fakeDiscourse { case http.MethodPut: var body struct { Post struct { - Raw string `json:"raw"` + Raw string `json:"raw"` EditReason string `json:"edit_reason"` } `json:"post"` } diff --git a/smoke/fakediscourse/main.go b/smoke/fakediscourse/main.go index 320cb48..3f752ef 100644 --- a/smoke/fakediscourse/main.go +++ b/smoke/fakediscourse/main.go @@ -69,7 +69,7 @@ func main() { name, _ := req["name"].(string) cat := map[string]any{ "id": s.nextCat, "name": name, - "slug": strings.ToLower(strings.ReplaceAll(name, " ", "-")), + "slug": strings.ToLower(strings.ReplaceAll(name, " ", "-")), "color": orDefault(req["color"], "3AB54A"), "text_color": orDefault(req["text_color"], "FFFFFF"), "topic_count": 0, } diff --git a/topics.go b/topics.go index f2f26f5..eb1f4ac 100644 --- a/topics.go +++ b/topics.go @@ -31,7 +31,7 @@ type Topic struct { CategoryID int `json:"category_id"` CreatedAt string `json:"created_at"` Closed bool `json:"closed"` - Archived bool `json:"archived"` + Archived bool `json:"archived"` PostStream struct { Posts []Post `json:"posts"` } `json:"post_stream"`