Handle situation when task creator or modifier is not present [SCI-4503]

This commit is contained in:
Oleksii Kriuchykhin 2020-04-23 12:40:27 +02:00
parent 608ee23ec4
commit 06b6907d13
2 changed files with 10 additions and 4 deletions

View file

@ -25,7 +25,7 @@
</div>
<div class="col-xs-9">
<strong>
<%= @my_module.created_by.full_name.truncate(Constants::MAX_NAME_TRUNCATION) %>
<%= @my_module.created_by&.full_name&.truncate(Constants::MAX_NAME_TRUNCATION) %>
</strong>
<%= t('my_modules.module_header.details_popover.creator_same_user_label') if current_user == @my_module.created_by %>
</div>
@ -46,9 +46,14 @@
</div>
<div class="col-xs-9">
<strong>
<%= t('my_modules.module_header.details_popover.modified_value',
date: l(@my_module.updated_at, format: :full_date),
full_name: @my_module.last_modified_by.full_name.truncate(Constants::MAX_NAME_TRUNCATION)) %>
<% if @my_module.last_modified_by.present? %>
<%= t('my_modules.module_header.details_popover.modified_value',
date: l(@my_module.updated_at, format: :full_date),
full_name: @my_module.last_modified_by.full_name.truncate(Constants::MAX_NAME_TRUNCATION)) %>
<% else %>
<%= t('my_modules.module_header.details_popover.modified_value_without_user',
date: l(@my_module.updated_at, format: :full_date)) %>
<% end %>
</strong>
</div>
</div>

View file

@ -649,6 +649,7 @@ en:
created_label: "Created"
modified_label: "Modified"
modified_value: "%{date} by %{full_name}"
modified_value_without_user: "%{date}"
start_date: "Start date:"
no_start_date: "not set"
no_start_date_placeholder: "+ Add starting date"