🐛 Fix the damn post loading

This commit is contained in:
2025-08-05 22:31:02 +08:00
parent 7367f372c0
commit 256c6469a6

View File

@@ -678,7 +678,8 @@ public partial class PostService(
// Find the index of the poll embed first
var pollIndex = embeds.FindIndex(e =>
e.ContainsKey("Type") && ((JsonElement)e["Type"]).ToString() == "poll");
e.ContainsKey("Type") && ((JsonElement)e["Type"]).ToString() == "poll"
);
if (pollIndex < 0) return;
@@ -687,9 +688,10 @@ public partial class PostService(
{
var pollId = Guid.Parse(((JsonElement)pollEmbed["Id"]).ToString());
var currentUserId = currentUser is not null ? Guid.Parse(currentUser.Id) : (Guid?)null;
Guid? currentUserId = currentUser is not null ? Guid.Parse(currentUser.Id) : null;
var updatedPoll = await polls.LoadPollEmbed(pollId, currentUserId);
embeds[pollIndex] = updatedPoll.ToDictionary();
post.Meta["embeds"] = embeds;
}
catch (Exception ex)
{