⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
feat: read quick actions without the actions permission (#80)
Croffc1a3cbc6e8c1
diff --git a/apps/api/src/actions/__tests__/integration/actions.test.ts b/apps/api/src/actions/__tests__/integration/actions.test.tsindex 95c96470..82e3485f 100644--- a/apps/api/src/actions/__tests__/integration/actions.test.ts+++ b/apps/api/src/actions/__tests__/integration/actions.test.ts@@ -10,6 +10,17 @@ async function setupOwnerProject() {return { asOwner, projectId: project.data!.id };}+// Adds a member on the default role, which grants no `actions` permission.+async function addDefaultMember(asOwner: ReturnType<typeof authedApi>) {+ const user = await signUpTestUser();+ const invite = await asOwner+ .projects({ projectKey: 'MKT' })+ .invites.post({ email: user.email, role: 'member' });+ const asMember = authedApi(user.cookie);+ await asMember.invites({ token: invite.data!.token }).accept.post();+ return asMember;+}+describe('actions', () => {beforeEach(async () => {await resetDb();@@ -83,6 +94,41 @@ describe('actions', () => {});});+ describe('quick list', () => {+ it('lets a member without the actions permission read it, in saved order', async () => {+ const { asOwner } = await setupOwnerProject();+ const a = (await asOwner.projects({ projectKey: 'MKT' }).actions.post({ name: 'A' })).data!;+ const b = (await asOwner.projects({ projectKey: 'MKT' }).actions.post({ name: 'B' })).data!;+ await asOwner+ .projects({ projectKey: 'MKT' })+ .actions.reorder.put({ orderedIds: [b.id, a.id] });++ const asMember = await addDefaultMember(asOwner);++ const settingsList = await asMember.projects({ projectKey: 'MKT' }).actions.get();+ expect(settingsList.status).toBe(403);++ const quick = await asMember.projects({ projectKey: 'MKT' }).actions.quick.get();+ expect(quick.status).toBe(200);+ expect(quick.data?.map((r) => r.id)).toEqual([b.id, a.id]);+ });++ it('denies a non-member', async () => {+ const { asOwner } = await setupOwnerProject();+ await asOwner.projects({ projectKey: 'MKT' }).actions.post({ name: 'Secret' });++ const outsider = authedApi((await signUpTestUser()).cookie);+ const quick = await outsider.projects({ projectKey: 'MKT' }).actions.quick.get();+ expect(quick.status).toBe(403);+ });++ it('returns 404 for an unknown project', async () => {+ const { asOwner } = await setupOwnerProject();+ const res = await asOwner.projects({ projectKey: 'NOPE' }).actions.quick.get();+ expect(res.status).toBe(404);+ });+ });+describe('update', () => {it('updates only the provided fields, replacing condition/effect wholesale', async () => {const { asOwner } = await setupOwnerProject();diff --git a/apps/api/src/actions/routes.ts b/apps/api/src/actions/routes.tsindex 8c17a389..d7392e85 100644--- a/apps/api/src/actions/routes.ts+++ b/apps/api/src/actions/routes.ts@@ -62,6 +62,29 @@ export const actionRoutes = new Elysia({ name: 'actions', detail: { tags: ['Acti},)+ // The same list, readable by any project member. The issue quick actions (board+ // context menu, issue detail) run off it, so a member who cannot manage actions+ // still sees the ones that apply to an issue.+ .get(+ '/projects/:projectKey/actions/quick',+ async ({ project }) => {+ return listActions(project.id);+ },+ {+ projectMember: true,+ response: {+ 200: t.Array(ActionResponse),+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: 'List quick actions',+ description: "List a project's actions for the issue quick actions.",+ },+ },+ )+.post('/projects/:projectKey/actions',async ({ project, body, set }) => {diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex eb2ee3dd..5e789f27 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -2472,7 +2472,10 @@ export const api = {rejectInvite: (token: string) =>request<void>(`/invites/${encodeURIComponent(token)}/reject`, { method: 'POST' }),- listActions: (projectKey: string) => request<ActionDef[]>(`/projects/${projectKey}/actions`),+ // The action list any project member may read; the permissioned list route is+ // for API/MCP callers.+ listQuickActions: (projectKey: string) =>+ request<ActionDef[]>(`/projects/${projectKey}/actions/quick`),createAction: (projectKey: string, input: NewActionInput) =>request<ActionDef>(`/projects/${projectKey}/actions`, {method: 'POST',diff --git a/apps/web/src/services/actions.service.ts b/apps/web/src/services/actions.service.tsindex d1868b8e..6011e86b 100644--- a/apps/web/src/services/actions.service.ts+++ b/apps/web/src/services/actions.service.ts@@ -16,10 +16,12 @@ export function normalizeAction(a: ActionDef): ActionDef {};}+// Reads the member-accessible list, so the issue quick actions work for a member+// without the `actions` read permission. Managing actions still requires it.export function useActionsQuery(projectKey: string | null) {return useQuery({queryKey: qk.actions(projectKey ?? ''),- queryFn: () => api.listActions(projectKey!),+ queryFn: () => api.listQuickActions(projectKey!),enabled: projectKey != null,select: (rows) => rows.map(normalizeAction),});