mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 15:42:24 -05:00
[feature] tentatively start adding polls support (#2249)
This commit is contained in:
parent
297b6eeaaa
commit
c6e00afc7c
36 changed files with 657 additions and 393 deletions
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/ap"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtscontext"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||
)
|
||||
|
|
@ -48,31 +49,31 @@ func (f *federatingDB) Undo(ctx context.Context, undo vocab.ActivityStreamsUndo)
|
|||
return nil // Already processed.
|
||||
}
|
||||
|
||||
undoObject := undo.GetActivityStreamsObject()
|
||||
if undoObject == nil {
|
||||
return errors.New("UNDO: no object set on vocab.ActivityStreamsUndo")
|
||||
}
|
||||
var errs gtserror.MultiError
|
||||
|
||||
for iter := undoObject.Begin(); iter != undoObject.End(); iter = iter.Next() {
|
||||
t := iter.GetType()
|
||||
if t == nil {
|
||||
for _, object := range ap.ExtractObjects(undo) {
|
||||
// Try to get object as vocab.Type,
|
||||
// else skip handling (likely) IRI.
|
||||
objType := object.GetType()
|
||||
if objType == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
switch t.GetTypeName() {
|
||||
switch objType.GetTypeName() {
|
||||
case ap.ActivityFollow:
|
||||
if err := f.undoFollow(ctx, receivingAccount, undo, t); err != nil {
|
||||
return err
|
||||
if err := f.undoFollow(ctx, receivingAccount, undo, objType); err != nil {
|
||||
errs.Appendf("error undoing follow: %w", err)
|
||||
}
|
||||
case ap.ActivityLike:
|
||||
if err := f.undoLike(ctx, receivingAccount, undo, t); err != nil {
|
||||
return err
|
||||
if err := f.undoLike(ctx, receivingAccount, undo, objType); err != nil {
|
||||
errs.Appendf("error undoing like: %w", err)
|
||||
}
|
||||
case ap.ActivityAnnounce:
|
||||
// todo: undo boost / reblog / announce
|
||||
// TODO: actually handle this !
|
||||
log.Warn(ctx, "skipped undo announce")
|
||||
case ap.ActivityBlock:
|
||||
if err := f.undoBlock(ctx, receivingAccount, undo, t); err != nil {
|
||||
return err
|
||||
if err := f.undoBlock(ctx, receivingAccount, undo, objType); err != nil {
|
||||
errs.Appendf("error undoing block: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue