Pinned chats keep their order, regardless of messaging activity in them.
Actual behavior
Pinned chats are sorted by most recent message in them.
Otherwise they’re not really “pinned”. If you pin them, you’d want them to always be where they are. As a nice side-effect, even without the “drag and drop” feature (Drag and sort pinned chat) you’d have control over where they end up, by pinning / unpinning in sequence you’d like.
In addition, this would be a really nice thing to add shortcuts for (Ctrl + 1 / Ctrl + 2).
I have tested Signal, it seems to work the same as Delta Chat currently, there is no way to drag and move pinned chats and “pinned” section seems to be sorted the same way as unpinned. I have not tested if receiving a message in already pinned chat reorders it.
As for the core algorithm, we can sort pinned chats by the timestamp of pinning (will have to introduce a new database column) and default it to the timestamp of chat creation (it already exists and is stable, also likely roughly the same for all devices). Then it will be possible to also drag the chats by changing their pinned timestamp to the middle timestamp between the chat above and below.
Right, I wanted to mention that Telegram (which IMO offers the best UX among messengers) keeps the order of pinned chats.
WhatsApp Android and Desktop also don’t re-order chats based on activity. When you pin a chat, it goes to the very top of pinned chats and stays in place until you pin / unpin other chats. And there is no way to drag them.
Edit: Signal Android also doesn’t reorder pinned chats based on activity.
FYI I saw this algorithm in Vikunja.
Maybe it’d be simpler to just update the entire table, since there is not supposed to be a ton of pinned chats.
How about allow the user to set a “pin index” or “pin priority” for each chat when pinning it. Then newer chats can be automatically re-ordered above older chats with the same pin index/priority, but never moved above chats with a different pin index/priority.
This system would give the most flexibility, and users could emulate the pin behavior of Telegram and WhatsApp (by setting a unique pin index/priority for each pinned chat), emulate the current behavior (by setting the same pin index/priority for each pinned chat), or have a hybrid of the two.
I like the pinned chats as it is, re-ordering by recent activity makes sense otherwise I would need to spend a lot of time then reordering pinned chats
What @link2xt suggested sounds achievable with something close to what @link2xt suggested.
But I’d say that it should be considered as a separate feature.
pinned chats are important chats I want always at the top, not to get thrown in the lot of chats with new messages, often between 3-4 maximum, ex family chat, saved messages chat for quick access to notes, and temporarily I may pin some chat that has something to-do and requires my attention but I can’t do it at the moment.