Fix notestock search

This commit is contained in:
kyori19 2022-08-04 06:56:07 +09:00
parent 57aab71b0e
commit 92429da1eb
No known key found for this signature in database
GPG Key ID: CB37D0651E7F52AA
3 changed files with 5 additions and 6 deletions

View File

@ -21,7 +21,7 @@ import java.util.Date
data class Account(
val id: String,
@SerializedName("username") val localUsername: String,
@SerializedName("acct", alternate = ["subject"]) val username: String,
@SerializedName("acct") val username: String,
@SerializedName("display_name") private val displayName: String?, // should never be null per Api definition, but some servers break the contract
@SerializedName("created_at") val createdAt: Date,
val note: String,
@ -37,12 +37,11 @@ data class Account(
val emojis: List<Emoji>? = emptyList(), // nullable for backward compatibility
val fields: List<Field>? = emptyList(), // nullable for backward compatibility
val moved: Account? = null,
@SerializedName("name") val notestockUsername: String? = null,
) {
val name: String
get() = notestockUsername ?: if (displayName.isNullOrEmpty()) {
get() = if (displayName.isNullOrEmpty()) {
localUsername
} else displayName

View File

@ -41,7 +41,7 @@ data class Status(
@SerializedName("spoiler_text", alternate = ["summary"]) val spoilerText: String,
val visibility: Visibility,
@SerializedName("media_attachments", alternate = ["attachment"]) var attachments: ArrayList<Attachment>,
val mentions: List<Mention>,
@SerializedName("mentions", alternate = ["tag"]) val mentions: List<Mention>,
val tags: List<HashTag>?,
val application: Application?,
val pinned: Boolean?,

View File

@ -24,7 +24,7 @@ import com.google.gson.annotations.SerializedName
data class TimelineAccount(
val id: String,
@SerializedName("username") val localUsername: String,
@SerializedName("acct") val username: String,
@SerializedName("acct", alternate = ["subject"]) val username: String,
@SerializedName("display_name") val displayName: String?, // should never be null per Api definition, but some servers break the contract
val url: String,
val avatar: String,
@ -34,7 +34,7 @@ data class TimelineAccount(
) {
val name: String
get() = if (displayName.isNullOrEmpty()) {
get() = notestockUsername ?: if (displayName.isNullOrEmpty()) {
localUsername
} else displayName
}