{"action":"created","comment":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/242407387","pull_request_review_id":185907621,"id":242407387,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjQwNzM4Nw==","diff_hunk":"@@ -545,30 +541,38 @@ class BelongsToMany extends Association {\n         if (!newObj) {\n           obsoleteAssociations.push(currentRow);\n         } else {\n-          let throughAttributes = newObj[association.through.model.name];\n+          let throughAttributes = newObj[this.through.model.name];\n           // Quick-fix for subtle bug when using existing objects that might have the through model attached (not as an attribute object)\n-          if (throughAttributes instanceof association.through.model) {\n+          if (throughAttributes instanceof this.through.model) {\n             throughAttributes = {};\n           }\n \n-          const where = {};\n           const attributes = _.defaults({}, throughAttributes, defaultAttributes);\n \n-          where[identifier] = sourceInstance.get(sourceKey);\n-          where[foreignIdentifier] = newObj.get(targetKey);\n-\n           if (Object.keys(attributes).length) {\n-            promises.push(association.through.model.update(attributes, Object.assign(options, { where })));\n+            promises.push(\n+              this.through.model.update(attributes, Object.assign(options, {\n+                where: {\n+                  [identifier]: sourceInstance.get(sourceKey),\n+                  [foreignIdentifier]: newObj.get(targetKey)\n+                }\n+              }\n+              ))","path":"lib/associations/belongs-to-many.js","position":161,"original_position":161,"commit_id":"c3dc4d5e5a706678e57a0f41fe5fed7da980c32e","original_commit_id":"c3dc4d5e5a706678e57a0f41fe5fed7da980c32e","user":{"login":"sushantdhiman","id":9989487,"node_id":"MDQ6VXNlcjk5ODk0ODc=","avatar_url":"https://avatars1.githubusercontent.com/u/9989487?v=4","gravatar_id":"","url":"https://api.github.com/users/sushantdhiman","html_url":"https://github.com/sushantdhiman","followers_url":"https://api.github.com/users/sushantdhiman/followers","following_url":"https://api.github.com/users/sushantdhiman/following{/other_user}","gists_url":"https://api.github.com/users/sushantdhiman/gists{/gist_id}","starred_url":"https://api.github.com/users/sushantdhiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushantdhiman/subscriptions","organizations_url":"https://api.github.com/users/sushantdhiman/orgs","repos_url":"https://api.github.com/users/sushantdhiman/repos","events_url":"https://api.github.com/users/sushantdhiman/events{/privacy}","received_events_url":"https://api.github.com/users/sushantdhiman/received_events","type":"User","site_admin":false},"body":"odd indentation","created_at":"2018-12-18T05:02:39Z","updated_at":"2018-12-18T05:02:39Z","html_url":"https://github.com/sequelize/sequelize/pull/10276#discussion_r242407387","pull_request_url":"https://api.github.com/repos/sequelize/sequelize/pulls/10276","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/242407387"},"html":{"href":"https://github.com/sequelize/sequelize/pull/10276#discussion_r242407387"},"pull_request":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10276"}}},"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/10276","id":239283077,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5MjgzMDc3","html_url":"https://github.com/sequelize/sequelize/pull/10276","diff_url":"https://github.com/sequelize/sequelize/pull/10276.diff","patch_url":"https://github.com/sequelize/sequelize/pull/10276.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/10276","number":10276,"state":"open","locked":false,"title":"chore: cleanup","user":{"login":"SimonSchick","id":3259089,"node_id":"MDQ6VXNlcjMyNTkwODk=","avatar_url":"https://avatars3.githubusercontent.com/u/3259089?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonSchick","html_url":"https://github.com/SimonSchick","followers_url":"https://api.github.com/users/SimonSchick/followers","following_url":"https://api.github.com/users/SimonSchick/following{/other_user}","gists_url":"https://api.github.com/users/SimonSchick/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSchick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSchick/subscriptions","organizations_url":"https://api.github.com/users/SimonSchick/orgs","repos_url":"https://api.github.com/users/SimonSchick/repos","events_url":"https://api.github.com/users/SimonSchick/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSchick/received_events","type":"User","site_admin":false},"body":"### Pull Request check-list\r\n\r\n_Please make sure to review and check all of these items:_\r\n\r\n- [x] Does `npm run test` or `npm run test-DIALECT` pass with this change (including linting)?\r\n- [x] Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?\r\n- [x] Have you added new tests to prevent regressions?\r\n- [x] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?\r\n- [x] Did you follow the commit message conventions explained in [CONTRIBUTING.md](https://github.com/sequelize/sequelize/blob/master/CONTRIBUTING.md)?\r\n\r\n### Description of change\r\n\r\nFixes #10275 I think\r\n\r\nThis is another small scale cleanup PR.\r\n- Replace some loops with `Object.assign`\r\n- Replace all usage of `spread` with native array spread\r\n- Use object literals in various places\r\n- Avoid aliasing of `this`","created_at":"2018-12-17T21:04:44Z","updated_at":"2018-12-18T05:02:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2ea3eb62bb526fd2b6d5709c04f5985ea8aad7d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/10276/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/10276/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/10276/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/c3dc4d5e5a706678e57a0f41fe5fed7da980c32e","head":{"label":"SimonSchick:chore/cleanup","ref":"chore/cleanup","sha":"c3dc4d5e5a706678e57a0f41fe5fed7da980c32e","user":{"login":"SimonSchick","id":3259089,"node_id":"MDQ6VXNlcjMyNTkwODk=","avatar_url":"https://avatars3.githubusercontent.com/u/3259089?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonSchick","html_url":"https://github.com/SimonSchick","followers_url":"https://api.github.com/users/SimonSchick/followers","following_url":"https://api.github.com/users/SimonSchick/following{/other_user}","gists_url":"https://api.github.com/users/SimonSchick/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSchick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSchick/subscriptions","organizations_url":"https://api.github.com/users/SimonSchick/orgs","repos_url":"https://api.github.com/users/SimonSchick/repos","events_url":"https://api.github.com/users/SimonSchick/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSchick/received_events","type":"User","site_admin":false},"repo":{"id":82211631,"node_id":"MDEwOlJlcG9zaXRvcnk4MjIxMTYzMQ==","name":"sequelize","full_name":"SimonSchick/sequelize","private":false,"owner":{"login":"SimonSchick","id":3259089,"node_id":"MDQ6VXNlcjMyNTkwODk=","avatar_url":"https://avatars3.githubusercontent.com/u/3259089?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonSchick","html_url":"https://github.com/SimonSchick","followers_url":"https://api.github.com/users/SimonSchick/followers","following_url":"https://api.github.com/users/SimonSchick/following{/other_user}","gists_url":"https://api.github.com/users/SimonSchick/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSchick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSchick/subscriptions","organizations_url":"https://api.github.com/users/SimonSchick/orgs","repos_url":"https://api.github.com/users/SimonSchick/repos","events_url":"https://api.github.com/users/SimonSchick/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSchick/received_events","type":"User","site_admin":false},"html_url":"https://github.com/SimonSchick/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":true,"url":"https://api.github.com/repos/SimonSchick/sequelize","forks_url":"https://api.github.com/repos/SimonSchick/sequelize/forks","keys_url":"https://api.github.com/repos/SimonSchick/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SimonSchick/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SimonSchick/sequelize/teams","hooks_url":"https://api.github.com/repos/SimonSchick/sequelize/hooks","issue_events_url":"https://api.github.com/repos/SimonSchick/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/SimonSchick/sequelize/events","assignees_url":"https://api.github.com/repos/SimonSchick/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/SimonSchick/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/SimonSchick/sequelize/tags","blobs_url":"https://api.github.com/repos/SimonSchick/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SimonSchick/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SimonSchick/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/SimonSchick/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SimonSchick/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/SimonSchick/sequelize/languages","stargazers_url":"https://api.github.com/repos/SimonSchick/sequelize/stargazers","contributors_url":"https://api.github.com/repos/SimonSchick/sequelize/contributors","subscribers_url":"https://api.github.com/repos/SimonSchick/sequelize/subscribers","subscription_url":"https://api.github.com/repos/SimonSchick/sequelize/subscription","commits_url":"https://api.github.com/repos/SimonSchick/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/SimonSchick/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/SimonSchick/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/SimonSchick/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/SimonSchick/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/SimonSchick/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SimonSchick/sequelize/merges","archive_url":"https://api.github.com/repos/SimonSchick/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SimonSchick/sequelize/downloads","issues_url":"https://api.github.com/repos/SimonSchick/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/SimonSchick/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/SimonSchick/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/SimonSchick/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SimonSchick/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/SimonSchick/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/SimonSchick/sequelize/deployments","created_at":"2017-02-16T18:18:19Z","updated_at":"2018-10-19T20:36:43Z","pushed_at":"2018-12-18T00:26:26Z","git_url":"git://github.com/SimonSchick/sequelize.git","ssh_url":"git@github.com:SimonSchick/sequelize.git","clone_url":"https://github.com/SimonSchick/sequelize.git","svn_url":"https://github.com/SimonSchick/sequelize","homepage":"http://docs.sequelizejs.com","size":24159,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"66a453367c79808121a8e659b7a63ed2ae59551d","user":{"login":"sequelize","id":3591786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1OTE3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/3591786?v=4","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"repo":{"id":790359,"node_id":"MDEwOlJlcG9zaXRvcnk3OTAzNTk=","name":"sequelize","full_name":"sequelize/sequelize","private":false,"owner":{"login":"sequelize","id":3591786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1OTE3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/3591786?v=4","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sequelize/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":false,"url":"https://api.github.com/repos/sequelize/sequelize","forks_url":"https://api.github.com/repos/sequelize/sequelize/forks","keys_url":"https://api.github.com/repos/sequelize/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sequelize/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sequelize/sequelize/teams","hooks_url":"https://api.github.com/repos/sequelize/sequelize/hooks","issue_events_url":"https://api.github.com/repos/sequelize/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/sequelize/sequelize/events","assignees_url":"https://api.github.com/repos/sequelize/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/sequelize/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/sequelize/sequelize/tags","blobs_url":"https://api.github.com/repos/sequelize/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sequelize/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sequelize/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/sequelize/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/sequelize/sequelize/languages","stargazers_url":"https://api.github.com/repos/sequelize/sequelize/stargazers","contributors_url":"https://api.github.com/repos/sequelize/sequelize/contributors","subscribers_url":"https://api.github.com/repos/sequelize/sequelize/subscribers","subscription_url":"https://api.github.com/repos/sequelize/sequelize/subscription","commits_url":"https://api.github.com/repos/sequelize/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/sequelize/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/sequelize/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/sequelize/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/sequelize/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/sequelize/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sequelize/sequelize/merges","archive_url":"https://api.github.com/repos/sequelize/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sequelize/sequelize/downloads","issues_url":"https://api.github.com/repos/sequelize/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/sequelize/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/sequelize/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/sequelize/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sequelize/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/sequelize/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/sequelize/sequelize/deployments","created_at":"2010-07-22T07:11:11Z","updated_at":"2018-12-18T03:17:04Z","pushed_at":"2018-12-18T01:26:53Z","git_url":"git://github.com/sequelize/sequelize.git","ssh_url":"git@github.com:sequelize/sequelize.git","clone_url":"https://github.com/sequelize/sequelize.git","svn_url":"https://github.com/sequelize/sequelize","homepage":"http://docs.sequelizejs.com","size":24213,"stargazers_count":16870,"watchers_count":16870,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2712,"mirror_url":null,"archived":false,"open_issues_count":353,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2712,"open_issues":353,"watchers":16870,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10276"},"html":{"href":"https://github.com/sequelize/sequelize/pull/10276"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/10276"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/10276/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10276/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10276/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/c3dc4d5e5a706678e57a0f41fe5fed7da980c32e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sushantdhiman"}}