Poll fixes (#1238)

* update cache when voting on a poll

* fix poll controls color

* don't allow voting on old poll from cache

* check for RecyclerView.NO_POSITION in click listener

* fix crash when voting in a boosted poll
This commit is contained in:
Konrad Pozniak 2019-05-05 08:26:17 +02:00 committed by GitHub
commit b8c32a96de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 85 additions and 31 deletions

View file

@ -6,6 +6,7 @@ import androidx.room.OnConflictStrategy.IGNORE
import androidx.room.OnConflictStrategy.REPLACE
import androidx.room.Query
import androidx.room.Transaction
import com.keylesspalace.tusky.entity.Poll
import io.reactivex.Single
@Dao
@ -98,4 +99,8 @@ AND serverId = :statusId""")
@Query("""DELETE FROM TimelineStatusEntity WHERE timelineUserId = :accountId
AND authorServerId != :accountServerId AND createdAt < :olderThan""")
abstract fun cleanup(accountId: Long, accountServerId: String, olderThan: Long)
@Query("""UPDATE TimelineStatusEntity SET poll = :poll
WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId - :statusId)""")
abstract fun setVoted(accountId: Long, statusId: String, poll: String)
}