feat: Check Hometown/Glitch server instanceinfo for translation support (#718)

Previous code only looked for translation support on Mastodon servers.
It may be present on Hometown/Glitch servers too, so check.

Fixes #714
This commit is contained in:
Nik Clayton 2024-05-30 19:14:27 +02:00 committed by GitHub
parent 84fdf4abb7
commit 51c4469e85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 3 deletions

View File

@ -116,7 +116,7 @@ data class Server(
val capabilities = capabilitiesFromServerVersion(serverKind, version) val capabilities = capabilitiesFromServerVersion(serverKind, version)
when (serverKind) { when (serverKind) {
MASTODON -> { GLITCH, HOMETOWN, MASTODON -> {
if (instanceV2.configuration.translation.enabled) { if (instanceV2.configuration.translation.enabled) {
capabilities[ORG_JOINMASTODON_STATUSES_TRANSLATE] = when { capabilities[ORG_JOINMASTODON_STATUSES_TRANSLATE] = when {
version >= "4.2.0".toVersion() -> "1.1.0".toVersion() version >= "4.2.0".toVersion() -> "1.1.0".toVersion()
@ -256,8 +256,6 @@ data class Server(
/** /**
* Capabilities that can be determined directly from the server's version, without checking * Capabilities that can be determined directly from the server's version, without checking
* the instanceInfo response. * the instanceInfo response.
*
* Modifies `capabilities` by potentially adding new capabilities to the map.
*/ */
private fun capabilitiesFromServerVersion(kind: ServerKind, v: Version): MutableMap<ServerOperation, Version> { private fun capabilitiesFromServerVersion(kind: ServerKind, v: Version): MutableMap<ServerOperation, Version> {
val c = mutableMapOf<ServerOperation, Version>() val c = mutableMapOf<ServerOperation, Version>()