Compare notification IDs by length as well as value (#3657)

This commit is contained in:
Nik Clayton 2023-05-15 23:11:14 +02:00 committed by GitHub
parent 36ebb0e16c
commit 92ba53a8c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,7 @@ import com.keylesspalace.tusky.db.AccountManager
import com.keylesspalace.tusky.entity.Marker
import com.keylesspalace.tusky.entity.Notification
import com.keylesspalace.tusky.network.MastodonApi
import com.keylesspalace.tusky.util.isLessThan
import javax.inject.Inject
import kotlin.math.min
@ -116,7 +117,7 @@ class NotificationFetcher @Inject constructor(
val minId = when (val marker = fetchMarker(authHeader, account)) {
null -> account.lastNotificationId.takeIf { it != "0" }
else -> if (marker.lastReadId > account.lastNotificationId) marker.lastReadId else account.lastNotificationId
else -> if (account.lastNotificationId.isLessThan(marker.lastReadId)) marker.lastReadId else account.lastNotificationId
}
Log.d(TAG, "getting Notifications for ${account.fullName}, min_id: $minId")