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: show attached to User, Project and Organization #261

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions readthedocsext/theme/templates/includes/utils/messages.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@
page content pane.
{% endcomment %}

{% comment %}
``user_notifications`` comes from a Context Processor.
We need to use a CustomUser to have access to "user.notifications"
See https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-AUTH_USER_MODEL
{% endcomment %}
{% if user_notifications %}
{% for notification in user_notifications %}
<div class="ui message">
{% comment %}
Add this Xmark here once we implement dismissing notifications.
<i class="fa-duotone fa-circle-xmark close icon"></i>
{% endcomment %}
{{ notification.get_message.get_rendered_body|safe }}
</div>
{% endfor %}
{% endif %}

{% if messages %}
{% for message in messages %}
{% comment %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,13 @@
</div>
{% endblock organization_header_navigation %}

{# Render all the notifications attached to the organization.#}
{% for notification in organization.notifications.all %}
<div class="ui message">
<i class="fa-solid {{ notification.get_message.get_display_icon_classes }}"></i>
humitos marked this conversation as resolved.
Show resolved Hide resolved
<span>{{ notification.get_message.get_rendered_body|safe }}</span>
</div>
{% endfor %}


{% endblock organization_header %}
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,12 @@
</div>
{% endblock project_header_navigation %}

{# Render all the notifications attached to the project.#}
{% for notification in project.notifications.all %}
<div class="ui message">
<i class="fa-solid {{ notification.get_message.get_display_icon_classes }}"></i>
<span>{{ notification.get_message.get_rendered_body|safe }}</span>
</div>
{% endfor %}

{% endblock project_header %}