This commit is contained in:
Matt Jankowski 2026-03-02 10:08:43 -05:00 committed by GitHub
commit 79526e23d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 18 deletions

View File

@ -0,0 +1,11 @@
%tr{ id: dom_id(software_update) }
%td= software_update.version
%td= t("admin.software_updates.types.#{software_update.type}")
%td{ class: class_names(critical: software_update.urgent?) }
- if software_update.urgent?
= t('admin.software_updates.critical_update')
%td.release-notes
- if software_update.release_notes?
= table_link_to 'link',
t('admin.software_updates.release_notes'),
software_update.release_notes

View File

@ -18,12 +18,4 @@
%th
%th
%tbody
- @software_updates.each do |update|
%tr
%td= update.version
%td= t("admin.software_updates.types.#{update.type}")
- if update.urgent?
%td.critical= t('admin.software_updates.critical_update')
- else
%td
%td= table_link_to 'link', t('admin.software_updates.release_notes'), update.release_notes
= render collection: @software_updates, partial: 'admin/software_updates/software_update'

View File

@ -3,23 +3,28 @@
require 'rails_helper'
RSpec.describe 'finding software updates through the admin interface' do
before do
Fabricate(:software_update, version: '99.99.99', type: 'major', urgent: true, release_notes: 'https://github.com/mastodon/mastodon/releases/v99')
Fabricate(:software_update, version: '3.5.0', type: 'major', urgent: true, release_notes: 'https://github.com/mastodon/mastodon/releases/v3.5.0')
before { sign_in Fabricate(:owner_user) }
sign_in Fabricate(:owner_user), scope: :user
end
let!(:latest_release) { Fabricate(:software_update, version: '99.99.99', type: 'major', urgent: true, release_notes: 'https://github.com/mastodon/mastodon/releases/v99') }
let!(:other_release) { Fabricate(:software_update, version: '98.0.0', type: 'major', release_notes: '') }
let!(:outdated_release) { Fabricate(:software_update, version: '3.5.0', type: 'major', urgent: true, release_notes: 'https://github.com/mastodon/mastodon/releases/v3.5.0') }
it 'shows a link to the software updates page, which links to release notes' do
visit settings_profile_path
click_on I18n.t('admin.critical_update_pending')
expect(page).to have_title(I18n.t('admin.software_updates.title'))
expect(page)
.to have_title(I18n.t('admin.software_updates.title'))
.and have_content(latest_release.version)
.and have_content(other_release.version)
.and have_no_content(outdated_release.version)
expect(page).to have_content('99.99.99')
.and have_no_content('3.5.0')
within("#software_update_#{other_release.id}") do
expect(find('.release-notes').value).to be_nil
end
click_on I18n.t('admin.software_updates.release_notes')
expect(page).to have_current_path('https://github.com/mastodon/mastodon/releases/v99', url: true)
expect(page)
.to have_current_path('https://github.com/mastodon/mastodon/releases/v99', url: true)
end
end