feat(messaging): implement three-tier reply message lazy loading with offline fallback
Add lazy loading pipeline for reply message previews that checks memory → SQLite → server in order, enabling offline hit and graceful degradation for deleted/inaccessible messages. Includes `getReplyMessage` API endpoint and `jumpToMessageSeq` helper for navigation to referenced messages.
feat(create): extract MomentComposer and LongPostComposer for dual posting modes
Refactor CreatePostScreen shell to delegate content editing to specialized composers based on postMode ('moment' or 'long'), enabling long posts with voting support. Add expandable FAB with mode selection on HomeScreen.
fix(navigation): use navigate instead of push to prevent duplicate chat instances
Replace router.push with router.navigate in notification bootstrap to avoid creating duplicate chat instances when already on the chat screen.
fix(ui): update author badge styling with proper text contrast
Change author badge background to use hex transparency and add dedicated text color for better readability on both light and dark themes.
chore: normalize filename handling in file uploads and improve file segment rendering
Use asset.name as authoritative filename, remove redundant shadows from file cards inside bubbles.
This commit is contained in:
@@ -305,6 +305,33 @@ class MessageService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按消息 ID 获取被引用消息(用于引用预览回填/跳转)
|
||||
* 后端鉴权:必须是该会话参与者,否则返回错误。
|
||||
* @param messageId 被引用消息的 ID
|
||||
*/
|
||||
async getReplyMessage(messageId: string): Promise<MessageResponse | null> {
|
||||
try {
|
||||
const response = await api.get<MessageResponse>(
|
||||
`/messages/${encodeURIComponent(messageId)}`
|
||||
);
|
||||
return response.data ?? null;
|
||||
} catch (error: any) {
|
||||
// 消息不存在或无权限(已被删除/不可见)——引用回填的常见降级场景
|
||||
const errorMessage = error?.message || String(error);
|
||||
if (
|
||||
errorMessage.includes('not found') ||
|
||||
errorMessage.includes('no permission') ||
|
||||
error?.code === 'NOT_FOUND' ||
|
||||
error?.code === 'FORBIDDEN'
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
console.error('[MessageService] 获取被引用消息失败:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息(新格式)
|
||||
* 优先使用WebSocket发送,失败时降级到HTTP
|
||||
|
||||
Reference in New Issue
Block a user