Fix Mastodon listing updates older or equal to current version (#33906)

This commit is contained in:
Claire 2025-02-12 15:27:42 +01:00 committed by GitHub
parent fb0856458b
commit 6b52227fcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,7 @@ module Admin
def index def index
authorize :software_update, :index? authorize :software_update, :index?
@software_updates = SoftwareUpdate.by_version @software_updates = SoftwareUpdate.by_version.filter(&:pending?)
end end
private private

View File

@ -5,6 +5,7 @@ require 'rails_helper'
RSpec.describe 'finding software updates through the admin interface' do RSpec.describe 'finding software updates through the admin interface' do
before 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: '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')
sign_in Fabricate(:owner_user), scope: :user sign_in Fabricate(:owner_user), scope: :user
end end
@ -16,6 +17,7 @@ RSpec.describe 'finding software updates through the admin interface' do
expect(page).to have_title(I18n.t('admin.software_updates.title')) expect(page).to have_title(I18n.t('admin.software_updates.title'))
expect(page).to have_content('99.99.99') expect(page).to have_content('99.99.99')
.and have_no_content('3.5.0')
click_on I18n.t('admin.software_updates.release_notes') 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)