Skip to content

Commit 78aa253

Browse files
committed
fix(docs): show owned documents in group sections too
Documents shared with a group by the owner now appear in both the personal and group sections. Previously the if/else logic was exclusive, so owner documents with group_shares only showed in personal.
1 parent 89eb493 commit 78aa253

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

apps/web/src/features/docs/DocsPage.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,25 +264,25 @@ function DocumentsContent() {
264264
for (const doc of documents) {
265265
if (!matchesSearch(doc.title)) continue;
266266

267-
if (doc.access_type === 'group' && doc.group_shares?.length) {
267+
const item: UnifiedItem = {
268+
kind: 'document',
269+
data: doc,
270+
sortKey: new Date(doc.updated_at).getTime(),
271+
};
272+
273+
if (doc.access_type !== 'group') {
274+
personal.push(item);
275+
}
276+
277+
if (doc.group_shares?.length) {
268278
for (const gs of doc.group_shares) {
269279
let entry = groupMap.get(gs.group_id);
270280
if (!entry) {
271281
entry = { groupName: gs.group_name, docs: [] };
272282
groupMap.set(gs.group_id, entry);
273283
}
274-
entry.docs.push({
275-
kind: 'document',
276-
data: doc,
277-
sortKey: new Date(doc.updated_at).getTime(),
278-
});
284+
entry.docs.push({ ...item });
279285
}
280-
} else {
281-
personal.push({
282-
kind: 'document',
283-
data: doc,
284-
sortKey: new Date(doc.updated_at).getTime(),
285-
});
286286
}
287287
}
288288

0 commit comments

Comments
 (0)