mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-24 01:13:32 -06:00
tests are passing, but there's still much to be done
This commit is contained in:
parent
f61c3ddcf7
commit
dccf21dd87
18 changed files with 259 additions and 170 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ func (suite *ExtractAttachmentsTestSuite) TestExtractAttachments() {
|
|||
suite.Equal("image/jpeg", attachment1.File.ContentType)
|
||||
suite.Equal("https://s3-us-west-2.amazonaws.com/plushcity/media_attachments/files/106/867/380/219/163/828/original/88e8758c5f011439.jpg", attachment1.RemoteURL)
|
||||
suite.Equal("It's a cute plushie.", attachment1.Description)
|
||||
suite.Empty(attachment1.Blurhash) // atm we discard blurhashes and generate them ourselves during processing
|
||||
suite.Equal("UxQ0EkRP_4tRxtRjWBt7%hozM_ayV@oLf6WB", attachment1.Blurhash)
|
||||
}
|
||||
|
||||
func (suite *ExtractAttachmentsTestSuite) TestExtractNoAttachments() {
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ type Attachmentable interface {
|
|||
WithMediaType
|
||||
WithURL
|
||||
WithName
|
||||
WithBlurhash
|
||||
}
|
||||
|
||||
// Hashtaggable represents the minimum activitypub interface for representing a 'hashtag' tag.
|
||||
|
|
@ -284,9 +285,10 @@ type WithMediaType interface {
|
|||
GetActivityStreamsMediaType() vocab.ActivityStreamsMediaTypeProperty
|
||||
}
|
||||
|
||||
// type withBlurhash interface {
|
||||
// GetTootBlurhashProperty() vocab.TootBlurhashProperty
|
||||
// }
|
||||
// WithBlurhash represents an activity with TootBlurhashProperty
|
||||
type WithBlurhash interface {
|
||||
GetTootBlurhash() vocab.TootBlurhashProperty
|
||||
}
|
||||
|
||||
// type withFocalPoint interface {
|
||||
// // TODO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue