Components autoupdate

This commit is contained in:
Mo Bitar
2017-12-25 12:16:06 -06:00
parent f4352253c3
commit 2702d88bc2
3 changed files with 26 additions and 3 deletions

View File

@@ -44,8 +44,14 @@ class ComponentManager {
var syncedComponents = allItems.filter(function(item){return item.content_type === "SN|Component" });
// Ensure any component in our data is installed by the system
this.desktopManager.syncComponentsInstallation(syncedComponents);
/* We only want to sync if the item source is Retrieved, not MappingSourceRemoteSaved to avoid
recursion caused by the component being modified and saved after it is updated.
*/
if(syncedComponents.length > 0 && source != ModelManager.MappingSourceRemoteSaved) {
console.log("Web, Syncing Components", syncedComponents, "source", source);
// Ensure any component in our data is installed by the system
this.desktopManager.syncComponentsInstallation(syncedComponents);
}
for(var component of syncedComponents) {
var activeComponent = _.find(this.activeComponents, {uuid: component.uuid});
@@ -61,6 +67,10 @@ class ComponentManager {
return observer.contentTypes.indexOf(item.content_type) !== -1;
})
if(relevantItems.length == 0) {
continue;
}
var requiredPermissions = [
{
name: "stream-items",