Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Fix set activity to private, thank you Fabio Moser
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmach committed Oct 3, 2014
1 parent 0a1080f commit 12ed1cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion activities.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,13 @@ func (c *ActivitiesPutCall) Type(activityType ActivityType) *ActivitiesPutCall {
}

func (c *ActivitiesPutCall) Private(isPrivate bool) *ActivitiesPutCall {
c.ops["private"] = isPrivate
// must be 0 or 1, or strava will set to public.
if isPrivate {
c.ops["private"] = 1
} else {
c.ops["private"] = 0
}

return c
}

Expand Down
9 changes: 8 additions & 1 deletion activities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,14 @@ func TestActivitiesUpdate(t *testing.T) {
// parameters3
s.Update(123).Private(false).Commute(true).Trainer(false).Do()

if transport.request.URL.RawQuery != "commute=true&private=false&trainer=false" {
if transport.request.URL.RawQuery != "commute=true&private=0&trainer=false" {
t.Errorf("request query incorrect, got %v", transport.request.URL.RawQuery)
}

// parameters4
s.Update(123).Private(true).Do()

if transport.request.URL.RawQuery != "private=1" {
t.Errorf("request query incorrect, got %v", transport.request.URL.RawQuery)
}
}
Expand Down

0 comments on commit 12ed1cf

Please sign in to comment.