Ignore disabled out-of-date remote themes (#10870)

No need to alert in admin dashboard about out of date remote themes
that are disabled.
This commit is contained in:
Penar Musaraj 2020-10-08 13:48:16 -04:00 committed by GitHub
parent e47b847ac2
commit 5130b4d674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -104,6 +104,7 @@ class RemoteTheme < ActiveRecord::Base
def self.out_of_date_themes
self.joined_remotes.where("commits_behind > 0 OR remote_version <> local_version")
.where(themes: { enabled: true })
.pluck("themes.name", "themes.id")
end

View File

@ -245,6 +245,13 @@ describe RemoteTheme do
remote.update!(local_version: "new version", commits_behind: 0)
expect(described_class.out_of_date_themes).to eq([])
end
it "ignores disabled out of date themes" do
remote.update!(local_version: "old version", remote_version: "new version", commits_behind: 2)
theme.update!(enabled: false)
expect(described_class.out_of_date_themes).to eq([])
end
end
context ".unreachable_themes" do