uploads: fix 'rating:safe' not assigning the rating (#3929).
This commit is contained in:
@@ -245,7 +245,7 @@ class Upload < ApplicationRecord
|
|||||||
|
|
||||||
def assign_rating_from_tags
|
def assign_rating_from_tags
|
||||||
if rating = Tag.has_metatag?(tag_string, :rating)
|
if rating = Tag.has_metatag?(tag_string, :rating)
|
||||||
self.rating = rating.downcase
|
self.rating = rating.downcase.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1070,6 +1070,18 @@ class UploadServiceTest < ActiveSupport::TestCase
|
|||||||
service.start!
|
service.start!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "assign the rating from tags" do
|
||||||
|
service = subject.new(source: @source, tag_string: "rating:safe blah")
|
||||||
|
upload = service.start!
|
||||||
|
|
||||||
|
assert_equal(true, upload.valid?)
|
||||||
|
assert_equal("s", upload.rating)
|
||||||
|
assert_equal("rating:safe blah ", upload.tag_string)
|
||||||
|
|
||||||
|
assert_equal("s", upload.post.rating)
|
||||||
|
assert_equal("blah", upload.post.tag_string)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user