From 654d63c407701c070fcb959812e905176fabba60 Mon Sep 17 00:00:00 2001 From: rambros Date: Sat, 28 Mar 2026 20:15:20 +0530 Subject: [PATCH] message migration fix --- src/core/state.py | 6 ++++++ src/ui/shuttle_ops.py | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/state.py b/src/core/state.py index adb46ec..eb816c5 100644 --- a/src/core/state.py +++ b/src/core/state.py @@ -225,6 +225,12 @@ class MigrationState: if self._ensure_db(): self.db.update_channel_tracking(str(target_channel_id), last_msg_id=str(message_id)) + def get_last_message_id(self, target_channel_id: str) -> str | None: + if self._ensure_db(): + tracking = self.db.get_channel_tracking(str(target_channel_id)) + return tracking.get("last_msg_id") if tracking else None + return None + def get_global_min_last_message_id(self, all_mapped_ids: List[str]) -> int | None: """Returns the absolute minimum last_msg_id among the given list of mapped target IDs (channels and threads).""" diff --git a/src/ui/shuttle_ops.py b/src/ui/shuttle_ops.py index 1e810d6..fc17583 100644 --- a/src/ui/shuttle_ops.py +++ b/src/ui/shuttle_ops.py @@ -1105,6 +1105,11 @@ class OperationPane(Container): source_channel = next(c for c in d_channels if c.id == src_id) target_channel = next(c for c in f_channels if c.get("id") == tgt_id) + # 2. Analyze + modal = ProgressScreen(log_level=self.config.log_level) + self.app.push_screen(modal) + await asyncio.sleep(0.1) + # Determine after_id status (skip for pending channels) if pending_create_name: last_migrated = None @@ -1112,11 +1117,6 @@ class OperationPane(Container): else: last_migrated = self.engine.state.get_last_message_id(str(target_channel.get('id'))) has_previous = bool(last_migrated) - - # Analyze - modal = ProgressScreen(log_level=self.config.log_level) - self.app.push_screen(modal) - await asyncio.sleep(0.1) src_server = getattr(self.engine.discord_reader, 'guild', None) tgt_server_info = await self.engine.writer.validate()