summaryrefslogtreecommitdiff
path: root/internal/ap/extract.go
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@protonmail.com>2022-01-09 18:41:22 +0100
committerLibravatar tsmethurst <tobi.smethurst@protonmail.com>2022-01-09 18:41:22 +0100
commitdccf21dd87638320a687a0556c973cced541c945 (patch)
tree03dd737e3d44bdad52b6a2ac2f1e78ec876d2ba1 /internal/ap/extract.go
parentcompiling now (diff)
downloadgotosocial-dccf21dd87638320a687a0556c973cced541c945.tar.xz
tests are passing, but there's still much to be done
Diffstat (limited to 'internal/ap/extract.go')
-rw-r--r--internal/ap/extract.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/ap/extract.go b/internal/ap/extract.go
index ed61faf1e..49dac7186 100644
--- a/internal/ap/extract.go
+++ b/internal/ap/extract.go
@@ -395,20 +395,20 @@ func ExtractAttachment(i Attachmentable) (*gtsmodel.MediaAttachment, error) {
attachment.Description = name
}
+ attachment.Blurhash = ExtractBlurhash(i)
+
attachment.Processing = gtsmodel.ProcessingStatusReceived
return attachment, nil
}
-// func extractBlurhash(i withBlurhash) (string, error) {
-// if i.GetTootBlurhashProperty() == nil {
-// return "", errors.New("blurhash property was nil")
-// }
-// if i.GetTootBlurhashProperty().Get() == "" {
-// return "", errors.New("empty blurhash string")
-// }
-// return i.GetTootBlurhashProperty().Get(), nil
-// }
+// ExtractBlurhash extracts the blurhash value (if present) from a WithBlurhash interface.
+func ExtractBlurhash(i WithBlurhash) string {
+ if i.GetTootBlurhash() == nil {
+ return ""
+ }
+ return i.GetTootBlurhash().Get()
+}
// ExtractHashtags returns a slice of tags on the interface.
func ExtractHashtags(i WithTag) ([]*gtsmodel.Tag, error) {