fix(bot): don't crash when sorting by last message and last message is null

This commit is contained in:
spiral 2022-12-15 01:04:46 +00:00
parent 74d621455a
commit b1586c88e1
No known key found for this signature in database
GPG Key ID: 244A11E4B0BCF40E

View File

@ -132,7 +132,7 @@ public static class ListOptionsExt
.ThenBy(m => m.BirthdayPrivacy.Get(ctx, m.AnnualBirthday), ReverseMaybe(Comparer<AnnualDate?>.Default)), .ThenBy(m => m.BirthdayPrivacy.Get(ctx, m.AnnualBirthday), ReverseMaybe(Comparer<AnnualDate?>.Default)),
SortProperty.LastMessage => input SortProperty.LastMessage => input
.OrderByDescending(m => m.LastMessageTimestamp.HasValue) .OrderByDescending(m => m.LastMessageTimestamp.HasValue)
.ThenByDescending(m => m.LastMessageTimestamp!.Value, ReverseMaybe(Comparer<Instant?>.Default)), .ThenByDescending(m => m.LastMessageTimestamp, ReverseMaybe(Comparer<Instant?>.Default)),
SortProperty.LastSwitch => input SortProperty.LastSwitch => input
.OrderByDescending(m => m.LastSwitchTime.HasValue && m.MetadataPrivacy.CanAccess(ctx)) .OrderByDescending(m => m.LastSwitchTime.HasValue && m.MetadataPrivacy.CanAccess(ctx))
.ThenByDescending(m => m.MetadataPrivacy.Get(ctx, m.LastSwitchTime), ReverseMaybe(Comparer<Instant?>.Default)), .ThenByDescending(m => m.MetadataPrivacy.Get(ctx, m.LastSwitchTime), ReverseMaybe(Comparer<Instant?>.Default)),