mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Fix incorrectly keeping outdated update notices absent from the API endpoint (#27021)
This commit is contained in:
parent
1e2d4975cf
commit
7e7d6e695b
@ -35,11 +35,13 @@ class SoftwareUpdateCheckService < BaseService
|
|||||||
end
|
end
|
||||||
|
|
||||||
def process_update_notices!(update_notices)
|
def process_update_notices!(update_notices)
|
||||||
return if update_notices.blank? || update_notices['updatesAvailable'].blank?
|
return if update_notices.blank? || update_notices['updatesAvailable'].nil?
|
||||||
|
|
||||||
# Clear notices that are not listed by the update server anymore
|
# Clear notices that are not listed by the update server anymore
|
||||||
SoftwareUpdate.where.not(version: update_notices['updatesAvailable'].pluck('version')).delete_all
|
SoftwareUpdate.where.not(version: update_notices['updatesAvailable'].pluck('version')).delete_all
|
||||||
|
|
||||||
|
return if update_notices['updatesAvailable'].blank?
|
||||||
|
|
||||||
# Check if any of the notices is new, and issue notifications
|
# Check if any of the notices is new, and issue notifications
|
||||||
known_versions = SoftwareUpdate.where(version: update_notices['updatesAvailable'].pluck('version')).pluck(:version)
|
known_versions = SoftwareUpdate.where(version: update_notices['updatesAvailable'].pluck('version')).pluck(:version)
|
||||||
new_update_notices = update_notices['updatesAvailable'].filter { |notice| known_versions.exclude?(notice['version']) }
|
new_update_notices = update_notices['updatesAvailable'].filter { |notice| known_versions.exclude?(notice['version']) }
|
||||||
|
Loading…
Reference in New Issue
Block a user