Skip to content

Commit

Permalink
Merge b0e49fb into 6647661
Browse files Browse the repository at this point in the history
  • Loading branch information
stavmars committed Oct 24, 2018
2 parents 6647661 + b0e49fb commit eb54371
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions application/lib/xapiUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ const self = module.exports = {
language: activity.content.language,
};

let categories, parents;

let tags = activity.content.tags;
if (tags && tags.length > 0) {
let categories = tags.map((tag) => {
categories = tags.map((tag) => {
return {
id: `${Microservices.platform.uri}/deckfamily/${tag.tagName}`,
objectType: 'Activity',
Expand All @@ -64,8 +66,25 @@ const self = module.exports = {
},
};
});
context.contextActivities = {category: categories};
}

if (activity.content_root_id && (activity.content_kind !== 'deck' || activity.content_id !== activity.content_root_id)) {
parents = [{
objectType: 'Activity',
id: `${Microservices.platform.uri}/deck/${activity.content_root_id}`,
}];
}

if (categories || parents) {
context.contextActivities = {};
if (categories) {
context.contextActivities.category = categories;
}
if (parents) {
context.contextActivities.parent = parents;
}
}

return context;
},

Expand Down

0 comments on commit eb54371

Please sign in to comment.