Oops. Fix votes.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3807 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-01-30 20:20:19 +00:00
parent 0278aceb62
commit b5111efc29
2 changed files with 3 additions and 3 deletions

View File

@ -256,7 +256,7 @@ async function getVotes(db, id) {
if (!f || f.version != k_version) {
f = {votes: [], sequence: 0, version: k_version};
}
if (g_sequence[id] > f.sequence) {
if (!g_sequence[id] || g_sequence[id] > f.sequence) {
await ssb.sqlStream(
"SELECT "+
" author, "+
@ -271,7 +271,7 @@ async function getVotes(db, id) {
" json_extract(content, '$.type') = 'vote' "+
"UNION SELECT NULL, NULL, MAX(sequence), NULL, NULL FROM messages WHERE author = ? "+
"ORDER BY sequence DESC LIMIT ?",
[f.sequence, id, id, k_votes_max],
[id, f.sequence, id, k_votes_max],
function(row) {
if (row.id) {
votes.push(row);