add tag task and varioius cleanup

This commit is contained in:
Dave Horton
2020-01-29 15:27:20 -05:00
parent bed4fa1f42
commit 92acd50595
17 changed files with 278 additions and 111 deletions

View File

@@ -58,7 +58,14 @@ class Task extends Emitter {
async performAction(method, auth, results) {
if (this.action) {
const tasks = await this.actionHook(this.action, method, auth, results);
let action = this.action;
if (action.startsWith('/')) {
const or = this.callSession.originalRequest;
action = `${or.baseUrl}${this.action}`;
this.logger.debug({originalUrl: this.action, normalizedUrl: action}, 'Task:performAction normalized url');
if (!auth && or.auth) auth = or.auth;
}
const tasks = await this.actionHook(action, method, auth, results);
if (tasks && Array.isArray(tasks)) {
this.logger.debug({tasks: tasks}, `${this.name} replacing application with ${tasks.length} tasks`);
this.callSession.replaceApplication(tasks);