Fix #4987: Can't populate tag string from upload url anymore.
Usage: https://danbooru.donmai.us/uploads/new?url=...&post[tag_string]=...&post[rating]=... * Pass the URL parameters from the /uploads/new page to the /uploads/:id page. * Fix the /uploads/:id page throwing an "unpermitted parameters" error when given URL params for the post edit form.
This commit is contained in:
@@ -8,7 +8,7 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
def create_post!(user: create(:user), media_asset: build(:media_asset), rating: "q", tag_string: "tagme", **params)
|
||||
upload = build(:upload, uploader: user)
|
||||
asset = create(:upload_media_asset, upload: upload, media_asset: media_asset)
|
||||
post_auth posts_path, user, params: { post: { upload_media_asset_id: asset.id, rating: rating, tag_string: tag_string, **params }}
|
||||
post_auth posts_path, user, params: { upload_media_asset_id: asset.id, post: { rating: rating, tag_string: tag_string, **params }}
|
||||
|
||||
Post.last
|
||||
end
|
||||
|
||||
@@ -138,6 +138,14 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_redirected_to @post
|
||||
end
|
||||
|
||||
should "prefill the upload form with the URL parameters" do
|
||||
upload = create(:completed_source_upload, uploader: @user)
|
||||
get_auth upload_path(upload, post: { rating: "s" }), @user
|
||||
|
||||
assert_response :success
|
||||
assert_select "#post_rating_s[checked]"
|
||||
end
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
|
||||
Reference in New Issue
Block a user