server/posts: make anon snapshots for anon uploads

This commit is contained in:
rr- 2016-08-22 20:07:39 +02:00
parent 61d084cc66
commit 73a8542220

View file

@ -46,7 +46,7 @@ def create_post(ctx, _params=None):
auth.verify_privilege(ctx.user, 'tags:create') auth.verify_privilege(ctx.user, 'tags:create')
db.session.flush() db.session.flush()
for tag in new_tags: for tag in new_tags:
snapshots.create(tag, ctx.user) snapshots.create(tag, None if anonymous else ctx.user)
posts.update_post_safety(post, safety) posts.update_post_safety(post, safety)
posts.update_post_source(post, source) posts.update_post_source(post, source)
posts.update_post_relations(post, relations) posts.update_post_relations(post, relations)
@ -55,7 +55,7 @@ def create_post(ctx, _params=None):
if ctx.has_file('thumbnail'): if ctx.has_file('thumbnail'):
posts.update_post_thumbnail(post, ctx.get_file('thumbnail')) posts.update_post_thumbnail(post, ctx.get_file('thumbnail'))
ctx.session.add(post) ctx.session.add(post)
snapshots.create(post, ctx.user) snapshots.create(post, None if anonymous else ctx.user)
ctx.session.commit() ctx.session.commit()
tags.export_to_json() tags.export_to_json()
return _serialize_post(ctx, post) return _serialize_post(ctx, post)