Update pleroma status cache on reaction

main
Karol Kosek 4 years ago committed by Gitea
parent cba7b2b122
commit 7ba55d97d5
  1. 4
      app/src/main/java/com/keylesspalace/tusky/appstore/CacheUpdater.kt
  2. 4
      app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt

@ -32,6 +32,10 @@ class CacheUpdater @Inject constructor(
timelineDao.removeAllByUser(accountId, event.accountId) timelineDao.removeAllByUser(accountId, event.accountId)
is StatusDeletedEvent -> is StatusDeletedEvent ->
timelineDao.delete(accountId, event.statusId) timelineDao.delete(accountId, event.statusId)
is EmojiReactEvent -> {
val pleromaString = gson.toJson(event.newStatus.pleroma)
timelineDao.setPleroma(accountId, event.newStatus.id, pleromaString)
}
is PollVoteEvent -> { is PollVoteEvent -> {
val pollString = gson.toJson(event.poll) val pollString = gson.toJson(event.poll)
timelineDao.setVoted(accountId, event.statusId, pollString) timelineDao.setVoted(accountId, event.statusId, pollString)

@ -104,4 +104,8 @@ AND serverId = :statusId""")
@Query("""UPDATE TimelineStatusEntity SET poll = :poll @Query("""UPDATE TimelineStatusEntity SET poll = :poll
WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId = :statusId)""") WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId = :statusId)""")
abstract fun setVoted(accountId: Long, statusId: String, poll: String) abstract fun setVoted(accountId: Long, statusId: String, poll: String)
@Query("""UPDATE TimelineStatusEntity SET pleroma = :pleroma
WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId = :statusId)""")
abstract fun setPleroma(accountId: Long, statusId: String, pleroma: String)
} }
Loading…
Cancel
Save