target comments from @flub

This commit is contained in:
B. Petersen
2020-02-14 11:56:59 +01:00
parent 84f8627890
commit 1f9520dc78
2 changed files with 6 additions and 8 deletions

View File

@@ -958,10 +958,8 @@ impl rusqlite::types::FromSql for ChatVisibility {
2 => Ok(ChatVisibility::Pinned),
1 => Ok(ChatVisibility::Archived),
0 => Ok(ChatVisibility::Normal),
n => {
// unknown archived state, falling back to normal state (was this db opened with a newer deltachat version?)
Err(rusqlite::types::FromSqlError::OutOfRange(n))
}
// fallback to to Normal for unknown values, may happen eg. on imports created by a newer version.
_ => Ok(ChatVisibility::Normal),
}
})
}

View File

@@ -199,13 +199,13 @@ impl Chatlist {
SELECT MAX(timestamp)
FROM msgs
WHERE chat_id=c.id
AND (hidden=0 OR state=?))
AND (hidden=0 OR state=?1))
WHERE c.id>9
AND c.blocked=0
AND NOT c.archived=1
AND NOT c.archived=?2
GROUP BY c.id
ORDER BY c.archived=2 DESC, IFNULL(m.timestamp,c.created_timestamp) DESC, m.id DESC;",
params![MessageState::OutDraft],
ORDER BY c.archived=?3 DESC, IFNULL(m.timestamp,c.created_timestamp) DESC, m.id DESC;",
params![MessageState::OutDraft, ChatVisibility::Archived, ChatVisibility::Pinned],
process_row,
process_rows,
)?;