summaryrefslogtreecommitdiff
path: root/internal/ap
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-02-27 13:22:05 +0100
committerLibravatar GitHub <noreply@github.com>2024-02-27 12:22:05 +0000
commit9cadc764b389df970c767608e7a061f3bd777dfa (patch)
treee49218fff3af5800b5305720a04a4f74e7b5c2cb /internal/ap
parent[chore]: Bump github.com/tdewolff/minify/v2 from 2.20.17 to 2.20.18 (#2689) (diff)
downloadgotosocial-9cadc764b389df970c767608e7a061f3bd777dfa.tar.xz
[feature] Add experimental `instance-federation-spam-filter` option (#2685)
* [chore] Move `visibility` to `filter/visibility` * [feature] Add experimental instance-federation-spam-filter option
Diffstat (limited to 'internal/ap')
-rw-r--r--internal/ap/extract.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/internal/ap/extract.go b/internal/ap/extract.go
index 2b49c6477..d9288c162 100644
--- a/internal/ap/extract.go
+++ b/internal/ap/extract.go
@@ -33,6 +33,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/text"
+ "github.com/superseriousbusiness/gotosocial/internal/util"
)
// ExtractObjects will extract object vocab.Types from given implementing interface.
@@ -776,11 +777,21 @@ func extractHashtag(i Hashtaggable) (*gtsmodel.Tag, error) {
}
tagName := strings.TrimPrefix(name, "#")
- yeah := func() *bool { t := true; return &t }
+ // Extract href for the tag, if set.
+ //
+ // Fine if not, it's only used for spam
+ // checking anyway so not critical.
+ var href string
+ hrefProp := i.GetActivityStreamsHref()
+ if hrefProp != nil && hrefProp.IsIRI() {
+ href = hrefProp.GetIRI().String()
+ }
+
return &gtsmodel.Tag{
Name: tagName,
- Useable: yeah(), // Assume true by default.
- Listable: yeah(), // Assume true by default.
+ Useable: util.Ptr(true), // Assume true by default.
+ Listable: util.Ptr(true), // Assume true by default.
+ Href: href,
}, nil
}