Name a translation after its dialect
addTranslation set the MantraTranslationArtifactVersion name to the source artifact's name; use the selected dialect's name instead (visibility and license still inherit from the artifact). Add a getDialectById query to look the dialect up by id. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -14,4 +14,7 @@ interface MantraDialectDao {
|
||||
|
||||
@Query("SELECT * FROM MantraDialect WHERE chatRoomId = :chatRoomId ORDER BY name")
|
||||
suspend fun getDialectsByChatRoomId(chatRoomId: String): List<MantraDialect>
|
||||
|
||||
@Query("SELECT * FROM MantraDialect WHERE id = :id")
|
||||
suspend fun getDialectById(id: String): MantraDialect?
|
||||
}
|
||||
@@ -54,12 +54,14 @@ class DatabaseMantraRepository(
|
||||
val version = database.mantraArtifactVersionDao()
|
||||
.getArtifactVersionsByArtifactId(artifactId)
|
||||
.firstOrNull() ?: return null
|
||||
val dialect = database.mantraDialectDao().getDialectById(dialectId) ?: return null
|
||||
|
||||
// The translation inherits the source artifact's name/visibility/license.
|
||||
// The translation is named after its dialect, and inherits the source
|
||||
// artifact's visibility/license.
|
||||
val translationVersionTemplate = TranslationArtifactVersionEvent.build(
|
||||
artifactVersionId = version.id,
|
||||
dialectId = dialectId,
|
||||
name = artifact.name,
|
||||
name = dialect.name,
|
||||
visibility = artifact.visibility,
|
||||
license = artifact.license,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user