fix(UI-Overhaul-Phase1): 7 Bugs behoben
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
1.1 Contacts refresh: useUnifiedContacts mutations already invalidate (verified)
1.2 Contacts drag-drop: ContactList items already draggable + ContactFolderTree onDrop (verified)
1.3 Contacts move dialog: Added move-to-folder dropdown in ContactDetail
1.4 Wiki save refresh: Added refreshKey prop to WikiBrowser, triggers reload after save/delete
1.5 Calendar dialog close: Window.tsx now injects windowId into componentProps
1.6 Communication AI chat: Added metadata support to ConversationCreate schema + service,
frontend passes conversation_type metadata for AI/system chats,
categorization checks metadata first
1.7 Wiki duplicate menu: Removed hardcoded /wiki from Sidebar.tsx (plugin provides it dynamically)
Backend: kommunikation schema/routes/services updated for metadata support
Frontend: tsc clean, build successful
This commit is contained in:
@@ -89,6 +89,10 @@ type ConversationCategory = 'system' | 'ai' | 'colleague';
|
||||
// ─── Helpers ───
|
||||
|
||||
function categorizeConversation(conv: Conversation): ConversationCategory {
|
||||
// Check metadata first (most reliable for AI/system chats)
|
||||
const convType = conv.metadata?.conversation_type;
|
||||
if (convType === 'system') return 'system';
|
||||
if (convType === 'ai') return 'ai';
|
||||
// System messages: created by system participant type
|
||||
if (conv.participants.some(p => p.participant_type === 'system')) return 'system';
|
||||
// AI conversations: have an AI participant
|
||||
@@ -136,12 +140,13 @@ async function sendMessage(convId: string, content: string, replyToId?: string):
|
||||
return r.data;
|
||||
}
|
||||
|
||||
async function createConversation(title: string | null, participantIds: string[], isDirect: boolean, initialMessage?: string): Promise<Conversation> {
|
||||
async function createConversation(title: string | null, participantIds: string[], isDirect: boolean, initialMessage?: string, metadata?: Record<string, unknown>): Promise<Conversation> {
|
||||
const r = await apiClient.post('/comm/conversations', {
|
||||
title,
|
||||
participant_ids: participantIds,
|
||||
is_direct: isDirect,
|
||||
initial_message: initialMessage,
|
||||
metadata: metadata || {},
|
||||
});
|
||||
return r.data;
|
||||
}
|
||||
@@ -781,7 +786,11 @@ export function CommunicationPage() {
|
||||
try {
|
||||
const category = showNewChat;
|
||||
const isDirect = category === 'colleague' && participantIds.length === 1;
|
||||
const conv = await createConversation(title || null, participantIds, isDirect);
|
||||
const metadata: Record<string, unknown> =
|
||||
category === 'ai' ? { conversation_type: 'ai' } :
|
||||
category === 'system' ? { conversation_type: 'system' } :
|
||||
{};
|
||||
const conv = await createConversation(title || null, participantIds, isDirect, undefined, metadata);
|
||||
setConversations(prev => [...prev, conv]);
|
||||
setActiveConvId(conv.id);
|
||||
setMobileView('chat');
|
||||
|
||||
@@ -80,6 +80,7 @@ export function WikiPage() {
|
||||
const [deleteTarget, setDeleteTarget] = useState<WikiArticle | null>(null);
|
||||
const [deleting, setDeleting] = useState(false);
|
||||
const [restoring, setRestoring] = useState(false);
|
||||
const [browserRefreshKey, setBrowserRefreshKey] = useState(0);
|
||||
|
||||
const loadCategories = useCallback(async () => {
|
||||
try {
|
||||
@@ -163,6 +164,7 @@ export function WikiPage() {
|
||||
toast.success(t('knowledge.editor.created'));
|
||||
}
|
||||
setEditorOpen(false);
|
||||
setBrowserRefreshKey((k) => k + 1);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : t('knowledge.editor.saveError'));
|
||||
} finally {
|
||||
@@ -179,6 +181,7 @@ export function WikiPage() {
|
||||
setArticle(null);
|
||||
setSelectedArticleId(null);
|
||||
setDeleteTarget(null);
|
||||
setBrowserRefreshKey((k) => k + 1);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : t('knowledge.editor.deleteError'));
|
||||
} finally {
|
||||
@@ -237,7 +240,7 @@ export function WikiPage() {
|
||||
<div className="grid grid-cols-1 lg:grid-cols-4 gap-4 h-[calc(100vh-8rem)]">
|
||||
{/* Browser sidebar */}
|
||||
<div className="lg:col-span-1 border border-secondary-200 rounded-lg bg-white overflow-hidden">
|
||||
<WikiBrowser selectedArticleId={selectedArticleId} onSelectArticle={handleSelectArticle} />
|
||||
<WikiBrowser selectedArticleId={selectedArticleId} onSelectArticle={handleSelectArticle} refreshKey={browserRefreshKey} />
|
||||
</div>
|
||||
|
||||
{/* Article detail / editor */}
|
||||
|
||||
Reference in New Issue
Block a user