mirror of
https://github.com/writeas/writefreely
synced 2025-02-01 00:36:53 +01:00
Merge pull request #220 from writeas/support-notes
Support ActivityPub Notes
This commit is contained in:
commit
4f32af2d7f
@ -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"`
|
||||
|
7
posts.go
7
posts.go
@ -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…
x
Reference in New Issue
Block a user