mirror of
1
Fork 0

[bugfix] Fix Toot CLI media attachments not working properly (#726)

This commit is contained in:
tobi 2022-07-22 13:43:51 +02:00 committed by GitHub
parent 7b72ba4ab2
commit 7ca5bac7c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -161,6 +161,10 @@ definitions:
description: |- description: |-
Array of Attachment ids to be attached as media. Array of Attachment ids to be attached as media.
If provided, status becomes optional, and poll cannot be used. If provided, status becomes optional, and poll cannot be used.
If the status is being submitted as a form, the key is 'media_ids[]',
but if it's json or xml, the key is 'media_ids'.
in: formData in: formData
items: items:
type: string type: string
@ -422,6 +426,10 @@ definitions:
description: |- description: |-
Array of Attachment ids to be attached as media. Array of Attachment ids to be attached as media.
If provided, status becomes optional, and poll cannot be used. If provided, status becomes optional, and poll cannot be used.
If the status is being submitted as a form, the key is 'media_ids[]',
but if it's json or xml, the key is 'media_ids'.
in: formData in: formData
items: items:
type: string type: string
@ -3531,6 +3539,9 @@ paths:
- description: |- - description: |-
Array of Attachment ids to be attached as media. Array of Attachment ids to be attached as media.
If provided, status becomes optional, and poll cannot be used. If provided, status becomes optional, and poll cannot be used.
If the status is being submitted as a form, the key is 'media_ids[]',
but if it's json or xml, the key is 'media_ids'.
in: formData in: formData
items: items:
type: string type: string

View File

@ -313,7 +313,7 @@ func (suite *StatusCreateTestSuite) TestAttachNewMediaSuccess() {
ctx.Request.Header.Set("accept", "application/json") ctx.Request.Header.Set("accept", "application/json")
ctx.Request.Form = url.Values{ ctx.Request.Form = url.Values{
"status": {"here's an image attachment"}, "status": {"here's an image attachment"},
"media_ids": {attachment.ID}, "media_ids[]": {attachment.ID},
} }
suite.statusModule.StatusCreatePOSTHandler(ctx) suite.statusModule.StatusCreatePOSTHandler(ctx)

View File

@ -144,8 +144,12 @@ type StatusCreateRequest struct {
Status string `form:"status" json:"status" xml:"status"` Status string `form:"status" json:"status" xml:"status"`
// Array of Attachment ids to be attached as media. // Array of Attachment ids to be attached as media.
// If provided, status becomes optional, and poll cannot be used. // If provided, status becomes optional, and poll cannot be used.
//
// If the status is being submitted as a form, the key is 'media_ids[]',
// but if it's json or xml, the key is 'media_ids'.
//
// in: formData // in: formData
MediaIDs []string `form:"media_ids" json:"media_ids" xml:"media_ids"` MediaIDs []string `form:"media_ids[]" json:"media_ids" xml:"media_ids"`
// Poll to include with this status. // Poll to include with this status.
// swagger:ignore // swagger:ignore
Poll *PollRequest `form:"poll" json:"poll" xml:"poll"` Poll *PollRequest `form:"poll" json:"poll" xml:"poll"`