Fix #4470: Check URLs for duplicates when creating artists
Show a warning when creating a duplicate artist; that is, when adding a URL that already belongs to another artist. This is a soft warning rather than a hard error because there are some cases where multiple artists legitimately share the same site or account.
This commit is contained in:
@@ -46,13 +46,14 @@ class ArtistsController < ApplicationController
|
||||
def create
|
||||
@artist = authorize Artist.new(permitted_attributes(Artist))
|
||||
@artist.save
|
||||
flash[:notice] = [*@artist.errors.full_messages, *@artist.warnings.full_messages].join(".\n \n") if @artist.warnings.any? || @artist.errors.any?
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
def update
|
||||
@artist = authorize Artist.find(params[:id])
|
||||
@artist.update(permitted_attributes(@artist))
|
||||
flash[:notice] = @artist.valid? ? "Artist updated" : @artist.errors.full_messages.join("; ")
|
||||
flash[:notice] = [*@artist.errors.full_messages, *@artist.warnings.full_messages].join(".\n \n") if @artist.warnings.any? || @artist.errors.any?
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user