Edward Sneed: 1 Fix missing chats in app 2 files changed, 13 insertions(+), 13 deletions(-)
Copy & paste the following snippet into your terminal to import this patchset into git:
curl -s https://lists.sr.ht/~captainepoch/husky-devel/patches/27986/mbox | git am -3Learn more about email & git
--- This patch fixes the missing chats in its corresponding tab. It is copied from an unmaintained fork found at https://github.com/SamTherapy/Husky and was originally made by @sam@froth.zone (fediverse) .../tusky/network/MastodonApi.kt | 2 +- .../tusky/repository/ChatRepository.kt | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt b/husky/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt index dda8201..b1a794a 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt @@ -631,7 +631,7 @@ interface MastodonApi { @Path("message_id") messageId: String ): Single<ChatMessage> - @GET("api/v1/pleroma/chats") + @GET("api/v2/pleroma/chats") fun getChats( @Query("max_id") maxId: String?, @Query("min_id") minId: String?, diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/repository/ChatRepository.kt b/husky/app/src/main/java/com/keylesspalace/tusky/repository/ChatRepository.kt index d96df4c..6fa19c3 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/repository/ChatRepository.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/repository/ChatRepository.kt @@ -59,24 +59,24 @@ class ChatRepositoryImpl( getChatMessagesFromNetwork(chatId, maxId, sinceId, sincedIdMinusOne, limit, accountId, requestMode) }*/ - return getChatMessagesFromNetwork(chatId, maxId, sinceId, sincedIdMinusOne, limit, accountId, requestMode) + return getChatMessagesFromNetwork(chatId, maxId, null, null, limit, accountId, requestMode) } private fun getChatsFromNetwork(maxId: String?, sinceId: String?, sinceIdMinusOne: String?, limit: Int, accountId: Long, requestMode: TimelineRequestMode ): Single<out List<ChatStatus>> { - return mastodonApi.getChats(maxId, null, sinceIdMinusOne, 0, limit + 1) - .map { chats -> - this.saveChatsToDb(accountId, chats, maxId, sinceId) - } - .flatMap { chats -> - this.addFromDbIfNeeded(accountId, chats, maxId, sinceId, limit, requestMode) - } - .onErrorResumeNext { error -> - if (error is IOException && requestMode != NETWORK) { - this.getChatsFromDb(accountId, maxId, sinceId, limit) - } else { + return mastodonApi.getChats(null, null, sinceIdMinusOne, 0, limit + 1) + .map { chats -> + this.saveChatsToDb(accountId, chats, maxId, sinceId) + } + .flatMap { chats -> + this.addFromDbIfNeeded(accountId, chats, maxId, sinceId, limit, requestMode) + } + .onErrorResumeNext { error -> + if (error is IOException && requestMode != NETWORK) { + this.getChatsFromDb(accountId, maxId, sinceId, limit) + } else { Single.error(error) } } -- 2.25.1
-- 1
"/api/v1/chats" doesn't exist anymore in Pleroma. Also in v2 API supports pagination, so it can be also enabled in ChatFragment. Looks fine to me, except formatting is off. What do you think, captainepoch? чт, 6 янв. 2022 г. в 04:15, Edward Sneed <sneeden@fedora.email>:
Patch applied, git commit 237241ba. Thanks!