message migration fix
This commit is contained in:
parent
9074582a27
commit
654d63c407
2 changed files with 11 additions and 5 deletions
|
|
@ -225,6 +225,12 @@ class MigrationState:
|
||||||
if self._ensure_db():
|
if self._ensure_db():
|
||||||
self.db.update_channel_tracking(str(target_channel_id), last_msg_id=str(message_id))
|
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:
|
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)."""
|
"""Returns the absolute minimum last_msg_id among the given list of mapped target IDs (channels and threads)."""
|
||||||
|
|
|
||||||
|
|
@ -1105,6 +1105,11 @@ class OperationPane(Container):
|
||||||
source_channel = next(c for c in d_channels if c.id == src_id)
|
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)
|
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)
|
# Determine after_id status (skip for pending channels)
|
||||||
if pending_create_name:
|
if pending_create_name:
|
||||||
last_migrated = None
|
last_migrated = None
|
||||||
|
|
@ -1113,11 +1118,6 @@ class OperationPane(Container):
|
||||||
last_migrated = self.engine.state.get_last_message_id(str(target_channel.get('id')))
|
last_migrated = self.engine.state.get_last_message_id(str(target_channel.get('id')))
|
||||||
has_previous = bool(last_migrated)
|
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)
|
src_server = getattr(self.engine.discord_reader, 'guild', None)
|
||||||
tgt_server_info = await self.engine.writer.validate()
|
tgt_server_info = await self.engine.writer.validate()
|
||||||
tgt_server_name = tgt_server_info.get("community_name", "target community")
|
tgt_server_name = tgt_server_info.get("community_name", "target community")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue