Fix #3626: Artist creation page doesn't autocomplete the name anymore.
This commit is contained in:
@@ -125,9 +125,11 @@
|
||||
|
||||
if (data.artists.length === 0) {
|
||||
var new_artist_params = $.param({
|
||||
name: data.unique_id,
|
||||
other_names: data.artist_name,
|
||||
urls: $.unique([data.profile_url, data.normalized_for_artist_finder_url]).join("\n")
|
||||
artist: {
|
||||
name: data.unique_id,
|
||||
other_names: data.artist_name,
|
||||
url_string: $.unique([data.profile_url, data.normalized_for_artist_finder_url]).join("\n")
|
||||
}
|
||||
});
|
||||
|
||||
var link = $("<a>").attr("href", "/artists/new?" + new_artist_params).text("Create new artist");
|
||||
|
||||
@@ -304,9 +304,8 @@ class Artist < ApplicationRecord
|
||||
|
||||
module FactoryMethods
|
||||
def new_with_defaults(params)
|
||||
Artist.new.tap do |artist|
|
||||
if params[:name]
|
||||
artist.name = params[:name]
|
||||
Artist.new(params).tap do |artist|
|
||||
if artist.name.present?
|
||||
post = CurrentUser.without_safe_mode do
|
||||
Post.tag_match("source:http #{artist.name}").where("true /* Artist.new_with_defaults */").first
|
||||
end
|
||||
@@ -314,14 +313,6 @@ class Artist < ApplicationRecord
|
||||
artist.url_string = post.source
|
||||
end
|
||||
end
|
||||
|
||||
if params[:other_names]
|
||||
artist.other_names = params[:other_names]
|
||||
end
|
||||
|
||||
if params[:urls]
|
||||
artist.url_string = params[:urls]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1711,7 +1711,7 @@ class Post < ApplicationRecord
|
||||
|
||||
new_artist_tags.each do |tag|
|
||||
if tag.artist.blank?
|
||||
self.warnings[:base] << "Artist [[#{tag.name}]] requires an artist entry. \"Create new artist entry\":[/artists/new?name=#{CGI::escape(tag.name)}]"
|
||||
self.warnings[:base] << "Artist [[#{tag.name}]] requires an artist entry. \"Create new artist entry\":[/artists/new?artist%5Bname%5D=#{CGI::escape(tag.name)}]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user