uploads: refactor media asset validation logic.

Refactor the upload validation logic to not depend on the current user.
Fixes several broken upload tests.
This commit is contained in:
evazion
2022-09-15 04:51:48 -05:00
parent bfe2eabc6d
commit 0a5ebcc69d
4 changed files with 26 additions and 26 deletions

View File

@@ -105,6 +105,11 @@ class MediaFile
dimensions.second
end
# @return [Integer] the resolution of the file
def resolution
width * height
end
# @return [String] the MD5 hash of the file, as a hex string.
def md5
Digest::MD5.file(file.path).hexdigest