UBERF-4136: Fix global actions (#3961)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-11-09 15:25:44 +07:00 committed by GitHub
parent d17a476af4
commit 6dc01fb12a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -207,7 +207,7 @@ export function createActions (builder: Builder, issuesId: string, componentsId:
keyBinding: ['keyC'],
input: 'none',
category: tracker.category.Tracker,
target: tracker.class.Issue,
target: core.class.Doc,
context: {
mode: ['browser'],
application: tracker.app.Tracker,

View File

@ -89,9 +89,16 @@
const docs = getSelection($focusStore, $selectionStore)
let fActions: WithLookup<Action>[] = actions
// We need to filter application based actions first, to prevent override for globals
fActions = fActions.filter(
(it) =>
(it.$lookup?.category?.visible ?? true) &&
(it.context.application === viewContext.application || it.context.application === undefined)
)
for (const d of docs) {
fActions = filterActions(client, d, fActions)
}
if (docs.length === 0) {
fActions = fActions.filter((it) => it.input === 'none')
const overrideRemove: Array<Ref<Action>> = []
@ -102,11 +109,6 @@
}
fActions = fActions.filter((it) => !overrideRemove.includes(it._id))
}
fActions = fActions.filter(
(it) =>
(it.$lookup?.category?.visible ?? true) &&
(it.context.application === viewContext.application || it.context.application === undefined)
)
fActions = await filterVisibleActions(fActions, docs)
// Sort by category.
supportedActions = fActions.sort((a, b) => a.category.localeCompare(b.category))