summaryrefslogtreecommitdiff
path: root/internal/ap/properties.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-07-26 12:04:28 +0200
committerLibravatar GitHub <noreply@github.com>2024-07-26 12:04:28 +0200
commit8ab2b19a946251f258446d22f420d401f61d22f6 (patch)
tree39fb674f135fd1cfcf4de5b319913f0d0c17d11a /internal/ap/properties.go
parent[docs] Add separate migration section + instructions for moving to GtS and no... (diff)
downloadgotosocial-8ab2b19a946251f258446d22f420d401f61d22f6.tar.xz
[feature] Federate interaction policies + Accepts; enforce policies (#3138)
* [feature] Federate interaction policies + Accepts; enforce policies * use Acceptable type * fix index * remove appendIRIStrs * add GetAccept federatingdb function * lock on object IRI
Diffstat (limited to 'internal/ap/properties.go')
-rw-r--r--internal/ap/properties.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/ap/properties.go b/internal/ap/properties.go
index 1bd8c303e..38e58ebc0 100644
--- a/internal/ap/properties.go
+++ b/internal/ap/properties.go
@@ -520,6 +520,27 @@ func SetManuallyApprovesFollowers(with WithManuallyApprovesFollowers, manuallyAp
mafProp.Set(manuallyApprovesFollowers)
}
+// GetApprovedBy returns the URL contained in
+// the ApprovedBy property of 'with', if set.
+func GetApprovedBy(with WithApprovedBy) *url.URL {
+ mafProp := with.GetGoToSocialApprovedBy()
+ if mafProp == nil || !mafProp.IsIRI() {
+ return nil
+ }
+ return mafProp.Get()
+}
+
+// SetApprovedBy sets the given url
+// on the ApprovedBy property of 'with'.
+func SetApprovedBy(with WithApprovedBy, approvedBy *url.URL) {
+ abProp := with.GetGoToSocialApprovedBy()
+ if abProp == nil {
+ abProp = streams.NewGoToSocialApprovedByProperty()
+ with.SetGoToSocialApprovedBy(abProp)
+ }
+ abProp.Set(approvedBy)
+}
+
// extractIRIs extracts just the AP IRIs from an iterable
// property that may contain types (with IRIs) or just IRIs.
//