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) {
|
if (data.artists.length === 0) {
|
||||||
var new_artist_params = $.param({
|
var new_artist_params = $.param({
|
||||||
name: data.unique_id,
|
artist: {
|
||||||
other_names: data.artist_name,
|
name: data.unique_id,
|
||||||
urls: $.unique([data.profile_url, data.normalized_for_artist_finder_url]).join("\n")
|
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");
|
var link = $("<a>").attr("href", "/artists/new?" + new_artist_params).text("Create new artist");
|
||||||
|
|||||||
@@ -304,9 +304,8 @@ class Artist < ApplicationRecord
|
|||||||
|
|
||||||
module FactoryMethods
|
module FactoryMethods
|
||||||
def new_with_defaults(params)
|
def new_with_defaults(params)
|
||||||
Artist.new.tap do |artist|
|
Artist.new(params).tap do |artist|
|
||||||
if params[:name]
|
if artist.name.present?
|
||||||
artist.name = params[:name]
|
|
||||||
post = CurrentUser.without_safe_mode do
|
post = CurrentUser.without_safe_mode do
|
||||||
Post.tag_match("source:http #{artist.name}").where("true /* Artist.new_with_defaults */").first
|
Post.tag_match("source:http #{artist.name}").where("true /* Artist.new_with_defaults */").first
|
||||||
end
|
end
|
||||||
@@ -314,14 +313,6 @@ class Artist < ApplicationRecord
|
|||||||
artist.url_string = post.source
|
artist.url_string = post.source
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1711,7 +1711,7 @@ class Post < ApplicationRecord
|
|||||||
|
|
||||||
new_artist_tags.each do |tag|
|
new_artist_tags.each do |tag|
|
||||||
if tag.artist.blank?
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user