Skip to content
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

Notifications: filter out cancelled and dismissed from templates #11082

Closed
humitos opened this issue Jan 31, 2024 · 0 comments · Fixed by #11117
Closed

Notifications: filter out cancelled and dismissed from templates #11082

humitos opened this issue Jan 31, 2024 · 0 comments · Fixed by #11117
Assignees

Comments

@humitos
Copy link
Member

humitos commented Jan 31, 2024

We are always displaying all notifications to users, but we should only show not cancelled or dismissed:

{% for notification in project.notifications.all %}
<p class="build-failure">
{{ notification.get_message.get_rendered_body|safe }}
</p>
{% endfor %}

We should probably create a QuerySet method for this called display or show so we call as project.notifications.display().

@humitos humitos self-assigned this Jan 31, 2024
humitos added a commit that referenced this issue Feb 14, 2024
Expand `.for_user()` to accept `resource=` parameter and return only the
notifications attached to that resource only if the user has permissions over
it. Otherwise, return an empty queryset.

Closes #11082
Related #11113
humitos added a commit that referenced this issue Feb 19, 2024
* Notifications: show them based on permissions

Expand `.for_user()` to accept `resource=` parameter and return only the
notifications attached to that resource only if the user has permissions over
it. Otherwise, return an empty queryset.

Closes #11082
Related #11113

* Minor docstring change

* Keep APIv3 behavior

* Fix tests

* Make the `resource=` argument required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
1 participant