Merge pull request #220 from writeas/support-notes

Support ActivityPub Notes
pull/390/merge
Matt Baer 4 years ago committed by GitHub
commit 4f32af2d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      config/config.go
  2. 7
      posts.go

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

@ -1131,7 +1131,12 @@ func (p *PublicPost) CanonicalURL(hostName string) string {
func (p *PublicPost) ActivityObject(app *App) *activitystreams.Object {
cfg := app.cfg
o := activitystreams.NewArticleObject()
var o *activitystreams.Object
if cfg.App.NotesOnly || strings.Index(p.Content, "\n\n") == -1 {
o = activitystreams.NewNoteObject()
} else {
o = activitystreams.NewArticleObject()
}
o.ID = p.Collection.FederatedAPIBase() + "api/posts/" + p.ID
o.Published = p.Created
o.URL = p.CanonicalURL(cfg.App.Host)

Loading…
Cancel
Save