Example Visibility server side filtering
This commit is contained in:
parent
2ead4f221b
commit
2ad89ce6ef
|
|
@ -0,0 +1,19 @@
|
|||
query ContentBlockQuery {
|
||||
chapters {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
slug
|
||||
contentBlocks(userGroups: ["EE18B"]) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
title
|
||||
slug
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -150,7 +150,8 @@ class AddContentBlock(relay.ClientIDMutation):
|
|||
try:
|
||||
parent = args.get('parent', None)
|
||||
after = args.get('after', None)
|
||||
new_content_block = cls.create_content_block(content_block_data=args.get('content_block'), parent=parent,
|
||||
new_content_block = cls.create_content_block(content_block_data=args.get('content_block'),
|
||||
parent=parent,
|
||||
after=after)
|
||||
|
||||
return cls(new_content_block=new_content_block)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class FilteredChapterNode(DjangoObjectType):
|
|||
reduced = []
|
||||
for user_group in user_groups:
|
||||
content_blocks = ContentBlock.get_by_parent(self).exclude(
|
||||
Q(visibility__user_group__name=user_group)
|
||||
Q(visible_to__user_group__name=user_group)
|
||||
)
|
||||
reduced = chain(reduced, content_blocks)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue