summaryrefslogtreecommitdiff
path: root/internal/typeutils/wrap.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-11-27 14:14:28 +0100
committerLibravatar GitHub <noreply@github.com>2023-11-27 13:14:28 +0000
commite4e0a5e3f66f38e17a8abdafbeac251c75323b0e (patch)
tree6dc6211acd78df9fa3b933f19ab3275c187a5106 /internal/typeutils/wrap.go
parent[chore]: Bump golang.org/x/net from 0.17.0 to 0.18.0 (#2390) (diff)
downloadgotosocial-e4e0a5e3f66f38e17a8abdafbeac251c75323b0e.tar.xz
[bugfix] Add Actor to outgoing poll vote Create; other fixes (#2384)
Diffstat (limited to 'internal/typeutils/wrap.go')
-rw-r--r--internal/typeutils/wrap.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/internal/typeutils/wrap.go b/internal/typeutils/wrap.go
index 5deca0e5b..5892e0a66 100644
--- a/internal/typeutils/wrap.go
+++ b/internal/typeutils/wrap.go
@@ -19,7 +19,6 @@ package typeutils
import (
"net/url"
- "time"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams"
@@ -91,43 +90,6 @@ func WrapStatusableInCreate(status ap.Statusable, iriOnly bool) vocab.ActivitySt
return create
}
-func WrapPollOptionablesInCreate(options ...ap.PollOptionable) vocab.ActivityStreamsCreate {
- if len(options) == 0 {
- panic("no options")
- }
-
- // Extract attributedTo IRI from any option.
- attribTos := ap.GetAttributedTo(options[0])
- if len(attribTos) != 1 {
- panic("invalid attributedTo count")
- }
-
- // Extract target status IRI from any option.
- replyTos := ap.GetInReplyTo(options[0])
- if len(replyTos) != 1 {
- panic("invalid inReplyTo count")
- }
-
- // Allocate create activity and copy over 'To' property.
- create := streams.NewActivityStreamsCreate()
- ap.AppendTo(create, ap.GetTo(options[0])...)
-
- // Activity ID formatted as: {$statusIRI}/activity#vote/{$voterIRI}.
- id := replyTos[0].String() + "/activity#vote/" + attribTos[0].String()
- ap.MustSet(ap.SetJSONLDIdStr, ap.WithJSONLDId(create), id)
-
- // Set a current publish time for activity.
- ap.SetPublished(create, time.Now())
-
- // Append each poll option as object to activity.
- for _, option := range options {
- status, _ := ap.ToStatusable(option)
- appendStatusableToActivity(create, status, false)
- }
-
- return create
-}
-
func WrapStatusableInUpdate(status ap.Statusable, iriOnly bool) vocab.ActivityStreamsUpdate {
update := streams.NewActivityStreamsUpdate()
wrapStatusableInActivity(update, status, iriOnly)