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:
@@ -46,7 +46,10 @@ class UploadsController < ApplicationController
|
||||
|
||||
def show
|
||||
@upload = authorize Upload.find(params[:id])
|
||||
@post = Post.new(uploader: @upload.uploader, uploader_ip_addr: @upload.uploader_ip_addr, source: @upload.source, rating: nil, **permitted_attributes(Post))
|
||||
@upload_media_asset = @upload.upload_media_assets.first
|
||||
@media_asset = @upload_media_asset&.media_asset
|
||||
|
||||
@post = Post.new_from_upload(@upload, @media_asset, source: @upload.source, **permitted_attributes(Post).to_h.symbolize_keys)
|
||||
@post.tag_string = "#{@post.tag_string} #{@upload.source_strategy&.artists.to_a.map(&:tag).map(&:name).join(" ")}".strip
|
||||
@post.tag_string += " " if @post.tag_string.present?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user