(app *App, p *PublicPost, collID int64)
| 803 | } |
| 804 | |
| 805 | func deleteFederatedPost(app *App, p *PublicPost, collID int64) error { |
| 806 | if debugging { |
| 807 | log.Info("Deleting federated post!") |
| 808 | } |
| 809 | p.Collection.hostName = app.cfg.App.Host |
| 810 | actor := p.Collection.PersonObject(collID) |
| 811 | na := p.ActivityObject(app) |
| 812 | |
| 813 | // Add followers |
| 814 | p.Collection.ID = collID |
| 815 | followers, err := app.db.GetAPFollowers(&p.Collection.Collection) |
| 816 | if err != nil { |
| 817 | log.Error("Couldn't delete post (get followers)! %v", err) |
| 818 | return err |
| 819 | } |
| 820 | |
| 821 | inboxes := map[string][]string{} |
| 822 | for _, f := range *followers { |
| 823 | inbox := f.SharedInbox |
| 824 | if inbox == "" { |
| 825 | inbox = f.Inbox |
| 826 | } |
| 827 | if _, ok := inboxes[inbox]; ok { |
| 828 | inboxes[inbox] = append(inboxes[inbox], f.ActorID) |
| 829 | } else { |
| 830 | inboxes[inbox] = []string{f.ActorID} |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | for si, instFolls := range inboxes { |
| 835 | na.CC = []string{} |
| 836 | na.CC = append(na.CC, instFolls...) |
| 837 | da := activitystreams.NewDeleteActivity(na) |
| 838 | // Make the ID unique to ensure it works in Pleroma |
| 839 | // See: https://git.pleroma.social/pleroma/pleroma/issues/1481 |
| 840 | da.ID += "#Delete" |
| 841 | |
| 842 | err = makeActivityPost(app.cfg.App.Host, actor, si, da) |
| 843 | if err != nil { |
| 844 | log.Error("Couldn't delete post! %v", err) |
| 845 | } |
| 846 | } |
| 847 | return nil |
| 848 | } |
| 849 | |
| 850 | func federatePost(app *App, p *PublicPost, collID int64, isUpdate bool) error { |
| 851 | // If app is private, do not federate |
no test coverage detected