fix updating filter expiration to indefinite (#4743)
Before we would not send `expires_in` when "indefinite" was selected. But that left the expiration at the value it was before. To actually set it to indefinite we need to send `expires_in`, but leave it empty. With a value class this was actually really nice to fix, the code now self-documents what the special values mean. Also fixes a regression from the Material 3 redesign where the filter duration drop down would not get populated when creating a filter. Found while working on https://github.com/tuskyapp/Tusky/pull/4742
This commit is contained in:
parent
0d34804359
commit
e758321866
6 changed files with 108 additions and 52 deletions
|
|
@ -16,6 +16,7 @@
|
|||
package com.keylesspalace.tusky.network
|
||||
|
||||
import at.connyduck.calladapter.networkresult.NetworkResult
|
||||
import com.keylesspalace.tusky.components.filters.FilterExpiration
|
||||
import com.keylesspalace.tusky.entity.AccessToken
|
||||
import com.keylesspalace.tusky.entity.Account
|
||||
import com.keylesspalace.tusky.entity.Announcement
|
||||
|
|
@ -540,7 +541,7 @@ interface MastodonApi {
|
|||
@Field("context[]") context: List<String>,
|
||||
@Field("irreversible") irreversible: Boolean?,
|
||||
@Field("whole_word") wholeWord: Boolean?,
|
||||
@Field("expires_in") expiresInSeconds: Int?
|
||||
@Field("expires_in") expiresIn: FilterExpiration?
|
||||
): NetworkResult<FilterV1>
|
||||
|
||||
@FormUrlEncoded
|
||||
|
|
@ -551,7 +552,7 @@ interface MastodonApi {
|
|||
@Field("context[]") context: List<String>,
|
||||
@Field("irreversible") irreversible: Boolean?,
|
||||
@Field("whole_word") wholeWord: Boolean?,
|
||||
@Field("expires_in") expiresInSeconds: Int?
|
||||
@Field("expires_in") expiresIn: FilterExpiration?
|
||||
): NetworkResult<FilterV1>
|
||||
|
||||
@DELETE("api/v1/filters/{id}")
|
||||
|
|
@ -563,7 +564,7 @@ interface MastodonApi {
|
|||
@Field("title") title: String,
|
||||
@Field("context[]") context: List<String>,
|
||||
@Field("filter_action") filterAction: String,
|
||||
@Field("expires_in") expiresInSeconds: Int?
|
||||
@Field("expires_in") expiresIn: FilterExpiration?
|
||||
): NetworkResult<Filter>
|
||||
|
||||
@FormUrlEncoded
|
||||
|
|
@ -573,7 +574,7 @@ interface MastodonApi {
|
|||
@Field("title") title: String? = null,
|
||||
@Field("context[]") context: List<String>? = null,
|
||||
@Field("filter_action") filterAction: String? = null,
|
||||
@Field("expires_in") expiresInSeconds: Int? = null
|
||||
@Field("expires_in") expires: FilterExpiration? = null
|
||||
): NetworkResult<Filter>
|
||||
|
||||
@DELETE("api/v2/filters/{id}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue