Support only federating Notes

When setting `notes_only = true` in the `[app]` configuration section, WF will only send out `Note` objects. Otherwise, it will send out both `Note`s and `Article`s.
pull/220/head
Matt Baer 4 years ago
parent 8be71481c8
commit f821ead3a1
  1. 1
      config/config.go
  2. 2
      posts.go

@ -140,6 +140,7 @@ type (
// Federation // Federation
Federation bool `ini:"federation"` Federation bool `ini:"federation"`
PublicStats bool `ini:"public_stats"` PublicStats bool `ini:"public_stats"`
NotesOnly bool `ini:"notes_only"`
// Access // Access
Private bool `ini:"private"` Private bool `ini:"private"`

@ -1133,7 +1133,7 @@ func (p *PublicPost) CanonicalURL(hostName string) string {
func (p *PublicPost) ActivityObject(app *App) *activitystreams.Object { func (p *PublicPost) ActivityObject(app *App) *activitystreams.Object {
cfg := app.cfg cfg := app.cfg
var o *activitystreams.Object var o *activitystreams.Object
if strings.Index(p.Content, "\n\n") == -1 { if cfg.App.NotesOnly || strings.Index(p.Content, "\n\n") == -1 {
o = activitystreams.NewNoteObject() o = activitystreams.NewNoteObject()
} else { } else {
o = activitystreams.NewArticleObject() o = activitystreams.NewArticleObject()

Loading…
Cancel
Save