{ "id": "148809", "key": "AC-1381", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2015-09-30T03:54:28.000+0000", "created": "2015-06-16T02:10:34.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:37:48.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "h3. Steps to Reproduce\r\n(All tests done on same user\r\nThe standard Cloud.Users.update method of updating a user's photo was confirmed, installed the app on ipad and confirmed again.\r\n\r\nContinued testing from laptop for MobileWeb portion of the app with this, \r\nhttp://developer.appcelerator.com/question/182699/cloudusersupdate-photo-returns-success-but-no-change-wrong-media-type , resulted in error \"Failed to upload photo: Failed to indentify photo file\" or depending upon my sent data, silently failed when changing reader.readAsDataURL() to reader.readAsBinaryString() and various methods from this reference http://www.html5rocks.com/en/tutorials/file/dndfiles until I started getting consistent error responses 'failed to upload photo: undefined method `destroy' for nil:NilClass'\r\n\r\nI returned to the device to test with working, unchanged installed app and got the same error same response, 'failed to upload photo: undefined method `destroy' for nil:NilClass'\r\n\r\nTested from dashboard, same error response\r\n(All tests done on same user)\r\n\r\nh3. Actual Result\r\nExisting user's photo deleted but not replaced. Unable to update\r\n\r\nh3. Expected Result\r\nsuccessful update", "attachment": [ { "id": "55837", "filename": ".log", "author": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-06-16T02:11:02.000+0000", "size": 6211688, "mimeType": "text/plain" }, { "id": "55838", "filename": "diagnostic903946955486080361.log", "author": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-06-16T02:11:06.000+0000", "size": 78861, "mimeType": "text/plain" } ], "flagged": false, "summary": "Cloud.Users.update of photo returns 'failed to upload photo: undefined method `destroy' for nil:NilClass'", "creator": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Appcelerator Studio 4.0.1", "comment": { "comments": [ { "id": "355357", "author": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "body": "[~keylo] you mind sharing a test case with us? So far we can not reproduce this issue\r\n\r\nThanks\r\n", "updateAuthor": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "created": "2015-06-17T16:56:19.000+0000", "updated": "2015-06-17T16:56:19.000+0000" }, { "id": "355360", "author": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Everything is in the link I posted http://developer.appcelerator.com/question/182699/cloudusersupdate-photo-returns-success-but-no-change-wrong-media-type and description above.\r\n\r\nStarted with a working Cloud.Users.update method, which you can reproduce without my help, then did what the link states, changing reader.readAsDataURL() to reader.readAsBinaryString(), reader.readAsText(), reader.readAsArrayBuffer(), sometimes passing update the result.data as well as the result until it breaks. It might have taken 10 or 20 tries before shutting down. I may have also tried passing handleFileSelect's evt[0] (file) directly from the without passing it through the reader.\r\n\r\nReturned to the working update method to confirm", "updateAuthor": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-06-17T17:34:18.000+0000", "updated": "2015-06-17T17:38:04.000+0000" }, { "id": "355621", "author": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "body": "[~morahman] Did you try from dashboard? ", "updateAuthor": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "created": "2015-06-22T15:42:34.000+0000", "updated": "2015-06-22T15:42:34.000+0000" }, { "id": "355622", "author": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "body": "\"Tested from dashboard, same error response\"", "updateAuthor": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-06-22T15:57:42.000+0000", "updated": "2015-06-22T15:57:42.000+0000" }, { "id": "356052", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "[~keylo] we also have tested from the dashboard and it works, if it shows error it may cause of large file so just try it again. And this test case User photo is updated properly. So first check your webView chooseing image getting the titanium code.\r\n\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : '#fff'\r\n});\r\n \r\n// Create a Button.\r\nvar Update_Photo = Ti.UI.createButton({\r\n\ttitle : 'Update_Photo',\r\n\theight : Ti.UI.SIZE,\r\n\twidth : Ti.UI.SIZE,\r\n\ttop : 20,\r\n \r\n});\r\n \r\n// Add to the parent view.\r\nwin.add(Update_Photo);\r\n \r\nvar Cloud = require(\"ti.cloud\");\r\n \r\nCloud.Users.create({\r\n\temail : 'test@mycompany.com',\r\n\tfirst_name : 'test_firstname',\r\n\tlast_name : 'test_lastname',\r\n\tpassword : 'test_password',\r\n\tpassword_confirmation : 'test_password',\r\n\tphoto : Titanium.Filesystem.getFile('KS_nav_ui.png')\r\n}, function(e) {\r\n\tif (e.success) {\r\n\t\tvar user = e.users[0];\r\n\t\talert('Success:\\n' + 'id: ' + user.id + '\\n' + 'sessionId: ' + Cloud.sessionId + '\\n' + 'first name: ' + user.first_name + '\\n' + 'last name: ' + user.last_name);\r\n\t} else {\r\n\t\talert('Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));\r\n\t}\r\n});\r\n \r\nfunction update_photo() {\r\n\tCloud.Users.update({\r\n\t\temail : 'test@mycompany.com',\r\n\t\tfirst_name : 'test_firstname',\r\n\t\tlast_name : 'test_lastname',\r\n\t\tphoto : Titanium.Filesystem.getFile('KS_nav_views.png'),\r\n\t\tcustom_fields : {\r\n\t\t\tfavorite_color : 'blue',\r\n\t\t\tage : 25\r\n\t\t}\r\n\t}, function(e) {\r\n\t\tif (e.success) {\r\n\t\t\tvar user = e.users[0];\r\n\t\t\talert('Success:\\n' + 'id: ' + user.id + '\\n' + 'first name: ' + user.first_name + '\\n' + 'last name: ' + user.last_name);\r\n\t\t} else {\r\n\t\t\talert('Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));\r\n\t\t}\r\n\t});\r\n}\r\n \r\n// Listen for click events.\r\nUpdate_Photo.addEventListener('click', function() {\r\n\tupdate_photo();\r\n});\r\n \r\nwin.open();\r\n \r\n{code}\r\n\r\nThanks.", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2015-06-26T11:12:35.000+0000", "updated": "2015-06-26T11:12:35.000+0000" }, { "id": "356061", "author": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Titanium.Filesystem.getFile('KS_nav_views.png')\r\nwould not work in the scenario described as the need was to browse to a file in a MobileWeb app, thus the WebView HTML solution, which broke the system.", "updateAuthor": { "name": "keylo", "key": "keylo", "displayName": "Keylo E.", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-06-26T13:56:49.000+0000", "updated": "2015-06-26T13:56:49.000+0000" }, { "id": "356088", "author": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "body": "[~keylo] can you please attach a runnable test case that reproduces the issue? So far we can not replicate the issue", "updateAuthor": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "created": "2015-06-26T18:01:22.000+0000", "updated": "2015-06-26T18:01:22.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }