Skip to content

Commit 87fba5d

Browse files
authored
Merge branch 'main' into unread-badge
2 parents 5b3061b + 1606008 commit 87fba5d

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ setup-ci:
1616
make generate-sql
1717

1818
sync: sync-server sync-web sync-root sync-common
19-
lefthook install || true
19+
bunx lefthook install || true
2020
@echo '----------------------------------------------------------------------------------------------------------'
2121
@echo '| Most work is done. now running prisma-generate-sql (which might fail if .env.dev is not set configured)|'
2222
@echo '----------------------------------------------------------------------------------------------------------'

flake.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@
2828
pkg-config
2929
openssl
3030
lefthook
31-
pkgs.prisma
31+
pkgs.
3232
] ++ [
3333
rust-pkgs
3434
];
3535
shellHook = ''
3636
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib
37-
lefthook install
3837
'' + prisma.shellHook;
3938
};
4039
});

server/src/database/chat.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,20 @@ export async function getOverview(
7171
return overview;
7272
});
7373

74-
return Ok([
74+
const overview = [
7575
...matchingOverview,
7676
...senderOverview,
7777
...receiverOverview,
7878
...shared,
79-
]);
79+
];
80+
81+
const sortedOverviewByTime = overview.sort((a, b) => {
82+
const dateA = a.lastMsg?.createdAt ? a.lastMsg.createdAt.getTime() : 0;
83+
const dateB = b.lastMsg?.createdAt ? b.lastMsg.createdAt.getTime() : 0;
84+
return dateB - dateA;
85+
});
86+
87+
return Ok([...sortedOverviewByTime]);
8088
} catch (e) {
8189
return Err(e);
8290
}

0 commit comments

Comments
 (0)