mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
Fixes #6108 - Attachment file size is wrong in the public KB answer
This commit is contained in:
parent
54a6765683
commit
5c64cd4733
3 changed files with 28 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ data-available-locales="<%= @object_locales.map(&:locale).join(',') %>">
|
|||
<% attachments.each do |attachment| %>
|
||||
<%= link_to custom_path_if_needed(attachment_path(attachment), @knowledge_base), class: 'attachment', download: true do %>
|
||||
<span class="attachment-name u-highlight"><%= attachment.filename %></span>
|
||||
<div class="attachment-size">404kb</div>
|
||||
<div class="attachment-size"><%= number_to_human_size attachment.size %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -31,3 +31,16 @@
|
|||
|
||||
en:
|
||||
hello: "Hello world"
|
||||
number:
|
||||
human:
|
||||
storage_units:
|
||||
format: "%n %u"
|
||||
units:
|
||||
byte:
|
||||
one: "B"
|
||||
other: "B"
|
||||
kb: "KB"
|
||||
mb: "MB"
|
||||
gb: "GB"
|
||||
tb: "TB"
|
||||
pb: "PB"
|
||||
|
|
|
|||
|
|
@ -125,6 +125,20 @@ RSpec.describe 'Public Knowledge Base answer', type: :system do
|
|||
end
|
||||
end
|
||||
|
||||
context 'attachments' do
|
||||
before do
|
||||
visit help_answer_path(locale_name, category, published_answer)
|
||||
end
|
||||
|
||||
# Making sure it shows the shorthand.
|
||||
# This way we can get away without translating Byte(s).
|
||||
it 'shows an associated attachment' do
|
||||
expect(page)
|
||||
.to have_css('.attachment-size', text: '12 B')
|
||||
.and(have_no_css('.attachment-size', text: 'Byte'))
|
||||
end
|
||||
end
|
||||
|
||||
def open_answer(answer, locale: primary_locale.system_locale.locale)
|
||||
visit help_answer_path(locale, answer.category, answer)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue