diff --git a/plugins/activity/frontend/src/index.js b/plugins/activity/frontend/src/index.js index 10858c5..70781b4 100644 --- a/plugins/activity/frontend/src/index.js +++ b/plugins/activity/frontend/src/index.js @@ -387,10 +387,13 @@ } return api.settings.read().then(function (settings) { var scopedEvents = normalizeStoredEvents((settings || {})[scope.key], scope.key); + var globalEvents = normalizeStoredEvents((settings || {})[GLOBAL_KEY], GLOBAL_KEY).filter(function (item) { + return item.workspaceRootPath === scope.workspaceRoot; + }); var legacyEvents = normalizeStoredEvents((settings || {})[LEGACY_KEY], LEGACY_KEY).filter(function (item) { return item.workspaceRootPath === scope.workspaceRoot; }); - events = sortEvents(scopedEvents.concat(legacyEvents)); + events = sortEvents(scopedEvents.concat(globalEvents, legacyEvents)); }).catch(function (err) { statusText = 'Could not load activity: ' + (err && err.message ? err.message : String(err)); statusClass = 'error'; diff --git a/plugins/browser-inbox/frontend/src/index.js b/plugins/browser-inbox/frontend/src/index.js index 3fe715e..197a43a 100644 --- a/plugins/browser-inbox/frontend/src/index.js +++ b/plugins/browser-inbox/frontend/src/index.js @@ -421,10 +421,13 @@ } return api.settings.read().then(function (settings) { var scopedCaptures = normalizeStoredCaptures((settings || {})[scope.key], scope.key); + var globalCaptures = normalizeStoredCaptures((settings || {})[GLOBAL_KEY], GLOBAL_KEY).filter(function (item) { + return item.workspaceRootPath === scope.workspaceRoot; + }); var legacyCaptures = normalizeStoredCaptures((settings || {})[LEGACY_KEY], LEGACY_KEY).filter(function (item) { return item.workspaceRootPath === scope.workspaceRoot; }); - captures = sortCaptures(scopedCaptures.concat(legacyCaptures)); + captures = sortCaptures(scopedCaptures.concat(globalCaptures, legacyCaptures)); if (!selectedId && captures[0]) selectedId = captures[0].captureId; }).catch(function (err) { statusText = 'Could not load inbox: ' + (err && err.message ? err.message : String(err)); diff --git a/scripts/smoke-activity-plugin.js b/scripts/smoke-activity-plugin.js index 8fee102..f0d1f99 100644 --- a/scripts/smoke-activity-plugin.js +++ b/scripts/smoke-activity-plugin.js @@ -266,6 +266,23 @@ async function mountWithApi(api, props = { workspaceNode: { name: 'Project' }, w if (!legacyProject.container.textContent.includes('Legacy project note')) throw new Error('legacy workspace activity was not rendered in matching workspace'); if (legacyProject.container.textContent.includes('Legacy global capture')) throw new Error('legacy global activity leaked into workspace view'); + const taggedGlobalApi = makeApi({ + 'events:global': [ + { + activityId: 'global-project', + type: 'browser.capture.page', + title: 'Global project capture', + occurredAt: '2026-06-27T03:00:00Z', + sourcePluginId: 'verstak.browser-inbox', + workspaceRootPath: 'Project', + }, + ], + }); + const taggedGlobalProject = await mountWithApi(taggedGlobalApi, { workspaceNode: { name: 'Project' }, workspaceRootPath: 'Project' }); + if (!taggedGlobalProject.container.textContent.includes('Global project capture')) throw new Error('workspace did not render workspace-tagged global activity'); + const taggedGlobalClient = await mountWithApi(taggedGlobalApi, { workspaceNode: { name: 'ClientA' }, workspaceRootPath: 'ClientA' }); + if (taggedGlobalClient.container.textContent.includes('Global project capture')) throw new Error('workspace-tagged global activity leaked into another workspace'); + console.log('activity plugin smoke passed'); })().catch((err) => { console.error(err); diff --git a/scripts/smoke-browser-inbox-plugin.js b/scripts/smoke-browser-inbox-plugin.js index 4453aaa..ba1b556 100644 --- a/scripts/smoke-browser-inbox-plugin.js +++ b/scripts/smoke-browser-inbox-plugin.js @@ -312,6 +312,28 @@ async function mountWithApi(api, props = { workspaceNode: { name: 'Project' }, w throw new Error('legacy global capture leaked into workspace view'); } + const taggedGlobalApi = makeApi({ + 'captures:global': [ + { + captureId: 'global-project-capture', + capturedAt: '2026-06-27T03:00:00.000Z', + kind: 'page', + url: 'https://project.example.com/global', + title: 'Global Project Capture', + domain: 'project.example.com', + workspaceRootPath: 'Project', + }, + ], + }); + const taggedGlobalProject = await mountWithApi(taggedGlobalApi, { workspaceNode: { name: 'Project' }, workspaceRootPath: 'Project' }); + if (!walk(taggedGlobalProject.container, (node) => node.getAttribute && node.getAttribute('data-browser-capture-id') === 'global-project-capture')) { + throw new Error('workspace did not render workspace-tagged global capture'); + } + const taggedGlobalClient = await mountWithApi(taggedGlobalApi, { workspaceNode: { name: 'ClientA' }, workspaceRootPath: 'ClientA' }); + if (walk(taggedGlobalClient.container, (node) => node.getAttribute && node.getAttribute('data-browser-capture-id') === 'global-project-capture')) { + throw new Error('workspace-tagged global capture leaked into another workspace'); + } + console.log('browser inbox plugin smoke passed'); })().catch((err) => { console.error(err);