diff --git a/lib/widgets/post/compose_shared.dart b/lib/widgets/post/compose_shared.dart index 78198ed3..0e7eff1d 100644 --- a/lib/widgets/post/compose_shared.dart +++ b/lib/widgets/post/compose_shared.dart @@ -104,6 +104,22 @@ class ComposeLogic { // Initialize categories from original post final categories = originalPost?.categories ?? []; + // Extract poll and fund IDs from embeds + String? pollId; + String? fundId; + if (originalPost?.meta?['embeds'] is List) { + final embeds = + (originalPost!.meta!['embeds'] as List).cast>(); + try { + final pollEmbed = embeds.firstWhere((e) => e['type'] == 'poll'); + pollId = pollEmbed['id']; + } catch (_) {} + try { + final fundEmbed = embeds.firstWhere((e) => e['type'] == 'fund'); + fundId = fundEmbed['id']; + } catch (_) {} + } + return ComposeState( attachments: ValueNotifier>( originalPost?.attachments @@ -137,10 +153,8 @@ class ComposeLogic { embedView: ValueNotifier(originalPost?.embedView), draftId: id, postType: postType, - // initialize without poll by default - pollId: null, - // initialize without fund by default - fundId: null, + pollId: pollId, + fundId: fundId, ); }