{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/mail/pulls/comments/33753502","id":33753502,"diff_hunk":"@@ -97,14 +97,41 @@ views.Folders = Backbone.Marionette.CollectionView.extend({\n \t\treturn activeFolder;\n \t},\n \n-\tchangeUnseen: function(model, unseen) {\n+\t/**\n+\t * Retrieve and/or adjust the unseen count for the current folder on display.\n+\t * @todo Add the ability to adjust any folder.\n+\t * @param object $model The model to reference for the active folder.\n+\t * @param boolean|string $unseen True/false for manual unseen entries; check for updates retrieved from backend.\n+\t */\n+\tchangeUnseenCount: function(model, unseen) {\n \t\t// TODO: currentFolderId and currentAccountId should be an attribute of this view\n+\t\tunseen = unseen || 'check';\n \t\tvar activeFolder = this.getFolderById();\n-\t\tif (unseen) {\n-\t\t\tactiveFolder.set('unseen', activeFolder.get('unseen') + 1);\n-\t\t} else {\n-\t\t\tif (activeFolder.get('unseen') > 0) {\n-\t\t\t\tactiveFolder.set('unseen', activeFolder.get('unseen') - 1);\n+\t\t// Ask the IMAP server what the unseen count is.\n+\t\tif (unseen === 'check') {\n+\t\t\t$.ajax(\n+\t\t\t\tOC.generateUrl('apps/mail/accounts/{accountId}/folders/{folderId}/getUnseenCount',\n+\t\t\t\t{ accountId: Mail.State.currentAccountId,\n+\t\t\t\t\tfolderId: Mail.State.currentFolderId,\n+\t\t\t\t}), {\n+\t\t\t\t\ttype:'POST',\n+\t\t\t\t\tsuccess: function (jsondata) {\n+\t\t\t\t\t\t// Set the new unseen count.\n+\t\t\t\t\t\tactiveFolder.set('unseen', jsondata.unseen);\n+\t\t\t\t\t},\n+\t\t\t\t\terror: function() {\n+\t\t\t\t\t\tMail.UI.showError(t('mail', 'Could not get unread count for this folder. Please try again.'));\n+\t\t\t\t\t}\n+\t\t\t\t});\n+\t\t}\n+\t\t// Adjust the display of the unseen count manually.\n+\t\tif (typeof unseen === 'boolean') {","path":"js/views/folder.js","position":38,"original_position":38,"commit_id":"d276088f99401bb14043cdd2ee09e85170fbda95","original_commit_id":"d276088f99401bb14043cdd2ee09e85170fbda95","user":{"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},"body":"(Just as a sidenote: We rarely directly change things in the review process of other people's code. Because one important part of reviewing is learning and doing it. Also to not just mess with other folks' code. I know sometimes this can be frustrating but it will make future reviews easier.)","created_at":"2015-07-02T07:43:42Z","updated_at":"2015-07-02T07:43:42Z","html_url":"https://github.com/owncloud/mail/pull/834#discussion_r33753502","pull_request_url":"https://api.github.com/repos/owncloud/mail/pulls/834","_links":{"self":{"href":"https://api.github.com/repos/owncloud/mail/pulls/comments/33753502"},"html":{"href":"https://github.com/owncloud/mail/pull/834#discussion_r33753502"},"pull_request":{"href":"https://api.github.com/repos/owncloud/mail/pulls/834"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/mail/pulls/834","id":38936411,"html_url":"https://github.com/owncloud/mail/pull/834","diff_url":"https://github.com/owncloud/mail/pull/834.diff","patch_url":"https://github.com/owncloud/mail/pull/834.patch","issue_url":"https://api.github.com/repos/owncloud/mail/issues/834","number":834,"state":"open","locked":false,"title":"Unread/read status syncing, message syncing, and infinite scrolling.","user":{"login":"aidanamavi","id":1814570,"avatar_url":"https://avatars.githubusercontent.com/u/1814570?v=3","gravatar_id":"","url":"https://api.github.com/users/aidanamavi","html_url":"https://github.com/aidanamavi","followers_url":"https://api.github.com/users/aidanamavi/followers","following_url":"https://api.github.com/users/aidanamavi/following{/other_user}","gists_url":"https://api.github.com/users/aidanamavi/gists{/gist_id}","starred_url":"https://api.github.com/users/aidanamavi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidanamavi/subscriptions","organizations_url":"https://api.github.com/users/aidanamavi/orgs","repos_url":"https://api.github.com/users/aidanamavi/repos","events_url":"https://api.github.com/users/aidanamavi/events{/privacy}","received_events_url":"https://api.github.com/users/aidanamavi/received_events","type":"User","site_admin":false},"body":"Added event handler for message click to toggle the unseen flag.\r\nAdded syncing for the message unseen flag to the mail server.\r\nAdded unseen status fetcher for the Inbox folder.\r\nAdded message list syncing.\r\nAdded infinite scrolling message list with feedback.\r\n\r\nFixes #104\tPull to refresh & automatic update of messages\r\nFixes #499\tAutomatic lazy loading of more messages when scrolled to the end of the list\r\nFixes #633\t\"Check messages\" should sync deleted messages as well.\r\nFixes #773\tDetect flag changes and expunged messages\r\nFixes #830\tAdds bug fixes addressed in this pull request\r\nFixes #803\tOn new mails, the list is not automatically refreshed\r\n\t\t\tThe 'Check messages' button disappears once refreshing the message list has finished.\r\n\t\t\tWhen clicking »load more« the list jump-scrolls to the top as soon as more emails are loaded","created_at":"2015-06-30T23:49:10Z","updated_at":"2015-07-02T07:43:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72330d6587d9ddd1b2494e02f6cbf04a296efe79","assignee":{"login":"aidanamavi","id":1814570,"avatar_url":"https://avatars.githubusercontent.com/u/1814570?v=3","gravatar_id":"","url":"https://api.github.com/users/aidanamavi","html_url":"https://github.com/aidanamavi","followers_url":"https://api.github.com/users/aidanamavi/followers","following_url":"https://api.github.com/users/aidanamavi/following{/other_user}","gists_url":"https://api.github.com/users/aidanamavi/gists{/gist_id}","starred_url":"https://api.github.com/users/aidanamavi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidanamavi/subscriptions","organizations_url":"https://api.github.com/users/aidanamavi/orgs","repos_url":"https://api.github.com/users/aidanamavi/repos","events_url":"https://api.github.com/users/aidanamavi/events{/privacy}","received_events_url":"https://api.github.com/users/aidanamavi/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/owncloud/mail/milestones/5","html_url":"https://github.com/owncloud/mail/milestones/0.2","labels_url":"https://api.github.com/repos/owncloud/mail/milestones/5/labels","id":1108267,"number":5,"title":"0.2","description":"Next one! :rocket: 2 years, 4 months and 8 days after the initial commit. ;)","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":45,"closed_issues":113,"state":"open","created_at":"2015-05-13T09:28:21Z","updated_at":"2015-07-02T07:42:31Z","due_on":"2015-07-13T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/owncloud/mail/pulls/834/commits","review_comments_url":"https://api.github.com/repos/owncloud/mail/pulls/834/comments","review_comment_url":"https://api.github.com/repos/owncloud/mail/pulls/comments{/number}","comments_url":"https://api.github.com/repos/owncloud/mail/issues/834/comments","statuses_url":"https://api.github.com/repos/owncloud/mail/statuses/d276088f99401bb14043cdd2ee09e85170fbda95","head":{"label":"owncloud:syncing-unseenFlags-infiniteScroll-fixes","ref":"syncing-unseenFlags-infiniteScroll-fixes","sha":"d276088f99401bb14043cdd2ee09e85170fbda95","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":8604367,"name":"mail","full_name":"owncloud/mail","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/mail","description":"ownCloud Mail app","fork":false,"url":"https://api.github.com/repos/owncloud/mail","forks_url":"https://api.github.com/repos/owncloud/mail/forks","keys_url":"https://api.github.com/repos/owncloud/mail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/mail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/mail/teams","hooks_url":"https://api.github.com/repos/owncloud/mail/hooks","issue_events_url":"https://api.github.com/repos/owncloud/mail/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/mail/events","assignees_url":"https://api.github.com/repos/owncloud/mail/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/mail/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/mail/tags","blobs_url":"https://api.github.com/repos/owncloud/mail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/mail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/mail/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/mail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/mail/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/mail/languages","stargazers_url":"https://api.github.com/repos/owncloud/mail/stargazers","contributors_url":"https://api.github.com/repos/owncloud/mail/contributors","subscribers_url":"https://api.github.com/repos/owncloud/mail/subscribers","subscription_url":"https://api.github.com/repos/owncloud/mail/subscription","commits_url":"https://api.github.com/repos/owncloud/mail/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/mail/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/mail/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/mail/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/mail/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/mail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/mail/merges","archive_url":"https://api.github.com/repos/owncloud/mail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/mail/downloads","issues_url":"https://api.github.com/repos/owncloud/mail/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/mail/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/mail/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/mail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/mail/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/mail/releases{/id}","created_at":"2013-03-06T13:51:00Z","updated_at":"2015-07-01T08:00:40Z","pushed_at":"2015-07-02T07:42:28Z","git_url":"git://github.com/owncloud/mail.git","ssh_url":"git@github.com:owncloud/mail.git","clone_url":"https://github.com/owncloud/mail.git","svn_url":"https://github.com/owncloud/mail","homepage":"https://apps.owncloud.com/content/show.php/Mail?content=169914","size":12377,"stargazers_count":146,"watchers_count":146,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":136,"forks":45,"open_issues":136,"watchers":146,"default_branch":"master"}},"base":{"label":"owncloud:master","ref":"master","sha":"6bbf81c386aa0560ae098723149a95badca3a5e7","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":8604367,"name":"mail","full_name":"owncloud/mail","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/mail","description":"ownCloud Mail app","fork":false,"url":"https://api.github.com/repos/owncloud/mail","forks_url":"https://api.github.com/repos/owncloud/mail/forks","keys_url":"https://api.github.com/repos/owncloud/mail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/mail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/mail/teams","hooks_url":"https://api.github.com/repos/owncloud/mail/hooks","issue_events_url":"https://api.github.com/repos/owncloud/mail/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/mail/events","assignees_url":"https://api.github.com/repos/owncloud/mail/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/mail/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/mail/tags","blobs_url":"https://api.github.com/repos/owncloud/mail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/mail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/mail/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/mail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/mail/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/mail/languages","stargazers_url":"https://api.github.com/repos/owncloud/mail/stargazers","contributors_url":"https://api.github.com/repos/owncloud/mail/contributors","subscribers_url":"https://api.github.com/repos/owncloud/mail/subscribers","subscription_url":"https://api.github.com/repos/owncloud/mail/subscription","commits_url":"https://api.github.com/repos/owncloud/mail/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/mail/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/mail/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/mail/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/mail/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/mail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/mail/merges","archive_url":"https://api.github.com/repos/owncloud/mail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/mail/downloads","issues_url":"https://api.github.com/repos/owncloud/mail/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/mail/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/mail/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/mail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/mail/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/mail/releases{/id}","created_at":"2013-03-06T13:51:00Z","updated_at":"2015-07-01T08:00:40Z","pushed_at":"2015-07-02T07:42:28Z","git_url":"git://github.com/owncloud/mail.git","ssh_url":"git@github.com:owncloud/mail.git","clone_url":"https://github.com/owncloud/mail.git","svn_url":"https://github.com/owncloud/mail","homepage":"https://apps.owncloud.com/content/show.php/Mail?content=169914","size":12377,"stargazers_count":146,"watchers_count":146,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":136,"forks":45,"open_issues":136,"watchers":146,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/mail/pulls/834"},"html":{"href":"https://github.com/owncloud/mail/pull/834"},"issue":{"href":"https://api.github.com/repos/owncloud/mail/issues/834"},"comments":{"href":"https://api.github.com/repos/owncloud/mail/issues/834/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/mail/pulls/834/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/mail/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/owncloud/mail/pulls/834/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/mail/statuses/d276088f99401bb14043cdd2ee09e85170fbda95"}}}}