Merge remote-tracking branch 'parent/main' into kb_development

This commit is contained in:
KMY 2023-10-03 20:42:23 +09:00
commit 9e91c1e653
51 changed files with 334 additions and 250 deletions

View file

@ -42,11 +42,13 @@ class SoftwareUpdateCheckService < BaseService
end
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
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
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']) }