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:
parent
fae9cd18f1
commit
b8c32a96de
7 changed files with 85 additions and 31 deletions
|
|
@ -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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue