summaryrefslogtreecommitdiff
path: root/internal/processing/media/create.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/processing/media/create.go
parentcompiling now (diff)
downloadgotosocial-dccf21dd87638320a687a0556c973cced541c945.tar.xz
tests are passing, but there's still much to be done
Diffstat (limited to 'internal/processing/media/create.go')
-rw-r--r--internal/processing/media/create.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/processing/media/create.go b/internal/processing/media/create.go
index d1840196a..093a3d2be 100644
--- a/internal/processing/media/create.go
+++ b/internal/processing/media/create.go
@@ -27,6 +27,7 @@ import (
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
+ "github.com/superseriousbusiness/gotosocial/internal/media"
)
func (p *processor) Create(ctx context.Context, account *gtsmodel.Account, form *apimodel.AttachmentRequest) (*apimodel.Attachment, error) {
@@ -44,8 +45,17 @@ func (p *processor) Create(ctx context.Context, account *gtsmodel.Account, form
return nil, errors.New("could not read provided attachment: size 0 bytes")
}
+ focusX, focusY, err := parseFocus(form.Focus)
+ if err != nil {
+ return nil, fmt.Errorf("could not parse focus value %s: %s", form.Focus, err)
+ }
+
// process the media attachment and load it immediately
- media, err := p.mediaManager.ProcessMedia(ctx, buf.Bytes(), account.ID, "")
+ media, err := p.mediaManager.ProcessMedia(ctx, buf.Bytes(), account.ID, &media.AdditionalInfo{
+ Description: &form.Description,
+ FocusX: &focusX,
+ FocusY: &focusY,
+ })
if err != nil {
return nil, err
}