mirror of
https://github.com/writefreely/writefreely
synced 2025-02-17 16:28:23 +00:00
Federate posts without a double-line break as Notes
This proof-of-concept sends out posts that don't include a double-line break as Notes -- otherwise they go out as Articles, as before. Inspired by the discussion here: https://socialhub.activitypub.rocks/t/resolving-the-note-vs-article-distinction/258
This commit is contained in:
parent
bd99044e9c
commit
5259c4fcdf
1 changed files with 6 additions and 1 deletions
7
posts.go
7
posts.go
|
@ -1126,7 +1126,12 @@ func (p *PublicPost) CanonicalURL(hostName string) string {
|
|||
}
|
||||
|
||||
func (p *PublicPost) ActivityObject(cfg *config.Config) *activitystreams.Object {
|
||||
o := activitystreams.NewArticleObject()
|
||||
var o *activitystreams.Object
|
||||
if 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…
Add table
Reference in a new issue