return approved screenshots only in public json. fixes #96

This commit is contained in:
Christoph Haas 2026-02-04 00:09:43 +01:00
parent e2473ff511
commit 9d0009b129
3 changed files with 16 additions and 5 deletions

View file

@ -71,6 +71,11 @@ class Package < ApplicationRecord
screenshots.approved.to_a.sort { |x, y| version_compare(x.version, y.version) }
end
# Return all approved screenshots for this package
def approved_screenshots
screenshots.approved
end
# Return the newest screenshot that is not newer than the given version.
# This algorithm collects all image
# versions of a package and determines the (second) newest version.