Skip to content

Commit

Permalink
Fix recent sorting difference with webapp (#7632)
Browse files Browse the repository at this point in the history
  • Loading branch information
larkox authored Oct 26, 2023
1 parent 196372e commit 01fdd1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/utils/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ const sortChannelsByName = (notifyPropsPerChannel: Record<string, Partial<Channe
export const sortChannels = (sorting: CategorySorting, channelsWithMyChannel: ChannelWithMyChannel[], notifyPropsPerChannel: Record<string, Partial<ChannelNotifyProps>>, locale: string) => {
if (sorting === 'recent') {
return channelsWithMyChannel.sort((cwmA, cwmB) => {
return cwmB.myChannel.lastPostAt - cwmA.myChannel.lastPostAt;
const a = Math.max(cwmA.myChannel.lastPostAt, cwmA.channel.createAt);
const b = Math.max(cwmB.myChannel.lastPostAt, cwmB.channel.createAt);
return b - a;
}).map((cwm) => cwm.channel);
} else if (sorting === 'manual') {
return channelsWithMyChannel.sort((cwmA, cwmB) => {
Expand Down

0 comments on commit 01fdd1f

Please sign in to comment.