Support "replies policy" for lists (#4072)

This commit is contained in:
Levi Bard 2023-10-26 11:21:04 +02:00 committed by GitHub
commit 55ed6841ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 14 deletions

View file

@ -84,9 +84,9 @@ internal class ListsViewModel @Inject constructor(private val api: MastodonApi)
}
}
fun createNewList(listName: String, exclusive: Boolean) {
fun createNewList(listName: String, exclusive: Boolean, replyPolicy: String) {
viewModelScope.launch {
api.createList(listName, exclusive).fold(
api.createList(listName, exclusive, replyPolicy).fold(
{ list ->
updateState {
copy(lists = lists + list)
@ -99,9 +99,9 @@ internal class ListsViewModel @Inject constructor(private val api: MastodonApi)
}
}
fun updateList(listId: String, listName: String, exclusive: Boolean) {
fun updateList(listId: String, listName: String, exclusive: Boolean, replyPolicy: String) {
viewModelScope.launch {
api.updateList(listId, listName, exclusive).fold(
api.updateList(listId, listName, exclusive, replyPolicy).fold(
{ list ->
updateState {
copy(lists = lists.replacedFirstWhich(list) { it.id == listId })