mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-26 15:31:52 +00:00
Remove fa_
prefix from status visibility icon method (#31846)
This commit is contained in:
parent
a3215c0f88
commit
cee71b9892
|
@ -4,6 +4,13 @@ module StatusesHelper
|
||||||
EMBEDDED_CONTROLLER = 'statuses'
|
EMBEDDED_CONTROLLER = 'statuses'
|
||||||
EMBEDDED_ACTION = 'embed'
|
EMBEDDED_ACTION = 'embed'
|
||||||
|
|
||||||
|
VISIBLITY_ICONS = {
|
||||||
|
public: 'globe',
|
||||||
|
unlisted: 'lock_open',
|
||||||
|
private: 'lock',
|
||||||
|
direct: 'alternate_email',
|
||||||
|
}.freeze
|
||||||
|
|
||||||
def nothing_here(extra_classes = '')
|
def nothing_here(extra_classes = '')
|
||||||
content_tag(:div, class: "nothing-here #{extra_classes}") do
|
content_tag(:div, class: "nothing-here #{extra_classes}") do
|
||||||
t('accounts.nothing_here')
|
t('accounts.nothing_here')
|
||||||
|
@ -57,17 +64,8 @@ module StatusesHelper
|
||||||
embedded_view? ? '_blank' : nil
|
embedded_view? ? '_blank' : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def fa_visibility_icon(status)
|
def visibility_icon(status)
|
||||||
case status.visibility
|
VISIBLITY_ICONS[status.visibility.to_sym]
|
||||||
when 'public'
|
|
||||||
material_symbol 'globe'
|
|
||||||
when 'unlisted'
|
|
||||||
material_symbol 'lock_open'
|
|
||||||
when 'private'
|
|
||||||
material_symbol 'lock'
|
|
||||||
when 'direct'
|
|
||||||
material_symbol 'alternate_email'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def embedded_view?
|
def embedded_view?
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
= material_symbol('repeat_active')
|
= material_symbol('repeat_active')
|
||||||
= t('statuses.boosted_from_html', acct_link: admin_account_inline_link_to(status.proper.account))
|
= t('statuses.boosted_from_html', acct_link: admin_account_inline_link_to(status.proper.account))
|
||||||
- else
|
- else
|
||||||
= fa_visibility_icon(status)
|
= material_symbol visibility_icon(status)
|
||||||
= t("statuses.visibilities.#{status.visibility}")
|
= t("statuses.visibilities.#{status.visibility}")
|
||||||
- if status.proper.sensitive?
|
- if status.proper.sensitive?
|
||||||
·
|
·
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
·
|
·
|
||||||
= t('statuses.edited_at_html', date: content_tag(:time, l(status.edited_at), datetime: status.edited_at.iso8601, title: l(status.edited_at), class: 'formatted'))
|
= t('statuses.edited_at_html', date: content_tag(:time, l(status.edited_at), datetime: status.edited_at.iso8601, title: l(status.edited_at), class: 'formatted'))
|
||||||
·
|
·
|
||||||
= fa_visibility_icon(status)
|
= material_symbol visibility_icon(status)
|
||||||
= t("statuses.visibilities.#{status.visibility}")
|
= t("statuses.visibilities.#{status.visibility}")
|
||||||
- if status.sensitive?
|
- if status.sensitive?
|
||||||
·
|
·
|
||||||
|
|
|
@ -36,14 +36,14 @@ RSpec.describe StatusesHelper do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'fa_visibility_icon' do
|
describe 'visibility_icon' do
|
||||||
context 'with a status that is public' do
|
context 'with a status that is public' do
|
||||||
let(:status) { Status.new(visibility: 'public') }
|
let(:status) { Status.new(visibility: 'public') }
|
||||||
|
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('material-globe')
|
expect(result).to match('globe')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,9 +51,9 @@ RSpec.describe StatusesHelper do
|
||||||
let(:status) { Status.new(visibility: 'unlisted') }
|
let(:status) { Status.new(visibility: 'unlisted') }
|
||||||
|
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('material-lock_open')
|
expect(result).to match('lock_open')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ RSpec.describe StatusesHelper do
|
||||||
let(:status) { Status.new(visibility: 'private') }
|
let(:status) { Status.new(visibility: 'private') }
|
||||||
|
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('material-lock')
|
expect(result).to match('lock')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ RSpec.describe StatusesHelper do
|
||||||
let(:status) { Status.new(visibility: 'direct') }
|
let(:status) { Status.new(visibility: 'direct') }
|
||||||
|
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('material-alternate_email')
|
expect(result).to match('alternate_email')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user