Skip to content
Snippets Groups Projects
Commit 0b938f94 authored by Tetiana Chupryna's avatar Tetiana Chupryna :sunflower:
Browse files

Merge branch 'bugfix-for-potential-admin-issue' into 'master'

Prevent erroring when time is somehow nil

See merge request !104859



Merged-by: default avatarTetiana Chupryna <tchupryna@gitlab.com>
Approved-by: default avatarSam Figueroa <sfigueroa@gitlab.com>
Approved-by: default avatarTetiana Chupryna <tchupryna@gitlab.com>
Reviewed-by: default avatarSam Figueroa <sfigueroa@gitlab.com>
Co-authored-by: default avatarRobert May <rmay@gitlab.com>
parents 98472aad f9bd0f22
No related branches found
No related tags found
1 merge request!104859Prevent erroring when time is somehow nil
Pipeline #738101443 passed
......@@ -183,6 +183,8 @@ def registry_config
#
# Returns an HTML-safe String
def time_ago_with_tooltip(time, placement: 'top', html_class: '', short_format: false)
return "" if time.nil?
css_classes = [short_format ? 'js-short-timeago' : 'js-timeago']
css_classes << html_class unless html_class.blank?
......
......@@ -163,6 +163,13 @@ def element(**arguments)
expect(timeago_element.attr('class')).to eq 'js-short-timeago'
expect(timeago_element.next_element).to eq nil
end
it 'returns blank if time is nil' do
el = helper.time_ago_with_tooltip(nil)
expect(el).to eq('')
expect(el.html_safe).to eq('')
end
end
describe '#active_when' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment