Show tagged global records in workspace views
This commit is contained in:
parent
4a1550acf6
commit
8010d6c601
|
|
@ -387,10 +387,13 @@
|
||||||
}
|
}
|
||||||
return api.settings.read().then(function (settings) {
|
return api.settings.read().then(function (settings) {
|
||||||
var scopedEvents = normalizeStoredEvents((settings || {})[scope.key], scope.key);
|
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) {
|
var legacyEvents = normalizeStoredEvents((settings || {})[LEGACY_KEY], LEGACY_KEY).filter(function (item) {
|
||||||
return item.workspaceRootPath === scope.workspaceRoot;
|
return item.workspaceRootPath === scope.workspaceRoot;
|
||||||
});
|
});
|
||||||
events = sortEvents(scopedEvents.concat(legacyEvents));
|
events = sortEvents(scopedEvents.concat(globalEvents, legacyEvents));
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
statusText = 'Could not load activity: ' + (err && err.message ? err.message : String(err));
|
statusText = 'Could not load activity: ' + (err && err.message ? err.message : String(err));
|
||||||
statusClass = 'error';
|
statusClass = 'error';
|
||||||
|
|
|
||||||
|
|
@ -421,10 +421,13 @@
|
||||||
}
|
}
|
||||||
return api.settings.read().then(function (settings) {
|
return api.settings.read().then(function (settings) {
|
||||||
var scopedCaptures = normalizeStoredCaptures((settings || {})[scope.key], scope.key);
|
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) {
|
var legacyCaptures = normalizeStoredCaptures((settings || {})[LEGACY_KEY], LEGACY_KEY).filter(function (item) {
|
||||||
return item.workspaceRootPath === scope.workspaceRoot;
|
return item.workspaceRootPath === scope.workspaceRoot;
|
||||||
});
|
});
|
||||||
captures = sortCaptures(scopedCaptures.concat(legacyCaptures));
|
captures = sortCaptures(scopedCaptures.concat(globalCaptures, legacyCaptures));
|
||||||
if (!selectedId && captures[0]) selectedId = captures[0].captureId;
|
if (!selectedId && captures[0]) selectedId = captures[0].captureId;
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
statusText = 'Could not load inbox: ' + (err && err.message ? err.message : String(err));
|
statusText = 'Could not load inbox: ' + (err && err.message ? err.message : String(err));
|
||||||
|
|
|
||||||
|
|
@ -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 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');
|
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');
|
console.log('activity plugin smoke passed');
|
||||||
})().catch((err) => {
|
})().catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,28 @@ async function mountWithApi(api, props = { workspaceNode: { name: 'Project' }, w
|
||||||
throw new Error('legacy global capture leaked into workspace view');
|
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');
|
console.log('browser inbox plugin smoke passed');
|
||||||
})().catch((err) => {
|
})().catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue