DEV: Return only valid repos

This will stop non-upgradeable plugins from showing up on the list. This mainly means core plugins like `poll` or `chat`
This commit is contained in:
Jarek Radosz 2023-01-30 12:10:11 +01:00
parent 4c8593cf43
commit b9b3c71c95
2 changed files with 14 additions and 15 deletions

View File

@ -21,20 +21,18 @@ module DockerManager
result[:fork] = true if result[:official] &&
!r.url.starts_with?("https://github.com/discourse/")
if r.valid?
result[:id] = r
.name
.downcase
.gsub(/[^a-z]/, "_")
.gsub(/_+/, "_")
.sub(/_$/, "")
result[:version] = r.latest_local_commit
result[:pretty_version] = r.latest_local_tag_version.presence
result[:url] = r.url
if r.upgrading?
result[:upgrading] = true
result[:version] = r.upgrade_version
end
result[:id] = r
.name
.downcase
.gsub(/[^a-z]/, "_")
.gsub(/_+/, "_")
.sub(/_$/, "")
result[:version] = r.latest_local_commit
result[:pretty_version] = r.latest_local_tag_version.presence
result[:url] = r.url
if r.upgrading?
result[:upgrading] = true
result[:version] = r.upgrade_version
end
result

View File

@ -84,7 +84,8 @@ class DockerManager::GitRepo
Discourse.visible_plugins.each do |p|
next if p.name == "docker_manager"
repos << DockerManager::GitRepo.new(File.dirname(p.path), p.name)
repo = DockerManager::GitRepo.new(File.dirname(p.path), p.name)
repos << repo if repo.valid?
end
repos