MCPcopy Create free account
hub / github.com/davecheney/pub / processAddPin

Method processAddPin

activitypub/inbox.go:180–211  ·  view source on GitHub ↗
(act map[string]any)

Source from the content-addressed store, hash-verified

178 if updatedAt.IsZero() {
179 updatedAt = publishedAt
180 }
181
182 status := &models.Status{
183 ID: snowflake.TimeToID(publishedAt),
184 UpdatedAt: updatedAt,
185 ActorID: actor.ID,
186 Actor: actor,
187 Conversation: &models.Conversation{
188 Visibility: "public",
189 },
190 URI: act.ID,
191 Visibility: "public",
192 ReblogID: &original.ID,
193 }
194
195 return i.db.Save(status).Error
196}
197
198func (i *inboxProcessor) processAdd(act *Activity) error {
199 switch obj := act.Object.(type) {
200 case string:
201 return i.processAddPin(act)
202 default:
203 return fmt.Errorf("processAdd: unknown type: %T", obj)
204 }
205}
206
207func (i *inboxProcessor) processAddPin(act *Activity) error {
208 actor := stringFromAny(act.Actor)
209 switch act.Target {
210 case actor + "/collections/featured":
211 status, err := models.NewStatuses(i.db).FindByURI(stringFromAny(act.Object))
212 if err != nil {
213 return err
214 }

Callers 1

processAddMethod · 0.95

Calls 5

NewStatusesFunction · 0.92
NewActorsFunction · 0.92
NewReactionsFunction · 0.92
PinMethod · 0.80
FindByURIMethod · 0.45

Tested by

no test coverage detected