uprtcl / js-uprtcl

Libraries, tools and modules to create _Prtcl web apps

Home Page:http://www.uprtcl.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue when accepting a proposal

pepoospina opened this issue · comments

commented

When a proposal is listed and accepted by the toPerspective owner (or editor), there is an error shown in the backend mentioning that the access control of an object is not defined.

This is probably related to some query the frontend is doing about an object that has not yet been added to the DB.

To investigate the issue, go to the proposals row element (which shows the proposal content and handles the accept button) and debug the execution of this function when value is true and workspace.execute() is executed.

At some point in the execution, there is a request to the backend that fails. Understand which request this is, to which object it corresponds, and why it fails.

In theory, workspace.execute() should be able to create as many entities, as many new perspectives, and as many perspective head updates as you want.

Wait, writing this issue helped me understand the probably cause of this error:

The proposal includes a list of newPerspectives to be created, but they are not ordered. Some of elements in the list have, as parents, other elements on the list. This means that the parent must be created before the child, so that the child can inherit the permissions from the parent.

To fix the issue we must order the newPerspectives array before it is executed in the executeCreate function.

Make sure the logic is efficient and support the cases where some newPerspectives have parentId undefined.

commented

@sotous this is where I got the last time I tried to run web2. It's a bit further your state (because the proposal was being created) but you will face this issue afterward. Check the proposed solution about ordering the new perspectives in the executeCreate function based on each ones parent. (so that parents are created first than their children)