Do not throw an exception during rendering of log detail page, if element has no time travel URL

This commit is contained in:
Jan Böhmer 2023-06-06 23:15:14 +02:00
parent e68827bf3b
commit efc152e3c8
3 changed files with 18 additions and 5 deletions

View file

@ -32,10 +32,13 @@
<i class="fas fa-fw fa-backward" title="{% trans %}log.undo.revert{% endtrans %}"></i> {{ 'log.undo.revert.short' | trans }}
</button>
{% set url = timetravel_url(target_element, entry.timestamp) %}
{# View button #}
{% if target_element and ((attribute(entry, 'oldDataInformation') is defined and entry.oldDataInformation)
or entry is instanceof('App\\Entity\\LogSystem\\CollectionElementDeleted')) %}
<a class="btn btn-outline-secondary" href="{{ timetravel_url(target_element, entry.timestamp)}}"><i class="fas fa-fw fa-eye"></i>
or entry is instanceof('App\\Entity\\LogSystem\\CollectionElementDeleted'))
and url is not null %}
<a class="btn btn-outline-secondary" href="{{ url }}"><i class="fas fa-fw fa-eye"></i>
{% trans %}log.view_version{% endtrans %}
</a>
{% endif %}