@way_marks/server 4.2.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/server.js
CHANGED
|
@@ -382,10 +382,16 @@ app.post('/api/slack/interact', async (req, res) => {
|
|
|
382
382
|
const actionValue = slackAction.value; // waymark action_id
|
|
383
383
|
if (actionId === 'waymark_approve') {
|
|
384
384
|
const result = await (0, handler_1.approvePendingAction)(actionValue, 'slack');
|
|
385
|
+
if (result.success) {
|
|
386
|
+
(0, events_1.emit)('actions', { action_id: actionValue, kind: 'approved' });
|
|
387
|
+
}
|
|
385
388
|
return res.json({ text: result.success ? '✅ Approved by slack' : `❌ Error: ${result.error}` });
|
|
386
389
|
}
|
|
387
390
|
if (actionId === 'waymark_reject') {
|
|
388
391
|
const result = await (0, handler_1.rejectPendingAction)(actionValue, 'Rejected via Slack');
|
|
392
|
+
if (result.success) {
|
|
393
|
+
(0, events_1.emit)('actions', { action_id: actionValue, kind: 'rejected' });
|
|
394
|
+
}
|
|
389
395
|
return res.json({ text: result.success ? '❌ Rejected by slack' : `❌ Error: ${result.error}` });
|
|
390
396
|
}
|
|
391
397
|
res.status(400).json({ error: `Unknown action_id: ${actionId}` });
|
package/dist/approval/manager.js
CHANGED
|
@@ -142,7 +142,7 @@ function submitApprovalDecision(request_id, approver_id, decision, reason) {
|
|
|
142
142
|
}
|
|
143
143
|
// Verify approver is authorized for this request
|
|
144
144
|
const approvers = JSON.parse(request.approver_ids);
|
|
145
|
-
if (!approvers.includes(approver_id)) {
|
|
145
|
+
if (approvers.length > 0 && !approvers.includes(approver_id)) {
|
|
146
146
|
throw new Error(`${approver_id} is not authorized to approve this request`);
|
|
147
147
|
}
|
|
148
148
|
// Check if already decided by this approver
|