Skip to content

Commit

Permalink
Update the artist name if it already exists when adding a new fan art
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPowerGamerBR committed Oct 15, 2024
1 parent 1b2dc1d commit a9410e3
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,14 @@ class GalleryOfDreamsCommand(val loritta: GalleryOfDreamsBackend) : SlashCommand
.selectAll()
.where { FanArtArtistDiscordConnections.discordId eq artistId }
.firstOrNull()
if (existingFanArtArtist != null)
if (existingFanArtArtist != null) {
// Update the artist name
FanArtArtists.update({ FanArtArtists.id eq existingFanArtArtist[FanArtArtists.id ]}) {
it[FanArtArtists.name] = artistName
}

return@transaction existingFanArtArtist
}

// Cleans up the user's name to make it be the user's name, if the result is a empty string we use a "ifEmpty" call to change it to the user's ID
val fanArtArtistSlug = artistSlug.lowercase()
Expand Down

0 comments on commit a9410e3

Please sign in to comment.