[bugfix] Fix incorrect field name for status source, add helpful message (#2854)
* [bugfix] Fix incorrect field name for status source, add helpful message * swagger * yyammm
This commit is contained in:
parent
431505b3e4
commit
b7c629a18a
|
@ -2433,14 +2433,14 @@ definitions:
|
||||||
example: 01FBVD42CQ3ZEEVMW180SBX03B
|
example: 01FBVD42CQ3ZEEVMW180SBX03B
|
||||||
type: string
|
type: string
|
||||||
x-go-name: ID
|
x-go-name: ID
|
||||||
source:
|
|
||||||
description: Plain-text source of a status.
|
|
||||||
type: string
|
|
||||||
x-go-name: Text
|
|
||||||
spoiler_text:
|
spoiler_text:
|
||||||
description: Plain-text version of spoiler text.
|
description: Plain-text version of spoiler text.
|
||||||
type: string
|
type: string
|
||||||
x-go-name: SpoilerText
|
x-go-name: SpoilerText
|
||||||
|
text:
|
||||||
|
description: Plain-text source of a status.
|
||||||
|
type: string
|
||||||
|
x-go-name: Text
|
||||||
type: object
|
type: object
|
||||||
x-go-name: StatusSource
|
x-go-name: StatusSource
|
||||||
x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model
|
x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (suite *StatusSourceTestSuite) TestGetSource() {
|
||||||
|
|
||||||
suite.Equal(`{
|
suite.Equal(`{
|
||||||
"id": "01F8MHAMCHF6Y650WCRSCP4WMY",
|
"id": "01F8MHAMCHF6Y650WCRSCP4WMY",
|
||||||
"source": "hello everyone!",
|
"text": "**STATUS EDITS ARE NOT CURRENTLY SUPPORTED IN GOTOSOCIAL (coming in 2024)**\nYou can review the original text of your status below, but you will not be able to submit this edit.\n\n---\n\nhello everyone!",
|
||||||
"spoiler_text": "introduction post"
|
"spoiler_text": "introduction post"
|
||||||
}`, dst.String())
|
}`, dst.String())
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ type StatusSource struct {
|
||||||
// example: 01FBVD42CQ3ZEEVMW180SBX03B
|
// example: 01FBVD42CQ3ZEEVMW180SBX03B
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
// Plain-text source of a status.
|
// Plain-text source of a status.
|
||||||
Text string `json:"source"`
|
Text string `json:"text"`
|
||||||
// Plain-text version of spoiler text.
|
// Plain-text version of spoiler text.
|
||||||
SpoilerText string `json:"spoiler_text"`
|
SpoilerText string `json:"spoiler_text"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -796,9 +796,13 @@ func (c *Converter) StatusToWebStatus(
|
||||||
// Callers should check beforehand whether a requester has permission to view the
|
// Callers should check beforehand whether a requester has permission to view the
|
||||||
// source of the status, and ensure they're passing only a local status into this function.
|
// source of the status, and ensure they're passing only a local status into this function.
|
||||||
func (c *Converter) StatusToAPIStatusSource(ctx context.Context, s *gtsmodel.Status) (*apimodel.StatusSource, error) {
|
func (c *Converter) StatusToAPIStatusSource(ctx context.Context, s *gtsmodel.Status) (*apimodel.StatusSource, error) {
|
||||||
|
// TODO: remove this when edit support is added.
|
||||||
|
text := "**STATUS EDITS ARE NOT CURRENTLY SUPPORTED IN GOTOSOCIAL (coming in 2024)**\n" +
|
||||||
|
"You can review the original text of your status below, but you will not be able to submit this edit.\n\n---\n\n" + s.Text
|
||||||
|
|
||||||
return &apimodel.StatusSource{
|
return &apimodel.StatusSource{
|
||||||
ID: s.ID,
|
ID: s.ID,
|
||||||
Text: s.Text,
|
Text: text,
|
||||||
SpoilerText: s.ContentWarning,
|
SpoilerText: s.ContentWarning,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue