add support for language
This commit is contained in:
parent
be61205708
commit
5f0c9a21c2
|
@ -230,6 +230,7 @@ type Toot struct {
|
|||
Sensitive bool `json:"sensitive"`
|
||||
SpoilerText string `json:"spoiler_text"`
|
||||
Visibility string `json:"visibility"`
|
||||
Language string `json:"language"`
|
||||
ScheduledAt *time.Time `json:"scheduled_at,omitempty"`
|
||||
Poll *TootPoll `json:"poll"`
|
||||
}
|
||||
|
|
|
@ -252,6 +252,9 @@ func TestPostStatusParams(t *testing.T) {
|
|||
if r.FormValue("visibility") != "" {
|
||||
s.Visibility = (r.FormValue("visibility"))
|
||||
}
|
||||
if r.FormValue("language") != "" {
|
||||
s.Language = (r.FormValue("language"))
|
||||
}
|
||||
if r.FormValue("sensitive") == "true" {
|
||||
s.Sensitive = true
|
||||
s.SpoilerText = fmt.Sprintf("<p>%s</p>", r.FormValue("spoiler_text"))
|
||||
|
@ -288,6 +291,7 @@ func TestPostStatusParams(t *testing.T) {
|
|||
Status: "foobar",
|
||||
InReplyToID: ID("2"),
|
||||
Visibility: "unlisted",
|
||||
Language: "sv",
|
||||
Sensitive: true,
|
||||
SpoilerText: "bar",
|
||||
MediaIDs: []ID{"1", "2"},
|
||||
|
@ -310,6 +314,9 @@ func TestPostStatusParams(t *testing.T) {
|
|||
if s.Visibility != "unlisted" {
|
||||
t.Fatalf("want %q but %q", "unlisted", s.Visibility)
|
||||
}
|
||||
if s.Language != "sv" {
|
||||
t.Fatalf("want %q but %q", "sv", s.Language)
|
||||
}
|
||||
if s.Sensitive != true {
|
||||
t.Fatalf("want %t but %t", true, s.Sensitive)
|
||||
}
|
||||
|
|
|
@ -365,6 +365,9 @@ func (c *Client) PostStatus(ctx context.Context, toot *Toot) (*Status, error) {
|
|||
if toot.Visibility != "" {
|
||||
params.Set("visibility", fmt.Sprint(toot.Visibility))
|
||||
}
|
||||
if toot.Language != "" {
|
||||
params.Set("language", fmt.Sprint(toot.Language))
|
||||
}
|
||||
if toot.Sensitive {
|
||||
params.Set("sensitive", "true")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user