{"action":"closed","issue":{"url":"https://api.github.com/repos/owncloud/mail/issues/1314","repository_url":"https://api.github.com/repos/owncloud/mail","labels_url":"https://api.github.com/repos/owncloud/mail/issues/1314/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/mail/issues/1314/comments","events_url":"https://api.github.com/repos/owncloud/mail/issues/1314/events","html_url":"https://github.com/owncloud/mail/issues/1314","id":135357985,"number":1314,"title":"Backbone models","user":{"login":"ChristophWurst","id":1374172,"avatar_url":"https://avatars.githubusercontent.com/u/1374172?v=3","gravatar_id":"","url":"https://api.github.com/users/ChristophWurst","html_url":"https://github.com/ChristophWurst","followers_url":"https://api.github.com/users/ChristophWurst/followers","following_url":"https://api.github.com/users/ChristophWurst/following{/other_user}","gists_url":"https://api.github.com/users/ChristophWurst/gists{/gist_id}","starred_url":"https://api.github.com/users/ChristophWurst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChristophWurst/subscriptions","organizations_url":"https://api.github.com/users/ChristophWurst/orgs","repos_url":"https://api.github.com/users/ChristophWurst/repos","events_url":"https://api.github.com/users/ChristophWurst/events{/privacy}","received_events_url":"https://api.github.com/users/ChristophWurst/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/mail/labels/1%20-%20to%20develop","name":"1 - to develop","color":"bfe5bf"},{"url":"https://api.github.com/repos/owncloud/mail/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/owncloud/mail/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"ChristophWurst","id":1374172,"avatar_url":"https://avatars.githubusercontent.com/u/1374172?v=3","gravatar_id":"","url":"https://api.github.com/users/ChristophWurst","html_url":"https://github.com/ChristophWurst","followers_url":"https://api.github.com/users/ChristophWurst/followers","following_url":"https://api.github.com/users/ChristophWurst/following{/other_user}","gists_url":"https://api.github.com/users/ChristophWurst/gists{/gist_id}","starred_url":"https://api.github.com/users/ChristophWurst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChristophWurst/subscriptions","organizations_url":"https://api.github.com/users/ChristophWurst/orgs","repos_url":"https://api.github.com/users/ChristophWurst/repos","events_url":"https://api.github.com/users/ChristophWurst/events{/privacy}","received_events_url":"https://api.github.com/users/ChristophWurst/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/owncloud/mail/milestones/6","html_url":"https://github.com/owncloud/mail/milestones/0.4%20%E2%80%93%20small%20innovations!","labels_url":"https://api.github.com/repos/owncloud/mail/milestones/6/labels","id":1280109,"number":6,"title":"0.4 – small innovations!","description":"Together with ownCloud 9.0","creator":{"login":"jancborchardt","id":925062,"avatar_url":"https://avatars.githubusercontent.com/u/925062?v=3","gravatar_id":"","url":"https://api.github.com/users/jancborchardt","html_url":"https://github.com/jancborchardt","followers_url":"https://api.github.com/users/jancborchardt/followers","following_url":"https://api.github.com/users/jancborchardt/following{/other_user}","gists_url":"https://api.github.com/users/jancborchardt/gists{/gist_id}","starred_url":"https://api.github.com/users/jancborchardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jancborchardt/subscriptions","organizations_url":"https://api.github.com/users/jancborchardt/orgs","repos_url":"https://api.github.com/users/jancborchardt/repos","events_url":"https://api.github.com/users/jancborchardt/events{/privacy}","received_events_url":"https://api.github.com/users/jancborchardt/received_events","type":"User","site_admin":false},"open_issues":115,"closed_issues":47,"state":"open","created_at":"2015-08-30T13:35:47Z","updated_at":"2016-03-10T08:30:16Z","due_on":"2016-03-07T23:00:00Z","closed_at":null},"comments":6,"created_at":"2016-02-22T09:08:31Z","updated_at":"2016-03-10T08:30:16Z","closed_at":"2016-03-10T08:30:16Z","body":"Right now we're using Backbone models only for rendering Marionette collection views. By consistently using models throughout the client, we could lower the complexity of working with related data. \r\n\r\nI had a look at the JavaScript code and identified the following models:\r\n- Account\r\n- Folder\r\n- Messge\r\n- MessageFlag\r\n\r\n![backbone_models](https://cloud.githubusercontent.com/assets/1374172/13213610/72a39a26-d94a-11e5-9329-931ab29f5458.png)\r\n\r\nUsing Backbone models has some advantages:\r\n- By using bidirectional association between models it will be easier to work with related data\r\n- Global state variables (e.g. inside the ``state`` module) can be eliminated because all the data is passed when calling a module function or triggering an event.\r\n- We can use [Backbone sync](http://backbonejs.org/#Sync) on those models\r\n  - Might be helpful to use [horde sync](https://github.com/owncloud/mail/pull/763) for folders\r\n- Existing code will be easier to maintain\r\n- It will be easier to implement new features\r\n\r\n@owncloud/mail"}}