filter published for layouts, unset publishedAt

This commit is contained in:
tonyrewin 2022-11-13 18:35:43 +03:00
parent 941f8cdd71
commit 8c880ff9ea
2 changed files with 7 additions and 6 deletions

View File

@ -125,6 +125,8 @@ def set_published(session, slug, publisher):
def set_hidden(session, slug):
s = session.query(Shout).where(Shout.slug == slug).first()
s.visibility = 'authors'
s.publishedAt = None # TODO: discuss
s.publishedBy = None # TODO: store changes history in git
session.add(s)
session.commit()
@ -134,8 +136,6 @@ def set_hidden(session, slug):
async def create_reaction(_, info, inp):
user = info.context["request"].user
# TODO: filter allowed for post reaction kinds
with local_session() as session:
reaction = Reaction.create(**inp)
session.add(reaction)

View File

@ -136,10 +136,11 @@ async def shouts_by_layout(param, info, layout, amount=100, offset=0):
# for layout in ['image', 'audio', 'video', 'literature']:
shouts_by_layout = list(ShoutsCache.by_layout.get(layout, []))
for s in shouts_by_layout:
for a in s.authors:
a.caption = await ShoutAuthorStorage.get_author_caption(s.slug, a.slug)
# if bool(s.publishedAt):
shouts[s.slug] = s
if s.visibility == 'public': # if bool(s.publishedAt):
shouts[s.slug] = s
for a in s.authors:
a.caption = await ShoutAuthorStorage.get_author_caption(s.slug, a.slug)
shouts_prepared = list(shouts.values())
# TODO: pick keyfunc according to kind of query