Commit 5b23f2b0 authored by Phil Hughes's avatar Phil Hughes

Merge branch '57428-actionview-template-error-undefined-method-for-nil-nilclass' into 'master'

Resolve "ActionView::Template::Error: undefined method `>' for nil:NilClass"

Closes #57428

See merge request gitlab-org/gitlab-ce!25028
parents fe572c0e 20ce370f
......@@ -12,11 +12,14 @@
- mr_status_class = 'closed'
- else
- mr_status_date = merge_request.created_at
- mr_status_title = _('Opened')
- mr_status_title = mr_status_date ? _('Opened') : _('Open')
- mr_status_icon = 'issue-open-m'
- mr_status_class = 'open'
- mr_status_tooltip = "<div><span class=\"bold\">#{mr_status_title}</span> #{time_ago_in_words(mr_status_date)} ago</div><span class=\"text-tertiary\">#{l(mr_status_date.to_time, format: time_format)}</span>"
- if mr_status_date
- mr_status_tooltip = "<div><span class=\"bold\">#{mr_status_title}</span> #{time_ago_in_words(mr_status_date)} ago</div><span class=\"text-tertiary\">#{l(mr_status_date.to_time, format: time_format)}</span>"
- else
- mr_status_tooltip = "<div><span class=\"bold\">#{mr_status_title}</span></div>"
%span.mr-status-wrapper.suggestion-help-hover{ class: css_class, data: { toggle: 'tooltip', placement: 'bottom', html: 'true', title: mr_status_tooltip } }
= sprite_icon(mr_status_icon, size: 16, css_class: "merge-request-status #{mr_status_class}")
# frozen_string_literal: true
require 'spec_helper'
describe 'projects/issues/_merge_requests_status.html.haml' do
it 'shows date of status change in tooltip' do
merge_request = create(:merge_request, created_at: 1.month.ago)
render partial: 'projects/issues/merge_requests_status',
locals: { merge_request: merge_request, css_class: '' }
expect(rendered).to match("Opened.*about 1 month ago")
end
it 'shows only status in tooltip if date is not set' do
merge_request = create(:merge_request, state: :closed)
render partial: 'projects/issues/merge_requests_status',
locals: { merge_request: merge_request, css_class: '' }
expect(rendered).to match("Closed")
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment