Accept in-reply-to, like-of, and repost-of at the micropub endpoint - currently they override each other, in the order I specified, but I think that's probably okay?

This commit is contained in:
Danielle McLean 2017-11-13 15:55:34 +11:00
parent b446c7072c
commit f3bb90fffd
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5

View file

@ -8,7 +8,7 @@ from urllib.parse import urljoin
from entries.jobs import ping_hub, send_mentions from entries.jobs import ping_hub, send_mentions
from entries.models import Entry from entries.models import Entry
from entries.kinds import Article, Note from entries.kinds import Article, Note, Reply, Like, Repost
from lemoncurry import utils from lemoncurry import utils
from lemonauth import tokens from lemonauth import tokens
@ -35,6 +35,15 @@ class MicropubView(View):
kind = Article kind = Article
if 'content' in post: if 'content' in post:
entry.content = post['content'] entry.content = post['content']
if 'in-reply-to' in post:
entry.cite = post['in-reply-to']
kind = Reply
if 'like-of' in post:
entry.cite = post['like-of']
kind = Like
if 'repost-of' in post:
entry.cite = post['repost-of']
kind = Repost
entry.kind = kind.id entry.kind = kind.id
entry.save() entry.save()