address activitypub notes to the streamer's follower collection (#4314)
* make a new function to generate appropriate to and cc apub objects * use new addressing function to set "public" message addressing appropriately with the followers collection * early return from sending federated message if federation is disabled * cleanup old addressing code, apply new addressing mechanism to live notifications as well * linter fix * Update activitypub/outbox/outbox.go --------- Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
co-authored by
Gabe Kangas
parent
6d97def04a
commit
c9a69b281c
@@ -31,6 +31,20 @@ func MakeNotePublic(note vocab.ActivityStreamsNote) vocab.ActivityStreamsNote {
|
||||
return note
|
||||
}
|
||||
|
||||
func MakeAddressingToFollowers(followers_iri *url.URL, public bool) (vocab.ActivityStreamsToProperty, vocab.ActivityStreamsCcProperty) {
|
||||
to := streams.NewActivityStreamsToProperty()
|
||||
cc := streams.NewActivityStreamsCcProperty()
|
||||
|
||||
if public {
|
||||
public, _ := url.Parse(PUBLIC)
|
||||
to.AppendIRI(public)
|
||||
cc.AppendIRI(followers_iri)
|
||||
} else {
|
||||
to.AppendIRI(followers_iri)
|
||||
}
|
||||
return to, cc
|
||||
}
|
||||
|
||||
// MakeNoteDirect sets the required properties to make this note seen as a
|
||||
// direct message.
|
||||
func MakeNoteDirect(note vocab.ActivityStreamsNote, toIRI *url.URL) vocab.ActivityStreamsNote {
|
||||
|
||||
Reference in New Issue
Block a user