mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-06 07:08:07 -06:00
[bugfix] Use "comment" via /api/v1/instance
This commit is contained in:
parent
e856d09f8e
commit
3409e6414c
8 changed files with 59 additions and 13 deletions
|
|
@ -113,6 +113,27 @@ nothanks.com,suspend,false,false,,false
|
||||||
|
|
||||||
JSON lists use content type `application/json`.
|
JSON lists use content type `application/json`.
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"domain": "bumfaces.net",
|
||||||
|
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||||
|
"comment": "big jerks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"domain": "peepee.poopoo",
|
||||||
|
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||||
|
"comment": "harassment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"domain": "nothanks.com",
|
||||||
|
"suspended_at": "2020-05-13T13:29:12.000Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
As an alternative to `"comment"`, `"public_comment"` will also work:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1099,13 +1099,22 @@ definitions:
|
||||||
domain:
|
domain:
|
||||||
description: Domain represents a remote domain
|
description: Domain represents a remote domain
|
||||||
properties:
|
properties:
|
||||||
|
comment:
|
||||||
|
description: |-
|
||||||
|
If the domain is blocked, what's the publicly-stated reason for the block.
|
||||||
|
Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance.
|
||||||
|
example: they smell
|
||||||
|
type: string
|
||||||
|
x-go-name: Comment
|
||||||
domain:
|
domain:
|
||||||
description: The hostname of the domain.
|
description: The hostname of the domain.
|
||||||
example: example.org
|
example: example.org
|
||||||
type: string
|
type: string
|
||||||
x-go-name: Domain
|
x-go-name: Domain
|
||||||
public_comment:
|
public_comment:
|
||||||
description: If the domain is blocked, what's the publicly-stated reason for the block.
|
description: |-
|
||||||
|
If the domain is blocked, what's the publicly-stated reason for the block.
|
||||||
|
Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance.
|
||||||
example: they smell
|
example: they smell
|
||||||
type: string
|
type: string
|
||||||
x-go-name: PublicComment
|
x-go-name: PublicComment
|
||||||
|
|
@ -1124,6 +1133,13 @@ definitions:
|
||||||
x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model
|
x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model
|
||||||
domainPermission:
|
domainPermission:
|
||||||
properties:
|
properties:
|
||||||
|
comment:
|
||||||
|
description: |-
|
||||||
|
If the domain is blocked, what's the publicly-stated reason for the block.
|
||||||
|
Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance.
|
||||||
|
example: they smell
|
||||||
|
type: string
|
||||||
|
x-go-name: Comment
|
||||||
created_at:
|
created_at:
|
||||||
description: Time at which the permission entry was created (ISO 8601 Datetime).
|
description: Time at which the permission entry was created (ISO 8601 Datetime).
|
||||||
example: "2021-07-30T09:20:25+00:00"
|
example: "2021-07-30T09:20:25+00:00"
|
||||||
|
|
@ -1162,7 +1178,9 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
x-go-name: PrivateComment
|
x-go-name: PrivateComment
|
||||||
public_comment:
|
public_comment:
|
||||||
description: If the domain is blocked, what's the publicly-stated reason for the block.
|
description: |-
|
||||||
|
If the domain is blocked, what's the publicly-stated reason for the block.
|
||||||
|
Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance.
|
||||||
example: they smell
|
example: they smell
|
||||||
type: string
|
type: string
|
||||||
x-go-name: PublicComment
|
x-go-name: PublicComment
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetOnlySuspended() {
|
||||||
{
|
{
|
||||||
"domain": "replyguys.com",
|
"domain": "replyguys.com",
|
||||||
"suspended_at": "2020-05-13T13:29:12.000Z",
|
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||||
"public_comment": "reply-guying to tech posts"
|
"comment": "reply-guying to tech posts"
|
||||||
}
|
}
|
||||||
]`, dst.String())
|
]`, dst.String())
|
||||||
}
|
}
|
||||||
|
|
@ -186,7 +186,7 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetOnlySuspendedAuthori
|
||||||
{
|
{
|
||||||
"domain": "replyguys.com",
|
"domain": "replyguys.com",
|
||||||
"suspended_at": "2020-05-13T13:29:12.000Z",
|
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||||
"public_comment": "reply-guying to tech posts"
|
"comment": "reply-guying to tech posts"
|
||||||
}
|
}
|
||||||
]`, dst.String())
|
]`, dst.String())
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetAll() {
|
||||||
{
|
{
|
||||||
"domain": "replyguys.com",
|
"domain": "replyguys.com",
|
||||||
"suspended_at": "2020-05-13T13:29:12.000Z",
|
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||||
"public_comment": "reply-guying to tech posts"
|
"comment": "reply-guying to tech posts"
|
||||||
}
|
}
|
||||||
]`, dst.String())
|
]`, dst.String())
|
||||||
}
|
}
|
||||||
|
|
@ -263,12 +263,12 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetAllWithObfuscated()
|
||||||
{
|
{
|
||||||
"domain": "o*g.*u**.t**.*or*t.*r**ev**",
|
"domain": "o*g.*u**.t**.*or*t.*r**ev**",
|
||||||
"suspended_at": "2021-06-09T10:34:55.000Z",
|
"suspended_at": "2021-06-09T10:34:55.000Z",
|
||||||
"public_comment": "just absolutely the worst, wowza"
|
"comment": "just absolutely the worst, wowza"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"domain": "replyguys.com",
|
"domain": "replyguys.com",
|
||||||
"suspended_at": "2020-05-13T13:29:12.000Z",
|
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||||
"public_comment": "reply-guying to tech posts"
|
"comment": "reply-guying to tech posts"
|
||||||
}
|
}
|
||||||
]`, dst.String())
|
]`, dst.String())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ type Domain struct {
|
||||||
// example: 2021-07-30T09:20:25+00:00
|
// example: 2021-07-30T09:20:25+00:00
|
||||||
SilencedAt string `json:"silenced_at,omitempty"`
|
SilencedAt string `json:"silenced_at,omitempty"`
|
||||||
// If the domain is blocked, what's the publicly-stated reason for the block.
|
// If the domain is blocked, what's the publicly-stated reason for the block.
|
||||||
|
// Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance.
|
||||||
|
// example: they smell
|
||||||
|
Comment *string `form:"comment" json:"comment,omitempty"`
|
||||||
|
// If the domain is blocked, what's the publicly-stated reason for the block.
|
||||||
|
// Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance.
|
||||||
// example: they smell
|
// example: they smell
|
||||||
PublicComment *string `form:"public_comment" json:"public_comment,omitempty"`
|
PublicComment *string `form:"public_comment" json:"public_comment,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cmp"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
@ -239,7 +240,7 @@ func (p *Processor) importOrUpdateDomainPerm(
|
||||||
var (
|
var (
|
||||||
domain = apiDomainPerm.Domain.Domain
|
domain = apiDomainPerm.Domain.Domain
|
||||||
obfuscate = apiDomainPerm.Obfuscate
|
obfuscate = apiDomainPerm.Obfuscate
|
||||||
publicComment = apiDomainPerm.PublicComment
|
publicComment = cmp.Or(apiDomainPerm.PublicComment, apiDomainPerm.Comment)
|
||||||
privateComment = apiDomainPerm.PrivateComment
|
privateComment = apiDomainPerm.PrivateComment
|
||||||
subscriptionID = "" // No sub ID for imports.
|
subscriptionID = "" // No sub ID for imports.
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ func (p *Processor) InstancePeersGet(ctx context.Context, includeSuspended bool,
|
||||||
domains = append(domains, &apimodel.Domain{
|
domains = append(domains, &apimodel.Domain{
|
||||||
Domain: d,
|
Domain: d,
|
||||||
SuspendedAt: util.FormatISO8601(domainBlock.CreatedAt),
|
SuspendedAt: util.FormatISO8601(domainBlock.CreatedAt),
|
||||||
PublicComment: &domainBlock.PublicComment,
|
Comment: &domainBlock.PublicComment,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -742,7 +742,8 @@ func permsFromJSON(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set remaining fields.
|
// Set remaining fields.
|
||||||
perm.SetPublicComment(util.PtrOrZero(apiPerm.PublicComment))
|
publicComment := cmp.Or(apiPerm.PublicComment, apiPerm.Comment)
|
||||||
|
perm.SetPublicComment(util.PtrOrZero(publicComment))
|
||||||
perm.SetObfuscate(util.Ptr(util.PtrOrZero(apiPerm.Obfuscate)))
|
perm.SetObfuscate(util.Ptr(util.PtrOrZero(apiPerm.Obfuscate)))
|
||||||
|
|
||||||
// We're done.
|
// We're done.
|
||||||
|
|
|
||||||
|
|
@ -627,7 +627,7 @@ nothanks.com`
|
||||||
{
|
{
|
||||||
"domain": "bumfaces.net",
|
"domain": "bumfaces.net",
|
||||||
"suspended_at": "2020-05-13T13:29:12.000Z",
|
"suspended_at": "2020-05-13T13:29:12.000Z",
|
||||||
"public_comment": "big jerks"
|
"comment": "big jerks"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"domain": "peepee.poopoo",
|
"domain": "peepee.poopoo",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue