Fix notestock search
This commit is contained in:
parent
57aab71b0e
commit
92429da1eb
|
@ -21,7 +21,7 @@ import java.util.Date
|
||||||
data class Account(
|
data class Account(
|
||||||
val id: String,
|
val id: String,
|
||||||
@SerializedName("username") val localUsername: 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("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,
|
@SerializedName("created_at") val createdAt: Date,
|
||||||
val note: String,
|
val note: String,
|
||||||
|
@ -37,12 +37,11 @@ data class Account(
|
||||||
val emojis: List<Emoji>? = emptyList(), // nullable for backward compatibility
|
val emojis: List<Emoji>? = emptyList(), // nullable for backward compatibility
|
||||||
val fields: List<Field>? = emptyList(), // nullable for backward compatibility
|
val fields: List<Field>? = emptyList(), // nullable for backward compatibility
|
||||||
val moved: Account? = null,
|
val moved: Account? = null,
|
||||||
@SerializedName("name") val notestockUsername: String? = null,
|
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val name: String
|
val name: String
|
||||||
get() = notestockUsername ?: if (displayName.isNullOrEmpty()) {
|
get() = if (displayName.isNullOrEmpty()) {
|
||||||
localUsername
|
localUsername
|
||||||
} else displayName
|
} else displayName
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ data class Status(
|
||||||
@SerializedName("spoiler_text", alternate = ["summary"]) val spoilerText: String,
|
@SerializedName("spoiler_text", alternate = ["summary"]) val spoilerText: String,
|
||||||
val visibility: Visibility,
|
val visibility: Visibility,
|
||||||
@SerializedName("media_attachments", alternate = ["attachment"]) var attachments: ArrayList<Attachment>,
|
@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 tags: List<HashTag>?,
|
||||||
val application: Application?,
|
val application: Application?,
|
||||||
val pinned: Boolean?,
|
val pinned: Boolean?,
|
||||||
|
|
|
@ -24,7 +24,7 @@ import com.google.gson.annotations.SerializedName
|
||||||
data class TimelineAccount(
|
data class TimelineAccount(
|
||||||
val id: String,
|
val id: String,
|
||||||
@SerializedName("username") val localUsername: 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
|
@SerializedName("display_name") val displayName: String?, // should never be null per Api definition, but some servers break the contract
|
||||||
val url: String,
|
val url: String,
|
||||||
val avatar: String,
|
val avatar: String,
|
||||||
|
@ -34,7 +34,7 @@ data class TimelineAccount(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val name: String
|
val name: String
|
||||||
get() = if (displayName.isNullOrEmpty()) {
|
get() = notestockUsername ?: if (displayName.isNullOrEmpty()) {
|
||||||
localUsername
|
localUsername
|
||||||
} else displayName
|
} else displayName
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue