|
|
@ -589,18 +589,25 @@ func federatePost(app *App, p *PublicPost, collID int64, isUpdate bool) error { |
|
|
|
inbox = f.Inbox |
|
|
|
inbox = f.Inbox |
|
|
|
} |
|
|
|
} |
|
|
|
if _, ok := inboxes[inbox]; ok { |
|
|
|
if _, ok := inboxes[inbox]; ok { |
|
|
|
|
|
|
|
// check if we're already sending to this shared inbox
|
|
|
|
inboxes[inbox] = append(inboxes[inbox], f.ActorID) |
|
|
|
inboxes[inbox] = append(inboxes[inbox], f.ActorID) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
// add the new shared inbox to the list
|
|
|
|
inboxes[inbox] = []string{f.ActorID} |
|
|
|
inboxes[inbox] = []string{f.ActorID} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var activity *activitystreams.Activity |
|
|
|
var activity *activitystreams.Activity |
|
|
|
|
|
|
|
// for each one of the shared inboxes
|
|
|
|
for si, instFolls := range inboxes { |
|
|
|
for si, instFolls := range inboxes { |
|
|
|
|
|
|
|
// add all followers from that instance
|
|
|
|
|
|
|
|
// to the CC field
|
|
|
|
na.CC = []string{} |
|
|
|
na.CC = []string{} |
|
|
|
for _, f := range instFolls { |
|
|
|
for _, f := range instFolls { |
|
|
|
na.CC = append(na.CC, f) |
|
|
|
na.CC = append(na.CC, f) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// create a new "Create" activity
|
|
|
|
|
|
|
|
// with our article as object
|
|
|
|
if isUpdate { |
|
|
|
if isUpdate { |
|
|
|
activity = activitystreams.NewUpdateActivity(na) |
|
|
|
activity = activitystreams.NewUpdateActivity(na) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -608,12 +615,19 @@ func federatePost(app *App, p *PublicPost, collID int64, isUpdate bool) error { |
|
|
|
activity.To = na.To |
|
|
|
activity.To = na.To |
|
|
|
activity.CC = na.CC |
|
|
|
activity.CC = na.CC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// and post it to that sharedInbox
|
|
|
|
err = makeActivityPost(app.cfg.App.Host, actor, si, activity) |
|
|
|
err = makeActivityPost(app.cfg.App.Host, actor, si, activity) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("Couldn't post! %v", err) |
|
|
|
log.Error("Couldn't post! %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// re-create the object so that the CC list gets reset and has
|
|
|
|
|
|
|
|
// the mentioned users. This might seem wasteful but the code is
|
|
|
|
|
|
|
|
// cleaner than adding the mentioned users to CC here instead of
|
|
|
|
|
|
|
|
// in p.ActivityObject()
|
|
|
|
|
|
|
|
na = p.ActivityObject(app.cfg) |
|
|
|
|
|
|
|
|
|
|
|
for _, tag := range na.Tag { |
|
|
|
for _, tag := range na.Tag { |
|
|
|
if tag.Type == "Mention" { |
|
|
|
if tag.Type == "Mention" { |
|
|
|
activity = activitystreams.NewCreateActivity(na) |
|
|
|
activity = activitystreams.NewCreateActivity(na) |
|
|
@ -632,6 +646,8 @@ func federatePost(app *App, p *PublicPost, collID int64, isUpdate bool) error { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("Couldn't post! %v", err) |
|
|
|
log.Error("Couldn't post! %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// log.Info("Activity", activity)
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|