mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
order contact lists by "last seen" instead of name/address (#3562)
order all contact lists by last_seen instead of name or address
This commit is contained in:
@@ -13,6 +13,8 @@
|
|||||||
- add `dc_contact_was_seen_recently()` #3560
|
- add `dc_contact_was_seen_recently()` #3560
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
- order contact lists by "last seen";
|
||||||
|
this affects `dc_get_chat_contacts()`, `dc_get_contacts()` and `dc_get_blocked_contacts()` #3562
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- do not emit notifications for blocked chats #3557
|
- do not emit notifications for blocked chats #3557
|
||||||
|
|||||||
@@ -2525,7 +2525,7 @@ pub async fn get_chat_contacts(context: &Context, chat_id: ChatId) -> Result<Vec
|
|||||||
LEFT JOIN contacts c
|
LEFT JOIN contacts c
|
||||||
ON c.id=cc.contact_id
|
ON c.id=cc.contact_id
|
||||||
WHERE cc.chat_id=?
|
WHERE cc.chat_id=?
|
||||||
ORDER BY c.id=1, LOWER(c.name||c.addr), c.id;",
|
ORDER BY c.id=1, c.last_seen DESC, c.id DESC;",
|
||||||
paramsv![chat_id],
|
paramsv![chat_id],
|
||||||
|row| row.get::<_, ContactId>(0),
|
|row| row.get::<_, ContactId>(0),
|
||||||
|ids| ids.collect::<Result<Vec<_>, _>>().map_err(Into::into),
|
|ids| ids.collect::<Result<Vec<_>, _>>().map_err(Into::into),
|
||||||
@@ -5456,8 +5456,8 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
chat_id.get_encryption_info(&alice).await?,
|
chat_id.get_encryption_info(&alice).await?,
|
||||||
"No encryption:\n\
|
"No encryption:\n\
|
||||||
bob@example.net\n\
|
fiona@example.net\n\
|
||||||
fiona@example.net"
|
bob@example.net"
|
||||||
);
|
);
|
||||||
|
|
||||||
let direct_chat = bob.create_chat(&alice).await;
|
let direct_chat = bob.create_chat(&alice).await;
|
||||||
|
|||||||
@@ -716,7 +716,7 @@ impl Contact {
|
|||||||
AND c.blocked=0 \
|
AND c.blocked=0 \
|
||||||
AND (iif(c.name='',c.authname,c.name) LIKE ? OR c.addr LIKE ?) \
|
AND (iif(c.name='',c.authname,c.name) LIKE ? OR c.addr LIKE ?) \
|
||||||
AND (1=? OR LENGTH(ps.verified_key_fingerprint)!=0) \
|
AND (1=? OR LENGTH(ps.verified_key_fingerprint)!=0) \
|
||||||
ORDER BY LOWER(iif(c.name='',c.authname,c.name)||c.addr),c.id;",
|
ORDER BY c.last_seen DESC, c.id DESC;",
|
||||||
sql::repeat_vars(self_addrs.len())
|
sql::repeat_vars(self_addrs.len())
|
||||||
),
|
),
|
||||||
rusqlite::params_from_iter(params_iter(&self_addrs).chain(params_iterv![
|
rusqlite::params_from_iter(params_iter(&self_addrs).chain(params_iterv![
|
||||||
@@ -768,7 +768,7 @@ impl Contact {
|
|||||||
AND id>?
|
AND id>?
|
||||||
AND origin>=?
|
AND origin>=?
|
||||||
AND blocked=0
|
AND blocked=0
|
||||||
ORDER BY LOWER(iif(name='',authname,name)||addr),id;",
|
ORDER BY last_seen DESC, id DESC;",
|
||||||
sql::repeat_vars(self_addrs.len())
|
sql::repeat_vars(self_addrs.len())
|
||||||
),
|
),
|
||||||
rusqlite::params_from_iter(params_iter(&self_addrs).chain(params_iterv![
|
rusqlite::params_from_iter(params_iter(&self_addrs).chain(params_iterv![
|
||||||
@@ -857,7 +857,7 @@ impl Contact {
|
|||||||
let list = context
|
let list = context
|
||||||
.sql
|
.sql
|
||||||
.query_map(
|
.query_map(
|
||||||
"SELECT id FROM contacts WHERE id>? AND blocked!=0 ORDER BY LOWER(iif(name='',authname,name)||addr),id;",
|
"SELECT id FROM contacts WHERE id>? AND blocked!=0 ORDER BY last_seen DESC, id DESC;",
|
||||||
paramsv![ContactId::LAST_SPECIAL],
|
paramsv![ContactId::LAST_SPECIAL],
|
||||||
|row| row.get::<_, ContactId>(0),
|
|row| row.get::<_, ContactId>(0),
|
||||||
|ids| {
|
|ids| {
|
||||||
|
|||||||
Reference in New Issue
Block a user