[chore] Deprecate with_approval, always (client API), approvalRequired, always (fedi API) (#4173)

This pull request deprecates `with_approval` and `always` on the client API side, and `approvalRequired` and `always` on the fedi API side, replacing them with `automatic_approval` and `manual_approval` and `automaticApproval` and `manualApproval`, respectively.

Back-compat is kept with these deprecated fields, and they're still serialized to the client API and fedi APIs respectively, in addition to the new non-deprecated properties.

This will stay the case until v0.21.0 when they'll be removed.

For the sake of not doing a massive database migration, the fields are still named `Always` and `WithApproval` in storage. I think this is probably fine!

Part of https://codeberg.org/superseriousbusiness/gotosocial/issues/4026
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4173
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
tobi
2025-05-13 14:48:11 +00:00
committed by kim
parent 5925644ad3
commit ca12742a7a
28 changed files with 1214 additions and 248 deletions

View File

@ -2214,13 +2214,29 @@ definitions:
interactionPolicyRules: interactionPolicyRules:
properties: properties:
always: always:
description: Policy entries for accounts that can always do this type of interaction. description: |-
Policy entries for accounts that can always do this type of interaction.
Deprecated: Use "automatic_approval" instead.
items: items:
$ref: '#/definitions/interactionPolicyValue' $ref: '#/definitions/interactionPolicyValue'
type: array type: array
x-go-name: Always x-go-name: Always
automatic_approval:
description: Policy entries for accounts that will receive automatic approval for this type of interaction.
items:
$ref: '#/definitions/interactionPolicyValue'
type: array
x-go-name: AutomaticApproval
manual_approval:
description: Policy entries for accounts that require manual approval for this type of interaction.
items:
$ref: '#/definitions/interactionPolicyValue'
type: array
x-go-name: ManualApproval
with_approval: with_approval:
description: Policy entries for accounts that require approval to do this type of interaction. description: |-
Policy entries for accounts that require approval to do this type of interaction.
Deprecated: Use "manual_approval" instead.
items: items:
$ref: '#/definitions/interactionPolicyValue' $ref: '#/definitions/interactionPolicyValue'
type: array type: array

View File

@ -1,5 +1,8 @@
# Interaction Policy # Interaction Policy
!!! warning "Feature still in development"
Much like GoToSocial, this feature is still in pre-v1 beta development. Naming or schemas or methods of approval / rejection may change. We aim to finalize the document by GoToSocial v0.21.0, at which point it can be considered "ready" for other ActivityPub implementers to use.
GoToSocial uses the property `interactionPolicy` on posts, in order to indicate to remote instances what sort of interactions are (conditionally) permitted to be processed and stored by the origin server, for any given post. GoToSocial uses the property `interactionPolicy` on posts, in order to indicate to remote instances what sort of interactions are (conditionally) permitted to be processed and stored by the origin server, for any given post.
The `@context` document for `interactionPolicy` and related objects and properties is at `https://gotosocial.org/ns`. The `@context` document for `interactionPolicy` and related objects and properties is at `https://gotosocial.org/ns`.
@ -15,6 +18,9 @@ The `@context` document for `interactionPolicy` and related objects and properti
For better or worse, GoToSocial can offer only a best-effort, partial, technological solution to what is more or less an issue of social behavior and boundaries. For better or worse, GoToSocial can offer only a best-effort, partial, technological solution to what is more or less an issue of social behavior and boundaries.
!!! info "Deprecated `always` and `approvalRequired` properties"
Previous versions of this document used the properties `always` and `approvalRequired`. These are now deprecated in favor of `automaticApproval` and `manualApproval`. GoToSocial versions before v0.20.0 send and receive only these deprecated properties. GoToSocial v0.20.0 sends and receives both the deprecated and the new properties. GoToSocial v0.21.0 onwards uses only the new properties.
## Overview ## Overview
`interactionPolicy` is an object property attached to the post-like `Object`s `Note`, `Article`, `Question`, etc, with the following format: `interactionPolicy` is an object property attached to the post-like `Object`s `Note`, `Article`, `Question`, etc, with the following format:
@ -28,16 +34,16 @@ The `@context` document for `interactionPolicy` and related objects and properti
[...], [...],
"interactionPolicy": { "interactionPolicy": {
"canLike": { "canLike": {
"always": [ "zero_or_more_uris_that_can_always_do_this" ], "automaticApproval": [ "zero_or_more_uris_that_can_always_do_this" ],
"approvalRequired": [ "zero_or_more_uris_that_require_approval_to_do_this" ] "manualApproval": [ "zero_or_more_uris_that_require_approval_to_do_this" ]
}, },
"canReply": { "canReply": {
"always": [ "zero_or_more_uris_that_can_always_do_this" ], "automaticApproval": [ "zero_or_more_uris_that_can_always_do_this" ],
"approvalRequired": [ "zero_or_more_uris_that_require_approval_to_do_this" ] "manualApproval": [ "zero_or_more_uris_that_require_approval_to_do_this" ]
}, },
"canAnnounce": { "canAnnounce": {
"always": [ "zero_or_more_uris_that_can_always_do_this" ], "automaticApproval": [ "zero_or_more_uris_that_can_always_do_this" ],
"approvalRequired": [ "zero_or_more_uris_that_require_approval_to_do_this" ] "manualApproval": [ "zero_or_more_uris_that_require_approval_to_do_this" ]
} }
}, },
[...] [...]
@ -52,10 +58,10 @@ In the `interactionPolicy` object:
And: And:
- `always` denotes ActivityPub URIs/IDs of `Actor`s or `Collection`s of `Actor`s who are permitted to create + distribute an interaction targeting a post without requiring manual approval by the post author. - `automaticApproval` denotes ActivityPub URIs/IDs of `Actor`s or `Collection`s of `Actor`s who will receive automated approval from the post author to create + distribute an interaction targeting a post.
- `approvalRequired` denotes ActivityPub URIs/IDs of `Actor`s or `Collection`s of `Actor`s who are permitted to create an interaction targeting a post, but should wait for manual approval by the post author before distributing it (see [Requesting, Obtaining, and Validating Approval](#requesting-obtaining-and-validating-approval)). - `manualApproval` denotes ActivityPub URIs/IDs of `Actor`s or `Collection`s of `Actor`s who will receive approval from the post author at the author's own discretion, and may not receive approval at all, or may be rejected (see [Requesting, Obtaining, and Validating Approval](#requesting-obtaining-and-validating-approval)).
Valid URI entries in `always` and `approvalRequired` include: Valid URI entries in `automaticApproval` and `manualApproval` include:
- the magic ActivityStreams Public URI `https://www.w3.org/ns/activitystreams#Public` - the magic ActivityStreams Public URI `https://www.w3.org/ns/activitystreams#Public`
- the URIs of the post creator's `Following` and/or `Followers` collections - the URIs of the post creator's `Following` and/or `Followers` collections
@ -74,21 +80,21 @@ For example:
``` ```
!!! info !!! info
Be aware that according to JSON-LD the values of `always` and `approvalRequired` can be either single strings or arrays of strings. That is, the following are all valid: Be aware that according to JSON-LD the values of `automaticApproval` and `manualApproval` can be either single strings or arrays of strings. That is, the following are all valid:
- Single string: `"always": "https://example.org/users/someone"` - Single string: `"automaticApproval": "https://example.org/users/someone"`
- Single-entry array: `"always": [ "https://example.org/users/someone" ]` - Single-entry array: `"automaticApproval": [ "https://example.org/users/someone" ]`
- Multiple-entry array: `"always": [ "https://example.org/users/someone", "https://example.org/users/someone_else" ]` - Multiple-entry array: `"automaticApproval": [ "https://example.org/users/someone", "https://example.org/users/someone_else" ]`
## Specifying Nobody ## Specifying Nobody
To specify that **nobody** can perform an interaction on a post **except** for its author (who is always permitted), implementations should set the `always` array to **just the URI of the post author**, and `approvalRequired` can be unset, `null`, or empty. To specify that **nobody** can perform an interaction on a post **except** for its author (who is always permitted), implementations should set the `automaticApproval` array to **just the URI of the post author**, and `manualApproval` can be unset, `null`, or empty.
For example, the following `canLike` value indicates that nobody can `Like` the post it is attached to except for the post author: For example, the following `canLike` value indicates that nobody can `Like` the post it is attached to except for the post author:
```json ```json
"canLike": { "canLike": {
"always": "the_activitypub_uri_of_the_post_author" "automaticApproval": "the_activitypub_uri_of_the_post_author"
}, },
``` ```
@ -103,13 +109,13 @@ Another example. The following `interactionPolicy` on a post by `https://example
[...], [...],
"interactionPolicy": { "interactionPolicy": {
"canLike": { "canLike": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canReply": { "canReply": {
"always": "https://example.org/users/someone" "automaticApproval": "https://example.org/users/someone"
}, },
"canAnnounce": { "canAnnounce": {
"always": "https://example.org/users/someone" "automaticApproval": "https://example.org/users/someone"
} }
}, },
[...] [...]
@ -128,28 +134,28 @@ For example:
```json ```json
[...], [...],
"canReply": { "canReply": {
"always": "https://example.org/users/someone", "automaticApproval": "https://example.org/users/someone",
"approvalRequired": "https://www.w3.org/ns/activitystreams#Public" "manualApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
[...] [...]
``` ```
Here, `@someone@example.org` is present in `always`, and is also implicitly present in the magic ActivityStreams Public collection in `approvalRequired`. In this case, they can always reply, as the `always` value is more explicit. Here, `@someone@example.org` is present in `automaticApproval`, and is also implicitly present in the magic ActivityStreams Public collection in `manualApproval`. In this case, they can always reply, as the `automaticApproval` value is more explicit.
Another example: Another example:
```json ```json
[...], [...],
"canReply": { "canReply": {
"always": "https://www.w3.org/ns/activitystreams#Public", "automaticApproval": "https://www.w3.org/ns/activitystreams#Public",
"approvalRequired": "https://example.org/users/someone" "manualApproval": "https://example.org/users/someone"
}, },
[...] [...]
``` ```
Here, `@someone@example.org` is present in `approvalRequired`, but is also implicitly present in the magic ActivityStreams Public collection in `always`. In this case everyone can reply without approval, **except** for `@someone@example.org`, who requires approval. Here, `@someone@example.org` is present in `manualApproval`, but is also implicitly present in the magic ActivityStreams Public collection in `automaticApproval`. In this case everyone can reply without approval, **except** for `@someone@example.org`, who requires approval.
In case the **exact same** URI is present in both `always` and `approvalRequired`, the **highest level of permission** takes precedence (ie., a URI in `always` takes precedence over the same URI in `approvalRequired`). In case the **exact same** URI is present in both `automaticApproval` and `manualApproval`, the **highest level of permission** takes precedence (ie., a URI in `automaticApproval` takes precedence over the same URI in `manualApproval`).
## Default / fallback `interactionPolicy` ## Default / fallback `interactionPolicy`
@ -164,20 +170,20 @@ When the `interactionPolicy` property is not present at all on a post, or the `i
[...], [...],
"interactionPolicy": { "interactionPolicy": {
"canLike": { "canLike": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canReply": { "canReply": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canAnnounce": { "canAnnounce": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
} }
}, },
[...] [...]
} }
``` ```
As implied by the lack of any `approvalRequired` property in any of the sub-policies, the default value for `approvalRequired` is an empty array. As implied by the lack of any `manualApproval` property in any of the sub-policies, the default value for `manualApproval` is an empty array.
This default `interactionPolicy` was designed to reflect the de facto interaction policy of all posts from pre-v0.17.0 GoToSocial, and other ActivityPub server softwares, at the time of writing. That is to say, it is exactly what servers that are not interaction policy aware *already assume* about interaction permissions. This default `interactionPolicy` was designed to reflect the de facto interaction policy of all posts from pre-v0.17.0 GoToSocial, and other ActivityPub server softwares, at the time of writing. That is to say, it is exactly what servers that are not interaction policy aware *already assume* about interaction permissions.
@ -200,7 +206,7 @@ If `canLike` is missing on an `interactionPolicy`, or the value of `canLike` is
```json ```json
"canLike": { "canLike": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
} }
``` ```
@ -212,7 +218,7 @@ If `canReply` is missing on an `interactionPolicy`, or the value of `canReply` i
```json ```json
"canReply": { "canReply": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
} }
``` ```
@ -224,7 +230,7 @@ If `canAnnounce` is missing on an `interactionPolicy`, or the value of `canAnnou
```json ```json
"canAnnounce": { "canAnnounce": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
} }
``` ```
@ -266,7 +272,7 @@ Likewise, when enforcing received interaction policies, GoToSocial will **ALWAYS
As such, when sending out interaction policies, GoToSocial will **ALWAYS** add the URI of the post author to the `canLike.always`, `canReply.always`, and `canAnnounce.always` arrays, **UNLESS** they are already covered by the ActivityStreams magic public URI. As such, when sending out interaction policies, GoToSocial will **ALWAYS** add the URI of the post author to the `canLike.always`, `canReply.always`, and `canAnnounce.always` arrays, **UNLESS** they are already covered by the ActivityStreams magic public URI.
Likewise, when enforcing received interaction policies, GoToSocial will **ALWAYS** behave as though the URI of the post author themself is present in each `always` field, even if it wasn't. Likewise, when enforcing received interaction policies, GoToSocial will **ALWAYS** behave as though the URI of the post author themself is present in each `automaticApproval` field, even if it wasn't.
## Examples ## Examples
@ -293,18 +299,18 @@ This can be achieved with the following `interactionPolicy`, which is attached t
[...], [...],
"interactionPolicy": { "interactionPolicy": {
"canLike": { "canLike": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canReply": { "canReply": {
"always": [ "automaticApproval": [
"https://example.org/users/the_mighty_zork", "https://example.org/users/the_mighty_zork",
"https://example.org/users/booblover6969", "https://example.org/users/booblover6969",
"https://example.org/users/hodor" "https://example.org/users/hodor"
], ],
"approvalRequired": "https://www.w3.org/ns/activitystreams#Public" "manualApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canAnnounce": { "canAnnounce": {
"always": [ "automaticApproval": [
"https://example.org/users/the_mighty_zork", "https://example.org/users/the_mighty_zork",
"https://example.org/users/the_mighty_zork/followers", "https://example.org/users/the_mighty_zork/followers",
"https://example.org/users/booblover6969", "https://example.org/users/booblover6969",
@ -333,13 +339,13 @@ This can be achieved by setting the following `interactionPolicy` on every post
[...], [...],
"interactionPolicy": { "interactionPolicy": {
"canLike": { "canLike": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canReply": { "canReply": {
"always": "https://example.org/users/the_mighty_zork" "automaticApproval": "https://example.org/users/the_mighty_zork"
}, },
"canAnnounce": { "canAnnounce": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
} }
}, },
[...] [...]
@ -361,13 +367,13 @@ In this example, `@the_mighty_zork` wants to write a completely open post that c
[...], [...],
"interactionPolicy": { "interactionPolicy": {
"canLike": { "canLike": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canReply": { "canReply": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
}, },
"canAnnounce": { "canAnnounce": {
"always": "https://www.w3.org/ns/activitystreams#Public" "automaticApproval": "https://www.w3.org/ns/activitystreams#Public"
} }
}, },
[...] [...]
@ -416,7 +422,7 @@ This section describes the enforcement and verification of interaction policies,
### Requesting, Obtaining, and Validating Approval ### Requesting, Obtaining, and Validating Approval
When an actor's URI is in the `approvalRequired` array for a type of interaction, **or** their presence in a collection needs to be validated (see [Validating presence in a Followers / Following collection](#validating-presence-in-a-followers--following-collection)), implementations wishing to obtain approval for that actor to interact with a policied post should do the following: When an actor's URI is in the `manualApproval` array for a type of interaction, **or** their presence in a collection needs to be validated (see [Validating presence in a Followers / Following collection](#validating-presence-in-a-followers--following-collection)), implementations wishing to obtain approval for that actor to interact with a policied post should do the following:
1. Compose the interaction `Activity` (ie., `Like`, `Create` (reply), or `Announce`), as normal. 1. Compose the interaction `Activity` (ie., `Like`, `Create` (reply), or `Announce`), as normal.
2. Address the `Activity` `to` and `cc` the expected recipients for that `Activity`, as normal. 2. Address the `Activity` `to` and `cc` the expected recipients for that `Activity`, as normal.
@ -592,11 +598,11 @@ If the approval cannot be dereferenced, or does not pass validity checks, the in
### Validating presence in a Followers / Following collection ### Validating presence in a Followers / Following collection
If an `Actor` interacting with an `object` (via `Like`, `inReplyTo`, or `Announce`) is permitted to do that interaction based on their presence in a `Followers` or `Following` collection in the `always` field of an interaction policy, then their server **should still wait** for an `Accept` to be received from the server of the target actor, before distributing the interaction more widely with the `approvedBy` property set to the URI/ID of the approval. If an `Actor` interacting with an `object` (via `Like`, `inReplyTo`, or `Announce`) is permitted to do that interaction based on their presence in a `Followers` or `Following` collection in the `automaticApproval` field of an interaction policy, then their server **should still wait** for an `Accept` to be received from the server of the target actor, before distributing the interaction more widely with the `approvedBy` property set to the URI/ID of the approval.
This is to prevent scenarios where third servers have to somehow verify the presence of the interacting `Actor` in the `Followers` or `Following` collection of the `Actor` being interacted with. It is simpler to allow the target server to do that verification, and to trust that their approval implicitly agrees that the interacting `Actor` is present in the relevant collection. This is to prevent scenarios where third servers have to somehow verify the presence of the interacting `Actor` in the `Followers` or `Following` collection of the `Actor` being interacted with. It is simpler to allow the target server to do that verification, and to trust that their approval implicitly agrees that the interacting `Actor` is present in the relevant collection.
Likewise, when receiving an interaction from an `Actor` whose permission to interact matches with one of the `Following` or `Followers` collections in the `always` property, the server of the interacted-with `Actor` should ensure that they *always* send out an `Accept` as soon as possible, so that the interacting `Actor` server can send out the `Activity` with the proper proof of acceptance. Likewise, when receiving an interaction from an `Actor` whose permission to interact matches with one of the `Following` or `Followers` collections in the `automaticApproval` property, the server of the interacted-with `Actor` should ensure that they *always* send out an `Accept` as soon as possible, so that the interacting `Actor` server can send out the `Activity` with the proper proof of acceptance.
This process should bypass the normal "pending approval" stage whereby the server of the `Actor` being interacted with notifies them of the pending interaction, and waits for them to accept or reject, since there is no point notifying an `Actor` of a pending approval that they have already explicitly agreed to. In the GoToSocial codebase in particular, this is called "preapproval". This process should bypass the normal "pending approval" stage whereby the server of the `Actor` being interacted with notifies them of the pending interaction, and waits for them to accept or reject, since there is no point notifying an `Actor` of a pending approval that they have already explicitly agreed to. In the GoToSocial codebase in particular, this is called "preapproval".
@ -606,7 +612,7 @@ This section describes optional behaviors that implementers *may* use when sendi
#### Always send out `Accept`s #### Always send out `Accept`s
Implementers may wish to *always* send out an `Accept` to remote interacters, even when the interaction is implicitly or explicitly permitted by their presence in the `always` array. When receiving such an `Accept`, implementations may still want to update their representation of the interaction to include an `approvedBy` URI pointing at an approval. This may be useful later on when handling revocations (TODO). Implementers may wish to *always* send out an `Accept` to remote interacters, even when the interaction is implicitly or explicitly permitted by their presence in the `automaticApproval` array. When receiving such an `Accept`, implementations may still want to update their representation of the interaction to include an `approvedBy` URI pointing at an approval. This may be useful later on when handling revocations (TODO).
#### Type hinting: inline `object` property on `Accept` and `Reject` #### Type hinting: inline `object` property on `Accept` and `Reject`

View File

@ -1173,15 +1173,7 @@ func extractCanLike(
return gtsmodel.PolicyRules{} return gtsmodel.PolicyRules{}
} }
withRules := propIter.Get() return extractPolicyRules(propIter.Get(), owner)
if withRules == nil {
return gtsmodel.PolicyRules{}
}
return gtsmodel.PolicyRules{
Always: extractPolicyValues(withRules.GetGoToSocialAlways(), owner),
WithApproval: extractPolicyValues(withRules.GetGoToSocialApprovalRequired(), owner),
}
} }
func extractCanReply( func extractCanReply(
@ -1197,15 +1189,7 @@ func extractCanReply(
return gtsmodel.PolicyRules{} return gtsmodel.PolicyRules{}
} }
withRules := propIter.Get() return extractPolicyRules(propIter.Get(), owner)
if withRules == nil {
return gtsmodel.PolicyRules{}
}
return gtsmodel.PolicyRules{
Always: extractPolicyValues(withRules.GetGoToSocialAlways(), owner),
WithApproval: extractPolicyValues(withRules.GetGoToSocialApprovalRequired(), owner),
}
} }
func extractCanAnnounce( func extractCanAnnounce(
@ -1226,9 +1210,39 @@ func extractCanAnnounce(
return gtsmodel.PolicyRules{} return gtsmodel.PolicyRules{}
} }
return extractPolicyRules(propIter.Get(), owner)
}
func extractPolicyRules(
withRules WithPolicyRules,
owner *gtsmodel.Account,
) gtsmodel.PolicyRules {
if withRules == nil {
return gtsmodel.PolicyRules{}
}
// Check for `automaticApproval` and
// `manualApproval` properties first.
var (
automaticApproval = withRules.GetGoToSocialAutomaticApproval()
manualApproval = withRules.GetGoToSocialManualApproval()
)
if (automaticApproval != nil && automaticApproval.Len() != 0) ||
(manualApproval != nil && manualApproval.Len() != 0) {
// At least one is set, use these props.
return gtsmodel.PolicyRules{
AutomaticApproval: extractPolicyValues(automaticApproval, owner),
ManualApproval: extractPolicyValues(manualApproval, owner),
}
}
// Fall back to deprecated `always`
// and `withApproval` properties.
//
// TODO: Remove this in GtS v0.21.0.
return gtsmodel.PolicyRules{ return gtsmodel.PolicyRules{
Always: extractPolicyValues(withRules.GetGoToSocialAlways(), owner), AutomaticApproval: extractPolicyValues(withRules.GetGoToSocialAlways(), owner),
WithApproval: extractPolicyValues(withRules.GetGoToSocialApprovalRequired(), owner), ManualApproval: extractPolicyValues(withRules.GetGoToSocialApprovalRequired(), owner),
} }
} }

View File

@ -43,6 +43,106 @@ func (suite *ExtractPolicyTestSuite) TestExtractPolicy() {
"en": "hey @f0x and @dumpsterqueer", "en": "hey @f0x and @dumpsterqueer",
"fr": "bonjour @f0x et @dumpsterqueer" "fr": "bonjour @f0x et @dumpsterqueer"
}, },
"interactionPolicy": {
"canLike": {
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
},
"canReply": {
"automaticApproval": [
"http://localhost:8080/users/the_mighty_zork",
"http://localhost:8080/users/the_mighty_zork/followers",
"https://gts.superseriousbusiness.org/users/dumpsterqueer",
"https://gts.superseriousbusiness.org/users/f0x"
],
"manualApproval": [
"https://www.w3.org/ns/activitystreams#Public"
]
},
"canAnnounce": {
"automaticApproval": [
"http://localhost:8080/users/the_mighty_zork"
],
"manualApproval": [
"https://www.w3.org/ns/activitystreams#Public"
]
}
},
"tag": [
{
"href": "https://gts.superseriousbusiness.org/users/dumpsterqueer",
"name": "@dumpsterqueer@superseriousbusiness.org",
"type": "Mention"
},
{
"href": "https://gts.superseriousbusiness.org/users/f0x",
"name": "@f0x@superseriousbusiness.org",
"type": "Mention"
}
],
"type": "Note"
}`
statusable, err := ap.ResolveStatusable(
context.Background(),
io.NopCloser(
bytes.NewBufferString(rawNote),
),
)
if err != nil {
suite.FailNow(err.Error())
}
policy := ap.ExtractInteractionPolicy(
statusable,
// Zork didn't actually create
// this status but nevermind.
suite.testAccounts["local_account_1"],
)
expectedPolicy := &gtsmodel.InteractionPolicy{
CanLike: gtsmodel.PolicyRules{
AutomaticApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValuePublic,
},
ManualApproval: gtsmodel.PolicyValues{},
},
CanReply: gtsmodel.PolicyRules{
AutomaticApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValueAuthor,
gtsmodel.PolicyValueFollowers,
"https://gts.superseriousbusiness.org/users/dumpsterqueer",
"https://gts.superseriousbusiness.org/users/f0x",
},
ManualApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValuePublic,
},
},
CanAnnounce: gtsmodel.PolicyRules{
AutomaticApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValueAuthor,
},
ManualApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValuePublic,
},
},
}
suite.EqualValues(expectedPolicy, policy)
}
func (suite *ExtractPolicyTestSuite) TestExtractPolicyDeprecated() {
rawNote := `{
"@context": [
"https://gotosocial.org/ns",
"https://www.w3.org/ns/activitystreams"
],
"content": "hey @f0x and @dumpsterqueer",
"contentMap": {
"en": "hey @f0x and @dumpsterqueer",
"fr": "bonjour @f0x et @dumpsterqueer"
},
"interactionPolicy": { "interactionPolicy": {
"canLike": { "canLike": {
"always": [ "always": [
@ -104,27 +204,27 @@ func (suite *ExtractPolicyTestSuite) TestExtractPolicy() {
expectedPolicy := &gtsmodel.InteractionPolicy{ expectedPolicy := &gtsmodel.InteractionPolicy{
CanLike: gtsmodel.PolicyRules{ CanLike: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{ AutomaticApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValuePublic, gtsmodel.PolicyValuePublic,
}, },
WithApproval: gtsmodel.PolicyValues{}, ManualApproval: gtsmodel.PolicyValues{},
}, },
CanReply: gtsmodel.PolicyRules{ CanReply: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{ AutomaticApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValueAuthor, gtsmodel.PolicyValueAuthor,
gtsmodel.PolicyValueFollowers, gtsmodel.PolicyValueFollowers,
"https://gts.superseriousbusiness.org/users/dumpsterqueer", "https://gts.superseriousbusiness.org/users/dumpsterqueer",
"https://gts.superseriousbusiness.org/users/f0x", "https://gts.superseriousbusiness.org/users/f0x",
}, },
WithApproval: gtsmodel.PolicyValues{ ManualApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValuePublic, gtsmodel.PolicyValuePublic,
}, },
}, },
CanAnnounce: gtsmodel.PolicyRules{ CanAnnounce: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{ AutomaticApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValueAuthor, gtsmodel.PolicyValueAuthor,
}, },
WithApproval: gtsmodel.PolicyValues{ ManualApproval: gtsmodel.PolicyValues{
gtsmodel.PolicyValuePublic, gtsmodel.PolicyValuePublic,
}, },
}, },

View File

@ -755,8 +755,10 @@ type WithInteractionPolicy interface {
// WithPolicyRules represents an activity with always and approvalRequired properties. // WithPolicyRules represents an activity with always and approvalRequired properties.
type WithPolicyRules interface { type WithPolicyRules interface {
GetGoToSocialAlways() vocab.GoToSocialAlwaysProperty GetGoToSocialAutomaticApproval() vocab.GoToSocialAutomaticApprovalProperty
GetGoToSocialApprovalRequired() vocab.GoToSocialApprovalRequiredProperty GetGoToSocialManualApproval() vocab.GoToSocialManualApprovalProperty
GetGoToSocialAlways() vocab.GoToSocialAlwaysProperty // Deprecated
GetGoToSocialApprovalRequired() vocab.GoToSocialApprovalRequiredProperty // Deprecated
} }
// WithApprovedBy represents a Statusable with the approvedBy property. // WithApprovedBy represents a Statusable with the approvedBy property.

View File

@ -582,16 +582,16 @@ func NormalizeOutgoingContentProp(item WithContent, rawJSON map[string]interface
// //
// "interactionPolicy": { // "interactionPolicy": {
// "canAnnounce": { // "canAnnounce": {
// "always": "https://www.w3.org/ns/activitystreams#Public", // "automaticApproval": "https://www.w3.org/ns/activitystreams#Public",
// "approvalRequired": [] // "manualApproval": []
// }, // },
// "canLike": { // "canLike": {
// "always": "https://www.w3.org/ns/activitystreams#Public", // "automaticApproval": "https://www.w3.org/ns/activitystreams#Public",
// "approvalRequired": [] // "manualApproval": []
// }, // },
// "canReply": { // "canReply": {
// "always": "https://www.w3.org/ns/activitystreams#Public", // "automaticApproval": "https://www.w3.org/ns/activitystreams#Public",
// "approvalRequired": [] // "manualApproval": []
// } // }
// } // }
// //
@ -599,22 +599,22 @@ func NormalizeOutgoingContentProp(item WithContent, rawJSON map[string]interface
// //
// "interactionPolicy": { // "interactionPolicy": {
// "canAnnounce": { // "canAnnounce": {
// "always": [ // "automaticApproval": [
// "https://www.w3.org/ns/activitystreams#Public" // "https://www.w3.org/ns/activitystreams#Public"
// ], // ],
// "approvalRequired": [] // "manualApproval": []
// }, // },
// "canLike": { // "canLike": {
// "always": [ // "automaticApproval": [
// "https://www.w3.org/ns/activitystreams#Public" // "https://www.w3.org/ns/activitystreams#Public"
// ], // ],
// "approvalRequired": [] // "manualApproval": []
// }, // },
// "canReply": { // "canReply": {
// "always": [ // "automaticApproval": [
// "https://www.w3.org/ns/activitystreams#Public" // "https://www.w3.org/ns/activitystreams#Public"
// ], // ],
// "approvalRequired": [] // "manualApproval": []
// } // }
// } // }
// //
@ -655,8 +655,10 @@ func NormalizeOutgoingInteractionPolicyProp(item WithInteractionPolicy, rawJSON
} }
for _, PolicyValuesKey := range []string{ for _, PolicyValuesKey := range []string{
"always", "automaticApproval",
"approvalRequired", "manualApproval",
"always", // deprecated
"approvalRequired", // deprecated
} { } {
PolicyValuesVal, ok := rulesValMap[PolicyValuesKey] PolicyValuesVal, ok := rulesValMap[PolicyValuesKey]
if !ok { if !ok {

View File

@ -572,6 +572,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"poll": null, "poll": null,
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -579,6 +584,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -586,6 +596,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -829,6 +844,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"poll": null, "poll": null,
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -836,6 +856,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -843,6 +868,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1086,6 +1116,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"poll": null, "poll": null,
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1093,6 +1128,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1100,6 +1140,11 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"

View File

@ -113,6 +113,11 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -120,6 +125,11 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -127,6 +137,11 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -168,6 +183,11 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -175,6 +195,11 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -182,6 +207,11 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -298,6 +328,13 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"mentioned",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -305,6 +342,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"author", "author",
"me" "me"
], ],
"automatic_approval": [
"author",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -314,6 +356,13 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"mentioned",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -349,6 +398,13 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"mentioned",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -356,6 +412,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"author", "author",
"me" "me"
], ],
"automatic_approval": [
"author",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -365,6 +426,13 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"mentioned",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -513,6 +581,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -520,6 +593,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -527,6 +605,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -560,6 +643,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -567,6 +655,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -574,6 +667,11 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },

View File

@ -156,6 +156,13 @@ func (suite *StatusCreateTestSuite) TestPostNewStatus() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"mentioned",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -163,6 +170,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatus() {
"author", "author",
"me" "me"
], ],
"automatic_approval": [
"author",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -172,6 +184,13 @@ func (suite *StatusCreateTestSuite) TestPostNewStatus() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"mentioned",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -241,6 +260,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicy() {
"author", "author",
"me" "me"
], ],
"automatic_approval": [
"author",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -248,6 +272,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicy() {
"author", "author",
"me" "me"
], ],
"automatic_approval": [
"author",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -258,6 +287,16 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicy() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"following",
"mentioned",
"me"
],
"manual_approval": [
"public"
],
"with_approval": [ "with_approval": [
"public" "public"
] ]
@ -338,6 +377,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicyJSON() {
"author", "author",
"me" "me"
], ],
"automatic_approval": [
"author",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -345,6 +389,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicyJSON() {
"author", "author",
"me" "me"
], ],
"automatic_approval": [
"author",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -355,6 +404,16 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicyJSON() {
"mentioned", "mentioned",
"me" "me"
], ],
"automatic_approval": [
"author",
"followers",
"following",
"mentioned",
"me"
],
"manual_approval": [
"public"
],
"with_approval": [ "with_approval": [
"public" "public"
] ]
@ -553,6 +612,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusMarkdown() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -560,6 +624,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusMarkdown() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -567,6 +636,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusMarkdown() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -638,6 +712,11 @@ func (suite *StatusCreateTestSuite) TestMentionUnknownAccount() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -645,6 +724,11 @@ func (suite *StatusCreateTestSuite) TestMentionUnknownAccount() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -652,6 +736,11 @@ func (suite *StatusCreateTestSuite) TestMentionUnknownAccount() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -717,6 +806,11 @@ func (suite *StatusCreateTestSuite) TestPostStatusWithLinksAndTags() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -724,6 +818,11 @@ func (suite *StatusCreateTestSuite) TestPostStatusWithLinksAndTags() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -731,6 +830,11 @@ func (suite *StatusCreateTestSuite) TestPostStatusWithLinksAndTags() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -810,6 +914,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithEmoji() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -817,6 +926,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithEmoji() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -824,6 +938,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithEmoji() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -901,6 +1020,11 @@ func (suite *StatusCreateTestSuite) TestReplyToLocalStatus() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -908,6 +1032,11 @@ func (suite *StatusCreateTestSuite) TestReplyToLocalStatus() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -915,6 +1044,11 @@ func (suite *StatusCreateTestSuite) TestReplyToLocalStatus() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -985,6 +1119,11 @@ func (suite *StatusCreateTestSuite) TestAttachNewMediaSuccess() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -992,6 +1131,11 @@ func (suite *StatusCreateTestSuite) TestAttachNewMediaSuccess() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -999,6 +1143,11 @@ func (suite *StatusCreateTestSuite) TestAttachNewMediaSuccess() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -1091,6 +1240,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithNoncanonicalLanguageTag
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -1098,6 +1252,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithNoncanonicalLanguageTag
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -1105,6 +1264,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithNoncanonicalLanguageTag
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -1167,6 +1331,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollForm() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -1174,6 +1343,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollForm() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -1181,6 +1355,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollForm() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -1265,6 +1444,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollJSON() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -1272,6 +1456,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollJSON() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -1279,6 +1468,11 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollJSON() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },

View File

@ -119,6 +119,11 @@ func (suite *StatusFaveTestSuite) TestPostFave() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -126,6 +131,11 @@ func (suite *StatusFaveTestSuite) TestPostFave() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -133,6 +143,11 @@ func (suite *StatusFaveTestSuite) TestPostFave() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },
@ -244,6 +259,11 @@ func (suite *StatusFaveTestSuite) TestPostFaveImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
@ -251,6 +271,11 @@ func (suite *StatusFaveTestSuite) TestPostFaveImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
@ -258,6 +283,11 @@ func (suite *StatusFaveTestSuite) TestPostFaveImplicitAccept() {
"public", "public",
"me" "me"
], ],
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"with_approval": [] "with_approval": []
} }
}, },

View File

@ -152,6 +152,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -159,6 +164,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -166,6 +176,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -242,6 +257,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -249,6 +269,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -256,6 +281,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"

View File

@ -48,9 +48,16 @@ const (
// //
// swagger:model interactionPolicyRules // swagger:model interactionPolicyRules
type PolicyRules struct { type PolicyRules struct {
// Policy entries for accounts that will receive automatic approval for this type of interaction.
AutomaticApproval []PolicyValue `form:"automatic_approval" json:"automatic_approval"`
// Policy entries for accounts that require manual approval for this type of interaction.
ManualApproval []PolicyValue `form:"manual_approval" json:"manual_approval"`
// Policy entries for accounts that can always do this type of interaction. // Policy entries for accounts that can always do this type of interaction.
// Deprecated: Use "automatic_approval" instead.
Always []PolicyValue `form:"always" json:"always"` Always []PolicyValue `form:"always" json:"always"`
// Policy entries for accounts that require approval to do this type of interaction. // Policy entries for accounts that require approval to do this type of interaction.
// Deprecated: Use "manual_approval" instead.
WithApproval []PolicyValue `form:"with_approval" json:"with_approval"` WithApproval []PolicyValue `form:"with_approval" json:"with_approval"`
} }

View File

@ -265,7 +265,7 @@ func (d *Dereferencer) isPermittedReply(
) )
} }
if replyable.Permitted() && if replyable.AutomaticApproval() &&
!replyable.MatchedOnCollection() { !replyable.MatchedOnCollection() {
// Reply is permitted and match was *not* made // Reply is permitted and match was *not* made
// based on inclusion in a followers/following // based on inclusion in a followers/following
@ -569,7 +569,7 @@ func (d *Dereferencer) isPermittedBoost(
return false, nil return false, nil
} }
if boostable.Permitted() && if boostable.AutomaticApproval() &&
!boostable.MatchedOnCollection() { !boostable.MatchedOnCollection() {
// Booster is permitted to do this // Booster is permitted to do this
// interaction, and didn't match on // interaction, and didn't match on

View File

@ -98,7 +98,7 @@ func (f *federatingDB) Like(ctx context.Context, likeable vocab.ActivityStreamsL
) )
switch { switch {
case policyResult.WithApproval(): case policyResult.ManualApproval():
// Requester allowed to do // Requester allowed to do
// this pending approval. // this pending approval.
pendingApproval = true pendingApproval = true
@ -111,7 +111,7 @@ func (f *federatingDB) Like(ctx context.Context, likeable vocab.ActivityStreamsL
pendingApproval = true pendingApproval = true
preApproved = true preApproved = true
case policyResult.Permitted(): case policyResult.AutomaticApproval():
// Requester straight up // Requester straight up
// permitted to do this, // permitted to do this,
// no need for Accept. // no need for Accept.

View File

@ -78,8 +78,8 @@ func (f *Filter) StatusLikeable(
// always like their own status, // always like their own status,
// no need for further checks. // no need for further checks.
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
PermittedMatchedOn: util.Ptr(gtsmodel.PolicyValueAuthor), PermissionMatchedOn: util.Ptr(gtsmodel.PolicyValueAuthor),
}, nil }, nil
} }
@ -110,7 +110,7 @@ func (f *Filter) StatusLikeable(
// about interaction policies, and just return OK. // about interaction policies, and just return OK.
default: default:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
}, nil }, nil
} }
} }
@ -153,7 +153,7 @@ func (f *Filter) StatusReplyable(
// and having the reply-to-their-own-reply go // and having the reply-to-their-own-reply go
// through as Permitted. None of that! // through as Permitted. None of that!
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionWithApproval, Permission: gtsmodel.PolicyPermissionManualApproval,
}, nil }, nil
} }
} }
@ -163,8 +163,8 @@ func (f *Filter) StatusReplyable(
// always reply to their own status, // always reply to their own status,
// no need for further checks. // no need for further checks.
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
PermittedMatchedOn: util.Ptr(gtsmodel.PolicyValueAuthor), PermissionMatchedOn: util.Ptr(gtsmodel.PolicyValueAuthor),
}, nil }, nil
} }
@ -173,8 +173,8 @@ func (f *Filter) StatusReplyable(
// to them being mentioned, and easier to check! // to them being mentioned, and easier to check!
if status.InReplyToAccountID == requester.ID { if status.InReplyToAccountID == requester.ID {
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
PermittedMatchedOn: util.Ptr(gtsmodel.PolicyValueMentioned), PermissionMatchedOn: util.Ptr(gtsmodel.PolicyValueMentioned),
}, nil }, nil
} }
@ -229,8 +229,8 @@ func (f *Filter) StatusReplyable(
// A mentioned account can always // A mentioned account can always
// reply, no need for further checks. // reply, no need for further checks.
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
PermittedMatchedOn: util.Ptr(gtsmodel.PolicyValueMentioned), PermissionMatchedOn: util.Ptr(gtsmodel.PolicyValueMentioned),
}, nil }, nil
} }
@ -261,7 +261,7 @@ func (f *Filter) StatusReplyable(
// about interaction policies, and just return OK. // about interaction policies, and just return OK.
default: default:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
}, nil }, nil
} }
} }
@ -291,8 +291,8 @@ func (f *Filter) StatusBoostable(
// always boost non-directs, // always boost non-directs,
// no need for further checks. // no need for further checks.
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
PermittedMatchedOn: util.Ptr(gtsmodel.PolicyValueAuthor), PermissionMatchedOn: util.Ptr(gtsmodel.PolicyValueAuthor),
}, nil }, nil
} }
@ -324,7 +324,7 @@ func (f *Filter) StatusBoostable(
case status.Visibility == gtsmodel.VisibilityPublic || case status.Visibility == gtsmodel.VisibilityPublic ||
status.Visibility == gtsmodel.VisibilityUnlocked: status.Visibility == gtsmodel.VisibilityUnlocked:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
}, nil }, nil
// Not permitted by any of the // Not permitted by any of the
@ -353,7 +353,7 @@ func (f *Filter) checkPolicy(
matchAlways, matchAlwaysValue, err := f.matchPolicy(fctx, matchAlways, matchAlwaysValue, err := f.matchPolicy(fctx,
requester, requester,
status, status,
rules.Always, rules.AutomaticApproval,
) )
if err != nil { if err != nil {
return nil, gtserror.Newf("error checking policy match: %w", err) return nil, gtserror.Newf("error checking policy match: %w", err)
@ -364,7 +364,7 @@ func (f *Filter) checkPolicy(
matchWithApproval, _, err := f.matchPolicy(fctx, matchWithApproval, _, err := f.matchPolicy(fctx,
requester, requester,
status, status,
rules.WithApproval, rules.ManualApproval,
) )
if err != nil { if err != nil {
return nil, gtserror.Newf("error checking policy approval match: %w", err) return nil, gtserror.Newf("error checking policy approval match: %w", err)
@ -376,26 +376,26 @@ func (f *Filter) checkPolicy(
// prioritizing "always". // prioritizing "always".
case matchAlways == explicit: case matchAlways == explicit:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
PermittedMatchedOn: &matchAlwaysValue, PermissionMatchedOn: &matchAlwaysValue,
}, nil }, nil
case matchWithApproval == explicit: case matchWithApproval == explicit:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionWithApproval, Permission: gtsmodel.PolicyPermissionManualApproval,
}, nil }, nil
// Then try implicit match, // Then try implicit match,
// prioritizing "always". // prioritizing "always".
case matchAlways == implicit: case matchAlways == implicit:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionAutomaticApproval,
PermittedMatchedOn: &matchAlwaysValue, PermissionMatchedOn: &matchAlwaysValue,
}, nil }, nil
case matchWithApproval == implicit: case matchWithApproval == implicit:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionWithApproval, Permission: gtsmodel.PolicyPermissionManualApproval,
}, nil }, nil
} }

View File

@ -123,10 +123,10 @@ const (
// Interaction is conditionally permitted // Interaction is conditionally permitted
// for this PolicyValue + interaction combo, // for this PolicyValue + interaction combo,
// pending approval by the item owner. // pending approval by the item owner.
PolicyPermissionWithApproval PolicyPermissionManualApproval
// Interaction is permitted for this // Interaction is permitted for this
// PolicyValue + interaction combination. // PolicyValue + interaction combination.
PolicyPermissionPermitted PolicyPermissionAutomaticApproval
) )
// PolicyCheckResult encapsulates the results // PolicyCheckResult encapsulates the results
@ -138,39 +138,39 @@ type PolicyCheckResult struct {
Permission PolicyPermission Permission PolicyPermission
// Value that this check matched on. // Value that this check matched on.
// Only set if Permission = permitted. // Only set if Permission = automatic.
PermittedMatchedOn *PolicyValue PermissionMatchedOn *PolicyValue
} }
// MatchedOnCollection returns true if this policy check // MatchedOnCollection returns true if this policy check
// result turned up Permitted, and matched based on the // result turned up AutomaticApproval, and matched based on the
// requester's presence in a followers or following collection. // requester's presence in a followers or following collection.
func (pcr *PolicyCheckResult) MatchedOnCollection() bool { func (pcr *PolicyCheckResult) MatchedOnCollection() bool {
if !pcr.Permitted() { if !pcr.AutomaticApproval() {
// Not permitted at all // Not permitted at all
// so definitely didn't // so definitely didn't
// match on collection. // match on collection.
return false return false
} }
if pcr.PermittedMatchedOn == nil { if pcr.PermissionMatchedOn == nil {
return false return false
} }
return *pcr.PermittedMatchedOn == PolicyValueFollowers || return *pcr.PermissionMatchedOn == PolicyValueFollowers ||
*pcr.PermittedMatchedOn == PolicyValueFollowing *pcr.PermissionMatchedOn == PolicyValueFollowing
}
// AutomaticApproval returns true if this policy
// check resulted in Permission = automatic approval.
func (pcr *PolicyCheckResult) AutomaticApproval() bool {
return pcr.Permission == PolicyPermissionAutomaticApproval
} }
// Permitted returns true if this policy // Permitted returns true if this policy
// check resulted in Permission = permitted. // check resulted in Permission = manual approval.
func (pcr *PolicyCheckResult) Permitted() bool { func (pcr *PolicyCheckResult) ManualApproval() bool {
return pcr.Permission == PolicyPermissionPermitted return pcr.Permission == PolicyPermissionManualApproval
}
// Permitted returns true if this policy
// check resulted in Permission = with approval.
func (pcr *PolicyCheckResult) WithApproval() bool {
return pcr.Permission == PolicyPermissionWithApproval
} }
// Permitted returns true if this policy // Permitted returns true if this policy
@ -201,14 +201,22 @@ type InteractionPolicy struct {
// to which a certain interaction is permitted // to which a certain interaction is permitted
// to various Actor and Actor Collection URIs. // to various Actor and Actor Collection URIs.
type PolicyRules struct { type PolicyRules struct {
// Always is for PolicyValues who are // AutomaticApproval is for PolicyValue entries
// permitted to do an interaction // that are pre-approved to do an interaction
// without requiring approval. // and will receive automatic approval.
Always PolicyValues //
// WithApproval is for PolicyValues who // Note: This is stored in the db as JSON.
// are conditionally permitted to do // JSON tags set for back compat with previous
// an interaction, pending approval. // (now deprecated) name for this PolicyValues.
WithApproval PolicyValues AutomaticApproval PolicyValues `json:"Always,omitempty"`
// ManualApproval is for PolicyValues entries
// that are conditionally permitted to do
// an interaction, pending manual approval.
//
// Note: This is stored in the db as JSON.
// JSON tags set for back compat with previous
// (now deprecated) name for this PolicyValues.
ManualApproval PolicyValues `json:"WithApproval,omitempty"`
} }
// Returns the default interaction policy // Returns the default interaction policy
@ -231,24 +239,24 @@ func DefaultInteractionPolicyFor(v Visibility) *InteractionPolicy {
var defaultPolicyPublic = &InteractionPolicy{ var defaultPolicyPublic = &InteractionPolicy{
CanLike: PolicyRules{ CanLike: PolicyRules{
// Anyone can like. // Anyone can like.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValuePublic, PolicyValuePublic,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
CanReply: PolicyRules{ CanReply: PolicyRules{
// Anyone can reply. // Anyone can reply.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValuePublic, PolicyValuePublic,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
CanAnnounce: PolicyRules{ CanAnnounce: PolicyRules{
// Anyone can announce. // Anyone can announce.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValuePublic, PolicyValuePublic,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
} }
@ -269,29 +277,29 @@ var defaultPolicyFollowersOnly = &InteractionPolicy{
CanLike: PolicyRules{ CanLike: PolicyRules{
// Self, followers and // Self, followers and
// mentioned can like. // mentioned can like.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValueAuthor, PolicyValueAuthor,
PolicyValueFollowers, PolicyValueFollowers,
PolicyValueMentioned, PolicyValueMentioned,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
CanReply: PolicyRules{ CanReply: PolicyRules{
// Self, followers and // Self, followers and
// mentioned can reply. // mentioned can reply.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValueAuthor, PolicyValueAuthor,
PolicyValueFollowers, PolicyValueFollowers,
PolicyValueMentioned, PolicyValueMentioned,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
CanAnnounce: PolicyRules{ CanAnnounce: PolicyRules{
// Only self can announce. // Only self can announce.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValueAuthor, PolicyValueAuthor,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
} }
@ -305,27 +313,27 @@ var defaultPolicyDirect = &InteractionPolicy{
CanLike: PolicyRules{ CanLike: PolicyRules{
// Mentioned and self // Mentioned and self
// can always like. // can always like.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValueAuthor, PolicyValueAuthor,
PolicyValueMentioned, PolicyValueMentioned,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
CanReply: PolicyRules{ CanReply: PolicyRules{
// Mentioned and self // Mentioned and self
// can always reply. // can always reply.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValueAuthor, PolicyValueAuthor,
PolicyValueMentioned, PolicyValueMentioned,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
CanAnnounce: PolicyRules{ CanAnnounce: PolicyRules{
// Only self can announce. // Only self can announce.
Always: PolicyValues{ AutomaticApproval: PolicyValues{
PolicyValueAuthor, PolicyValueAuthor,
}, },
WithApproval: make(PolicyValues, 0), ManualApproval: make(PolicyValues, 0),
}, },
} }

View File

@ -96,7 +96,7 @@ func (p *Processor) BoostCreate(
// Derive pendingApproval status. // Derive pendingApproval status.
var pendingApproval bool var pendingApproval bool
switch { switch {
case policyResult.WithApproval(): case policyResult.ManualApproval():
// We're allowed to do // We're allowed to do
// this pending approval. // this pending approval.
pendingApproval = true pendingApproval = true
@ -117,7 +117,7 @@ func (p *Processor) BoostCreate(
boost.PreApproved = true boost.PreApproved = true
} }
case policyResult.Permitted(): case policyResult.AutomaticApproval():
// We're permitted to do this // We're permitted to do this
// based on another kind of match. // based on another kind of match.
pendingApproval = false pendingApproval = false

View File

@ -406,7 +406,7 @@ func (p *Processor) processInReplyTo(
// Derive pendingApproval status. // Derive pendingApproval status.
var pendingApproval bool var pendingApproval bool
switch { switch {
case policyResult.WithApproval(): case policyResult.ManualApproval():
// We're allowed to do // We're allowed to do
// this pending approval. // this pending approval.
pendingApproval = true pendingApproval = true
@ -427,7 +427,7 @@ func (p *Processor) processInReplyTo(
status.PreApproved = true status.PreApproved = true
} }
case policyResult.Permitted(): case policyResult.AutomaticApproval():
// We're permitted to do this // We're permitted to do this
// based on another kind of match. // based on another kind of match.
pendingApproval = false pendingApproval = false

View File

@ -112,7 +112,7 @@ func (p *Processor) FaveCreate(
) )
switch { switch {
case policyResult.WithApproval(): case policyResult.ManualApproval():
// We're allowed to do // We're allowed to do
// this pending approval. // this pending approval.
pendingApproval = true pendingApproval = true
@ -133,7 +133,7 @@ func (p *Processor) FaveCreate(
preApproved = true preApproved = true
} }
case policyResult.Permitted(): case policyResult.AutomaticApproval():
// We're permitted to do this // We're permitted to do this
// based on another kind of match. // based on another kind of match.
pendingApproval = false pendingApproval = false

View File

@ -135,6 +135,11 @@ func (suite *StatusUpdateTestSuite) TestStreamNotification() {
"poll": null, "poll": null,
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -142,6 +147,11 @@ func (suite *StatusUpdateTestSuite) TestStreamNotification() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -149,6 +159,11 @@ func (suite *StatusUpdateTestSuite) TestStreamNotification() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"

View File

@ -115,8 +115,8 @@ func (suite *DereferenceTestSuite) TestDerefLocalStatus() {
defer resp.Body.Close() defer resp.Body.Close()
suite.Equal(http.StatusOK, resp.StatusCode) suite.Equal(http.StatusOK, resp.StatusCode)
suite.EqualValues(1502, resp.ContentLength) suite.EqualValues(1769, resp.ContentLength)
suite.Equal("1502", resp.Header.Get("Content-Length")) suite.Equal("1769", resp.Header.Get("Content-Length"))
suite.Equal(apiutil.AppActivityLDJSON, resp.Header.Get("Content-Type")) suite.Equal(apiutil.AppActivityLDJSON, resp.Header.Get("Content-Type"))
b, err := io.ReadAll(resp.Body) b, err := io.ReadAll(resp.Body)
@ -150,19 +150,31 @@ func (suite *DereferenceTestSuite) TestDerefLocalStatus() {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canLike": { "canLike": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canReply": { "canReply": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
} }
}, },
"published": "2021-10-20T10:40:37Z", "published": "2021-10-20T10:40:37Z",

View File

@ -228,16 +228,16 @@ func APIInteractionPolicyToInteractionPolicy(
return &gtsmodel.InteractionPolicy{ return &gtsmodel.InteractionPolicy{
CanLike: gtsmodel.PolicyRules{ CanLike: gtsmodel.PolicyRules{
Always: canLikeAlways, AutomaticApproval: canLikeAlways,
WithApproval: canLikeWithApproval, ManualApproval: canLikeWithApproval,
}, },
CanReply: gtsmodel.PolicyRules{ CanReply: gtsmodel.PolicyRules{
Always: canReplyAlways, AutomaticApproval: canReplyAlways,
WithApproval: canReplyWithApproval, ManualApproval: canReplyWithApproval,
}, },
CanAnnounce: gtsmodel.PolicyRules{ CanAnnounce: gtsmodel.PolicyRules{
Always: canAnnounceAlways, AutomaticApproval: canAnnounceAlways,
WithApproval: canAnnounceWithApproval, ManualApproval: canAnnounceWithApproval,
}, },
}, nil }, nil
} }

View File

@ -1928,6 +1928,9 @@ func populateValuesForProp[T ap.WithIRI](
// InteractionPolicyToASInteractionPolicy returns a // InteractionPolicyToASInteractionPolicy returns a
// GoToSocial interaction policy suitable for federation. // GoToSocial interaction policy suitable for federation.
//
// Note: This currently includes deprecated properties `always`
// and `approvalRequired`. These will be removed in v0.21.0.
func (c *Converter) InteractionPolicyToASInteractionPolicy( func (c *Converter) InteractionPolicyToASInteractionPolicy(
ctx context.Context, ctx context.Context,
interactionPolicy *gtsmodel.InteractionPolicy, interactionPolicy *gtsmodel.InteractionPolicy,
@ -1942,30 +1945,56 @@ func (c *Converter) InteractionPolicyToASInteractionPolicy(
// Build canLike // Build canLike
canLike := streams.NewGoToSocialCanLike() canLike := streams.NewGoToSocialCanLike()
// Build canLike.always // Build canLike.automaticApproval
canLikeAutomaticApprovalProp := streams.NewGoToSocialAutomaticApprovalProperty()
if err := populateValuesForProp(
canLikeAutomaticApprovalProp,
status,
interactionPolicy.CanLike.AutomaticApproval,
); err != nil {
return nil, gtserror.Newf("error setting canLike.automaticApproval: %w", err)
}
// Set canLike.manualApproval
canLike.SetGoToSocialAutomaticApproval(canLikeAutomaticApprovalProp)
// Build canLike.manualApproval
canLikeManualApprovalProp := streams.NewGoToSocialManualApprovalProperty()
if err := populateValuesForProp(
canLikeManualApprovalProp,
status,
interactionPolicy.CanLike.ManualApproval,
); err != nil {
return nil, gtserror.Newf("error setting canLike.manualApproval: %w", err)
}
// Set canLike.manualApproval.
canLike.SetGoToSocialManualApproval(canLikeManualApprovalProp)
// deprecated: Build canLike.always
canLikeAlwaysProp := streams.NewGoToSocialAlwaysProperty() canLikeAlwaysProp := streams.NewGoToSocialAlwaysProperty()
if err := populateValuesForProp( if err := populateValuesForProp(
canLikeAlwaysProp, canLikeAlwaysProp,
status, status,
interactionPolicy.CanLike.Always, interactionPolicy.CanLike.AutomaticApproval,
); err != nil { ); err != nil {
return nil, gtserror.Newf("error setting canLike.always: %w", err) return nil, gtserror.Newf("error setting canLike.always: %w", err)
} }
// Set canLike.always // deprecated: Set canLike.always
canLike.SetGoToSocialAlways(canLikeAlwaysProp) canLike.SetGoToSocialAlways(canLikeAlwaysProp)
// Build canLike.approvalRequired // deprecated: Build canLike.approvalRequired
canLikeApprovalRequiredProp := streams.NewGoToSocialApprovalRequiredProperty() canLikeApprovalRequiredProp := streams.NewGoToSocialApprovalRequiredProperty()
if err := populateValuesForProp( if err := populateValuesForProp(
canLikeApprovalRequiredProp, canLikeApprovalRequiredProp,
status, status,
interactionPolicy.CanLike.WithApproval, interactionPolicy.CanLike.ManualApproval,
); err != nil { ); err != nil {
return nil, gtserror.Newf("error setting canLike.approvalRequired: %w", err) return nil, gtserror.Newf("error setting canLike.approvalRequired: %w", err)
} }
// Set canLike.approvalRequired. // deprecated: Set canLike.approvalRequired.
canLike.SetGoToSocialApprovalRequired(canLikeApprovalRequiredProp) canLike.SetGoToSocialApprovalRequired(canLikeApprovalRequiredProp)
// Set canLike on the policy. // Set canLike on the policy.
@ -1980,30 +2009,56 @@ func (c *Converter) InteractionPolicyToASInteractionPolicy(
// Build canReply // Build canReply
canReply := streams.NewGoToSocialCanReply() canReply := streams.NewGoToSocialCanReply()
// Build canReply.always // Build canReply.automaticApproval
canReplyAutomaticApprovalProp := streams.NewGoToSocialAutomaticApprovalProperty()
if err := populateValuesForProp(
canReplyAutomaticApprovalProp,
status,
interactionPolicy.CanReply.AutomaticApproval,
); err != nil {
return nil, gtserror.Newf("error setting canReply.automaticApproval: %w", err)
}
// Set canReply.manualApproval
canReply.SetGoToSocialAutomaticApproval(canReplyAutomaticApprovalProp)
// Build canReply.manualApproval
canReplyManualApprovalProp := streams.NewGoToSocialManualApprovalProperty()
if err := populateValuesForProp(
canReplyManualApprovalProp,
status,
interactionPolicy.CanReply.ManualApproval,
); err != nil {
return nil, gtserror.Newf("error setting canReply.manualApproval: %w", err)
}
// Set canReply.manualApproval.
canReply.SetGoToSocialManualApproval(canReplyManualApprovalProp)
// deprecated: Build canReply.always
canReplyAlwaysProp := streams.NewGoToSocialAlwaysProperty() canReplyAlwaysProp := streams.NewGoToSocialAlwaysProperty()
if err := populateValuesForProp( if err := populateValuesForProp(
canReplyAlwaysProp, canReplyAlwaysProp,
status, status,
interactionPolicy.CanReply.Always, interactionPolicy.CanReply.AutomaticApproval,
); err != nil { ); err != nil {
return nil, gtserror.Newf("error setting canReply.always: %w", err) return nil, gtserror.Newf("error setting canReply.always: %w", err)
} }
// Set canReply.always // deprecated: Set canReply.always
canReply.SetGoToSocialAlways(canReplyAlwaysProp) canReply.SetGoToSocialAlways(canReplyAlwaysProp)
// Build canReply.approvalRequired // deprecated: Build canReply.approvalRequired
canReplyApprovalRequiredProp := streams.NewGoToSocialApprovalRequiredProperty() canReplyApprovalRequiredProp := streams.NewGoToSocialApprovalRequiredProperty()
if err := populateValuesForProp( if err := populateValuesForProp(
canReplyApprovalRequiredProp, canReplyApprovalRequiredProp,
status, status,
interactionPolicy.CanReply.WithApproval, interactionPolicy.CanReply.ManualApproval,
); err != nil { ); err != nil {
return nil, gtserror.Newf("error setting canReply.approvalRequired: %w", err) return nil, gtserror.Newf("error setting canReply.approvalRequired: %w", err)
} }
// Set canReply.approvalRequired. // deprecated: Set canReply.approvalRequired.
canReply.SetGoToSocialApprovalRequired(canReplyApprovalRequiredProp) canReply.SetGoToSocialApprovalRequired(canReplyApprovalRequiredProp)
// Set canReply on the policy. // Set canReply on the policy.
@ -2018,30 +2073,56 @@ func (c *Converter) InteractionPolicyToASInteractionPolicy(
// Build canAnnounce // Build canAnnounce
canAnnounce := streams.NewGoToSocialCanAnnounce() canAnnounce := streams.NewGoToSocialCanAnnounce()
// Build canAnnounce.always // Build canAnnounce.automaticApproval
canAnnounceAutomaticApprovalProp := streams.NewGoToSocialAutomaticApprovalProperty()
if err := populateValuesForProp(
canAnnounceAutomaticApprovalProp,
status,
interactionPolicy.CanAnnounce.AutomaticApproval,
); err != nil {
return nil, gtserror.Newf("error setting canAnnounce.automaticApproval: %w", err)
}
// Set canAnnounce.manualApproval
canAnnounce.SetGoToSocialAutomaticApproval(canAnnounceAutomaticApprovalProp)
// Build canAnnounce.manualApproval
canAnnounceManualApprovalProp := streams.NewGoToSocialManualApprovalProperty()
if err := populateValuesForProp(
canAnnounceManualApprovalProp,
status,
interactionPolicy.CanAnnounce.ManualApproval,
); err != nil {
return nil, gtserror.Newf("error setting canAnnounce.manualApproval: %w", err)
}
// Set canAnnounce.manualApproval.
canAnnounce.SetGoToSocialManualApproval(canAnnounceManualApprovalProp)
// deprecated: Build canAnnounce.always
canAnnounceAlwaysProp := streams.NewGoToSocialAlwaysProperty() canAnnounceAlwaysProp := streams.NewGoToSocialAlwaysProperty()
if err := populateValuesForProp( if err := populateValuesForProp(
canAnnounceAlwaysProp, canAnnounceAlwaysProp,
status, status,
interactionPolicy.CanAnnounce.Always, interactionPolicy.CanAnnounce.AutomaticApproval,
); err != nil { ); err != nil {
return nil, gtserror.Newf("error setting canAnnounce.always: %w", err) return nil, gtserror.Newf("error setting canAnnounce.always: %w", err)
} }
// Set canAnnounce.always // deprecated: Set canAnnounce.always
canAnnounce.SetGoToSocialAlways(canAnnounceAlwaysProp) canAnnounce.SetGoToSocialAlways(canAnnounceAlwaysProp)
// Build canAnnounce.approvalRequired // deprecated: Build canAnnounce.approvalRequired
canAnnounceApprovalRequiredProp := streams.NewGoToSocialApprovalRequiredProperty() canAnnounceApprovalRequiredProp := streams.NewGoToSocialApprovalRequiredProperty()
if err := populateValuesForProp( if err := populateValuesForProp(
canAnnounceApprovalRequiredProp, canAnnounceApprovalRequiredProp,
status, status,
interactionPolicy.CanAnnounce.WithApproval, interactionPolicy.CanAnnounce.ManualApproval,
); err != nil { ); err != nil {
return nil, gtserror.Newf("error setting canAnnounce.approvalRequired: %w", err) return nil, gtserror.Newf("error setting canAnnounce.approvalRequired: %w", err)
} }
// Set canAnnounce.approvalRequired. // deprecated: Set canAnnounce.approvalRequired.
canAnnounce.SetGoToSocialApprovalRequired(canAnnounceApprovalRequiredProp) canAnnounce.SetGoToSocialApprovalRequired(canAnnounceApprovalRequiredProp)
// Set canAnnounce on the policy. // Set canAnnounce on the policy.

View File

@ -540,19 +540,31 @@ func (suite *InternalToASTestSuite) TestStatusToAS() {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canLike": { "canLike": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canReply": { "canReply": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
} }
}, },
"published": "2021-10-20T12:40:37+02:00", "published": "2021-10-20T12:40:37+02:00",
@ -630,19 +642,31 @@ func (suite *InternalToASTestSuite) TestStatusWithTagsToASWithIDs() {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canLike": { "canLike": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canReply": { "canReply": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
} }
}, },
"published": "2021-10-20T11:36:45Z", "published": "2021-10-20T11:36:45Z",
@ -738,19 +762,31 @@ func (suite *InternalToASTestSuite) TestStatusWithTagsToASFromDB() {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canLike": { "canLike": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canReply": { "canReply": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
} }
}, },
"published": "2021-10-20T11:36:45Z", "published": "2021-10-20T11:36:45Z",
@ -831,19 +867,31 @@ func (suite *InternalToASTestSuite) TestStatusToASWithMentions() {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canLike": { "canLike": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canReply": { "canReply": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
} }
}, },
"published": "2021-11-20T13:32:16Z", "published": "2021-11-20T13:32:16Z",

View File

@ -2862,19 +2862,29 @@ func (c *Converter) InteractionPolicyToAPIInteractionPolicy(
) (*apimodel.InteractionPolicy, error) { ) (*apimodel.InteractionPolicy, error) {
apiPolicy := &apimodel.InteractionPolicy{ apiPolicy := &apimodel.InteractionPolicy{
CanFavourite: apimodel.PolicyRules{ CanFavourite: apimodel.PolicyRules{
Always: policyValsToAPIPolicyVals(policy.CanLike.Always), AutomaticApproval: policyValsToAPIPolicyVals(policy.CanLike.AutomaticApproval),
WithApproval: policyValsToAPIPolicyVals(policy.CanLike.WithApproval), ManualApproval: policyValsToAPIPolicyVals(policy.CanLike.ManualApproval),
}, },
CanReply: apimodel.PolicyRules{ CanReply: apimodel.PolicyRules{
Always: policyValsToAPIPolicyVals(policy.CanReply.Always), AutomaticApproval: policyValsToAPIPolicyVals(policy.CanReply.AutomaticApproval),
WithApproval: policyValsToAPIPolicyVals(policy.CanReply.WithApproval), ManualApproval: policyValsToAPIPolicyVals(policy.CanReply.ManualApproval),
}, },
CanReblog: apimodel.PolicyRules{ CanReblog: apimodel.PolicyRules{
Always: policyValsToAPIPolicyVals(policy.CanAnnounce.Always), AutomaticApproval: policyValsToAPIPolicyVals(policy.CanAnnounce.AutomaticApproval),
WithApproval: policyValsToAPIPolicyVals(policy.CanAnnounce.WithApproval), ManualApproval: policyValsToAPIPolicyVals(policy.CanAnnounce.ManualApproval),
}, },
} }
defer func() {
// Include deprecated fields for back-compat. TODO: Remove these in 0.21.0.
apiPolicy.CanFavourite.Always = apiPolicy.CanFavourite.AutomaticApproval
apiPolicy.CanFavourite.WithApproval = apiPolicy.CanFavourite.ManualApproval
apiPolicy.CanReply.Always = apiPolicy.CanReply.AutomaticApproval
apiPolicy.CanReply.WithApproval = apiPolicy.CanReply.ManualApproval
apiPolicy.CanReblog.Always = apiPolicy.CanReblog.AutomaticApproval
apiPolicy.CanReblog.WithApproval = apiPolicy.CanReblog.ManualApproval
}()
if status == nil || requester == nil { if status == nil || requester == nil {
// We're done here! // We're done here!
return apiPolicy, nil return apiPolicy, nil
@ -2890,16 +2900,16 @@ func (c *Converter) InteractionPolicyToAPIInteractionPolicy(
return nil, err return nil, err
} }
if likeable.Permission == gtsmodel.PolicyPermissionPermitted { if likeable.Permission == gtsmodel.PolicyPermissionAutomaticApproval {
// We can do this! // We can do this!
apiPolicy.CanFavourite.Always = append( apiPolicy.CanFavourite.AutomaticApproval = append(
apiPolicy.CanFavourite.Always, apiPolicy.CanFavourite.AutomaticApproval,
apimodel.PolicyValueMe, apimodel.PolicyValueMe,
) )
} else if likeable.Permission == gtsmodel.PolicyPermissionWithApproval { } else if likeable.Permission == gtsmodel.PolicyPermissionManualApproval {
// We can do this with approval. // We can do this with approval.
apiPolicy.CanFavourite.WithApproval = append( apiPolicy.CanFavourite.ManualApproval = append(
apiPolicy.CanFavourite.WithApproval, apiPolicy.CanFavourite.ManualApproval,
apimodel.PolicyValueMe, apimodel.PolicyValueMe,
) )
} }
@ -2910,16 +2920,16 @@ func (c *Converter) InteractionPolicyToAPIInteractionPolicy(
return nil, err return nil, err
} }
if replyable.Permission == gtsmodel.PolicyPermissionPermitted { if replyable.Permission == gtsmodel.PolicyPermissionAutomaticApproval {
// We can do this! // We can do this!
apiPolicy.CanReply.Always = append( apiPolicy.CanReply.AutomaticApproval = append(
apiPolicy.CanReply.Always, apiPolicy.CanReply.AutomaticApproval,
apimodel.PolicyValueMe, apimodel.PolicyValueMe,
) )
} else if replyable.Permission == gtsmodel.PolicyPermissionWithApproval { } else if replyable.Permission == gtsmodel.PolicyPermissionManualApproval {
// We can do this with approval. // We can do this with approval.
apiPolicy.CanReply.WithApproval = append( apiPolicy.CanReply.ManualApproval = append(
apiPolicy.CanReply.WithApproval, apiPolicy.CanReply.ManualApproval,
apimodel.PolicyValueMe, apimodel.PolicyValueMe,
) )
} }
@ -2930,16 +2940,16 @@ func (c *Converter) InteractionPolicyToAPIInteractionPolicy(
return nil, err return nil, err
} }
if boostable.Permission == gtsmodel.PolicyPermissionPermitted { if boostable.Permission == gtsmodel.PolicyPermissionAutomaticApproval {
// We can do this! // We can do this!
apiPolicy.CanReblog.Always = append( apiPolicy.CanReblog.AutomaticApproval = append(
apiPolicy.CanReblog.Always, apiPolicy.CanReblog.AutomaticApproval,
apimodel.PolicyValueMe, apimodel.PolicyValueMe,
) )
} else if boostable.Permission == gtsmodel.PolicyPermissionWithApproval { } else if boostable.Permission == gtsmodel.PolicyPermissionManualApproval {
// We can do this with approval. // We can do this with approval.
apiPolicy.CanReblog.WithApproval = append( apiPolicy.CanReblog.ManualApproval = append(
apiPolicy.CanReblog.WithApproval, apiPolicy.CanReblog.ManualApproval,
apimodel.PolicyValueMe, apimodel.PolicyValueMe,
) )
} }

View File

@ -583,6 +583,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontend() {
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -590,6 +595,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -597,6 +607,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -731,6 +746,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendHTMLContentWarning
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -738,6 +758,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendHTMLContentWarning
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -745,6 +770,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendHTMLContentWarning
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -881,6 +911,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendApplicationDeleted
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -888,6 +923,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendApplicationDeleted
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -895,6 +935,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendApplicationDeleted
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1088,6 +1133,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredStatusToFrontend() {
], ],
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1095,6 +1145,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredStatusToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1102,6 +1157,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredStatusToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1274,6 +1334,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
], ],
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1281,6 +1346,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1288,6 +1358,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1366,6 +1441,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
], ],
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1373,6 +1453,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1380,6 +1465,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1665,6 +1755,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownAttachments
"poll": null, "poll": null,
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1672,6 +1767,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownAttachments
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1679,6 +1779,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownAttachments
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1744,18 +1849,30 @@ func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() {
"poll": null, "poll": null,
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public"
],
"manual_approval": [],
"always": [ "always": [
"public" "public"
], ],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public"
],
"manual_approval": [],
"always": [ "always": [
"public" "public"
], ],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public"
],
"manual_approval": [],
"always": [ "always": [
"public" "public"
], ],
@ -1985,6 +2102,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownLanguage()
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1992,6 +2114,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownLanguage()
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -1999,6 +2126,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownLanguage()
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -2084,18 +2216,30 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendPartialInteraction
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"author"
],
"manual_approval": [],
"always": [ "always": [
"author" "author"
], ],
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"author"
],
"manual_approval": [],
"always": [ "always": [
"author" "author"
], ],
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"author"
],
"manual_approval": [],
"always": [ "always": [
"author" "author"
], ],
@ -2208,6 +2352,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToAPIStatusPendingApproval()
"content_type": "text/markdown", "content_type": "text/markdown",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -2215,6 +2364,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToAPIStatusPendingApproval()
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -2222,6 +2376,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToAPIStatusPendingApproval()
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3186,6 +3345,11 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() {
"poll": null, "poll": null,
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3193,6 +3357,11 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3200,6 +3369,11 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3688,6 +3862,11 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3695,6 +3874,13 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"author",
"me"
],
"manual_approval": [
"public"
],
"always": [ "always": [
"author", "author",
"me" "me"
@ -3704,6 +3890,11 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
] ]
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3787,6 +3978,11 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"content_type": "text/markdown", "content_type": "text/markdown",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3794,6 +3990,11 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3801,6 +4002,11 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3947,6 +4153,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() {
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3954,6 +4165,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -3961,6 +4177,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -4117,6 +4338,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() {
"content_type": "text/plain", "content_type": "text/plain",
"interaction_policy": { "interaction_policy": {
"can_favourite": { "can_favourite": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -4124,6 +4350,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() {
"with_approval": [] "with_approval": []
}, },
"can_reply": { "can_reply": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"
@ -4131,6 +4362,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() {
"with_approval": [] "with_approval": []
}, },
"can_reblog": { "can_reblog": {
"automatic_approval": [
"public",
"me"
],
"manual_approval": [],
"always": [ "always": [
"public", "public",
"me" "me"

View File

@ -100,19 +100,31 @@ func (suite *WrapTestSuite) TestWrapNoteInCreate() {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canLike": { "canLike": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
}, },
"canReply": { "canReply": {
"always": [ "always": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"approvalRequired": [] "approvalRequired": [],
"automaticApproval": [
"https://www.w3.org/ns/activitystreams#Public"
],
"manualApproval": []
} }
}, },
"published": "2021-10-20T12:40:37+02:00", "published": "2021-10-20T12:40:37+02:00",

View File

@ -2245,13 +2245,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
Federated: util.Ptr(true), Federated: util.Ptr(true),
InteractionPolicy: &gtsmodel.InteractionPolicy{ InteractionPolicy: &gtsmodel.InteractionPolicy{
CanLike: gtsmodel.PolicyRules{ CanLike: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor},
}, },
CanReply: gtsmodel.PolicyRules{ CanReply: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor},
}, },
CanAnnounce: gtsmodel.PolicyRules{ CanAnnounce: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor},
}, },
}, },
ActivityStreamsType: ap.ObjectNote, ActivityStreamsType: ap.ObjectNote,
@ -2426,13 +2426,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
Federated: util.Ptr(true), Federated: util.Ptr(true),
InteractionPolicy: &gtsmodel.InteractionPolicy{ InteractionPolicy: &gtsmodel.InteractionPolicy{
CanLike: gtsmodel.PolicyRules{ CanLike: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic},
}, },
CanReply: gtsmodel.PolicyRules{ CanReply: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor},
}, },
CanAnnounce: gtsmodel.PolicyRules{ CanAnnounce: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic},
}, },
}, },
ActivityStreamsType: ap.ObjectNote, ActivityStreamsType: ap.ObjectNote,
@ -2458,14 +2458,14 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
Federated: util.Ptr(true), Federated: util.Ptr(true),
InteractionPolicy: &gtsmodel.InteractionPolicy{ InteractionPolicy: &gtsmodel.InteractionPolicy{
CanLike: gtsmodel.PolicyRules{ CanLike: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic},
}, },
CanReply: gtsmodel.PolicyRules{ CanReply: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor},
WithApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic}, ManualApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic},
}, },
CanAnnounce: gtsmodel.PolicyRules{ CanAnnounce: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic},
}, },
}, },
ActivityStreamsType: ap.ObjectNote, ActivityStreamsType: ap.ObjectNote,
@ -2490,13 +2490,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
Federated: util.Ptr(false), Federated: util.Ptr(false),
InteractionPolicy: &gtsmodel.InteractionPolicy{ InteractionPolicy: &gtsmodel.InteractionPolicy{
CanLike: gtsmodel.PolicyRules{ CanLike: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic},
}, },
CanReply: gtsmodel.PolicyRules{ CanReply: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValuePublic},
}, },
CanAnnounce: gtsmodel.PolicyRules{ CanAnnounce: gtsmodel.PolicyRules{
Always: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor}, AutomaticApproval: gtsmodel.PolicyValues{gtsmodel.PolicyValueAuthor},
}, },
}, },
ActivityStreamsType: ap.ObjectNote, ActivityStreamsType: ap.ObjectNote,