-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add num_annotations
to js-config
group context
#8939
Conversation
num_annotations
to js-config
group context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a question about the naming of a parameter (or the need for it in the first place) but this look good 👍
|
||
This counts all of the group's annotations and replies from all users. | ||
|
||
If `unshared=True` then "Only Me" annotations and replies in the group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had trouble passing this parameter meaning.
It might be clearer with a more verbose name? include_only_me
? Not sure
@@ -58,6 +59,9 @@ def _js_config(self): | |||
"link": self.request.route_url( | |||
"group_read", pubid=group.pubid, slug=group.slug | |||
), | |||
"num_annotations": self.annotation_stats_service.total_group_annotation_count( | |||
group.pubid, unshared=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is unshared always going to be False? Or are you thinking ahead of an immediate need for other type of group?
@@ -58,6 +59,9 @@ def _js_config(self): | |||
"link": self.request.route_url( | |||
"group_read", pubid=group.pubid, slug=group.slug | |||
), | |||
"num_annotations": self.annotation_stats_service.total_group_annotation_count( | |||
group.pubid, unshared=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is unshared always going to be False? Or are you thinking ahead of an immediate need for other type of group?
@@ -193,6 +193,20 @@ def __call__(self, search, params): | |||
) | |||
|
|||
|
|||
class SharedAnnotationsFilter: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm always caught by surprise about how this API works, with these callable classes to represent different filters.
🤷 Anyway this fits in the overall current design.
4da3419
to
ffe4796
Compare
998570d
to
d71a933
Compare
The frontend is going to need this in order to show a warning dialog when changing the type of a group: the warning only needs to be shown of there are shared annotations in the group. Also, the warning needs to include the number of annotations in the text. See #8898.
Testing
"num_annotations"
in thejs-config
in the HTML. You should see"num_annotations: 0"
"num_annotations": 1
"num_annotations": 2
"num_annotations"
should not change"num_annotations"
should decrease"num_annotations"
should increase