a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend] Give scheduled notes an ID based on their publish time, for proper sorting

Kopper 1aefbcea 344c3cd9

+12 -1
+12 -1
Iceshrimp.Backend/Core/Services/NoteService.cs
··· 45 45 { 46 46 private const int DefaultRecursionLimit = 100; 47 47 48 + // https://misskey-hub.net/en/tools/aid-converter/ 49 + // this seems to be the timestamp for 'zzzzzzzzzzzzzzzz'. anything newer i would expect something to break 50 + private static DateTime _scheduleIdTimeLimit = new DateTime(2089, 05, 24); 51 + 48 52 private static readonly AsyncKeyedLocker<string> KeyedLocker = new(o => 49 53 { 50 54 o.PoolSize = 100; ··· 276 280 throw GracefulException.UnprocessableEntity("Refusing to create a pure renote reply"); 277 281 } 278 282 279 - var noteId = data.Preview ? "preview" : IdHelpers.GenerateSnowflakeId(data.CreatedAt); 283 + // we need the note ids to sort correctly, but we also don't want to limit clients to a specific time 284 + // as some clients have "drafts" that are posts scheduled for absurd years. let's assume that if you're scheduling 285 + // something like that you don't care where it'll be sorted (not that we'll *actually* schedule it anyways, see ScheduleNoteAsync) 286 + var idTimestamp = data.ScheduledAt != null && data.ScheduledAt < _scheduleIdTimeLimit 287 + ? data.ScheduledAt 288 + : data.CreatedAt; 289 + 290 + var noteId = data.Preview ? "preview" : IdHelpers.GenerateSnowflakeId(idTimestamp); 280 291 var threadId = data.Reply?.ThreadId ?? noteId; 281 292 282 293 var context = data.ASNote?.Context;