Skip to content

Commit

Permalink
fix maintenance description (#102)
Browse files Browse the repository at this point in the history
fix maintenance description

When a maintenance didn't have a description, it could lead to Internal Server Error. This fixes the issue.

Reviewed-by: Vladimir Hasko <[email protected]>
  • Loading branch information
OlhaKashyrina authored Feb 8, 2024
1 parent fa3bf67 commit e3c9fd5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/web/templates/incident.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ <h4><i class="bi sd-{{ config['INCIDENT_IMPACTS'][incident.impact].key }}"></i>
{{ incident.text }}</h4>
{% if incident.impact == 0 %}
<p class="indent">
{{ (incident.updates | selectattr('status', 'equalto', 'description') | first).text }}
{% set desc = incident.updates
| selectattr('status', 'equalto', 'description')
| first
| default(None) %}
{% if desc %}
{{ desc.text }}
{% endif %}
{% block add_message %}
{% include 'message.html' ignore missing %}
{% endblock %}
Expand Down
8 changes: 7 additions & 1 deletion app/web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ <h4 class="alert-heading">
href="incidents/{{incident.id}}"> {{ incident.text }}</a>
</h4>
<p class="indent">
{{ (incident.updates | selectattr('status', 'equalto', 'description') | first).text }}
{% set desc = incident.updates
| selectattr('status', 'equalto', 'description')
| first
| default(None) %}
{% if desc %}
{{ desc.text }}
{% endif %}
{% block add_message %}
{% include 'message.html' ignore missing %}
{% endblock %}
Expand Down

0 comments on commit e3c9fd5

Please sign in to comment.