| Summary: | UsersService.js has broken createUser() | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Mark Macdonald <mamacdon> |
| Component: | Client | Assignee: | Mark Macdonald <mamacdon> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 2.0 | ||
| Target Milestone: | 3.0 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=c41c5ee273943a2cf563ccc4cc952cef2580f8d3 This also fixes the problem with the user-list page not reloading after a user is created. Needed to add this, to make sure that createUser() promises reject on error. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=13c26546dc6e079ef431a2600d18080ccb987afc thanks, Mark. I'm sure that one was my fault. I thought I had opened a bug on this (see bug 395393 comment 12) but I can't find it. (In reply to comment #3) > thanks, Mark. I'm sure that one was my fault. I thought I had opened a bug > on this (see bug 395393 comment 12) but I can't find it. No, I think this happened prior to your big dojo-removal push. This files is part of a plugin, and the plugins were de-dojo'd before the UI was... |
The createUser() method of UsersService.js does not correctly fulfill its service call contract. It returns a promise that never fulfills. The code looks like this: > createUser : function(userName, password, email, onLoad, onError) { > var ret = new Deferred(); > xhr("POST", "../users", { //$NON-NLS-1$ //$NON-NLS-0$ > data: form.encodeFormData({ > login : userName, > password : password, > email: email > }), > load : function(jsonData, xhrArgs) { > ret.resolve(jsonData); > }, > error : function(error, ioArgs) { > ret.reject(error.response || error); > } > }); > return ret; > }, Because it uses orion/xhr here, the "load" and "error" parameters are never called (they're leftover dojoisms). As a result, "ret" never resolves, and the promise is left hanging. This makes it impossible to chain more aync operations to the result of a UserService call.