{"action":"opened","number":6720,"pull_request":{"url":"https://api.github.com/repos/opf/openproject/pulls/6720","id":217886993,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3ODg2OTkz","html_url":"https://github.com/opf/openproject/pull/6720","diff_url":"https://github.com/opf/openproject/pull/6720.diff","patch_url":"https://github.com/opf/openproject/pull/6720.patch","issue_url":"https://api.github.com/repos/opf/openproject/issues/6720","number":6720,"state":"open","locked":false,"title":"avoid adding non writeable filters multiple times","user":{"login":"ulferts","id":617519,"node_id":"MDQ6VXNlcjYxNzUxOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/617519?v=4","gravatar_id":"","url":"https://api.github.com/users/ulferts","html_url":"https://github.com/ulferts","followers_url":"https://api.github.com/users/ulferts/followers","following_url":"https://api.github.com/users/ulferts/following{/other_user}","gists_url":"https://api.github.com/users/ulferts/gists{/gist_id}","starred_url":"https://api.github.com/users/ulferts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ulferts/subscriptions","organizations_url":"https://api.github.com/users/ulferts/orgs","repos_url":"https://api.github.com/users/ulferts/repos","events_url":"https://api.github.com/users/ulferts/events{/privacy}","received_events_url":"https://api.github.com/users/ulferts/received_events","type":"User","site_admin":false},"body":"When the create_class method is called on WorkPackagePayloadRepresenter, a subclass of the class is created that includes the relevant custom fields. That class gets the PayloadRepresenter module included. The payload representer adds a render_filter to the attributes to avoid rendering unwriteable attributes. But when adding the filter, it is not added to an instance of the attribute in the subclass (WorkPackagePayloadRepresenter + CustomFields)but rather to the one in the superclass (WorkPackagePayloadRepresenter). The filter list instance is shared by all subclasses. That sideeffect is not dangerous per se as we want all WorkPackagePayloadRepresenters to have the filter. But as we have one instance of an array, adding to that array will lead to having the filter multiple times which will then all have to be evaluated on every rendering pass. By checking if the filter is already included before adding it, we can avoid this behaviour.\r\n\r\nThe better fix would be to rework the way custom fields are handled in the representers. This could be done by having one representer for the static attributes and one for the dynamic custom fields. Those two representers could be rendered/parsed independently and the results could then be merged. This approach however takes considerably more time.\r\n\r\nhttps://community.openproject.com/projects/openproject/work_packages/28611/activity","created_at":"2018-09-25T07:57:39Z","updated_at":"2018-09-25T07:57:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/opf/openproject/pulls/6720/commits","review_comments_url":"https://api.github.com/repos/opf/openproject/pulls/6720/comments","review_comment_url":"https://api.github.com/repos/opf/openproject/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opf/openproject/issues/6720/comments","statuses_url":"https://api.github.com/repos/opf/openproject/statuses/994c2d469c5fc2c7e58dba53fe7fe9cc2f7f28b5","head":{"label":"opf:fix/avoid_adding_non_writeable_filters_multiple_times","ref":"fix/avoid_adding_non_writeable_filters_multiple_times","sha":"994c2d469c5fc2c7e58dba53fe7fe9cc2f7f28b5","user":{"login":"opf","id":1756674,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NTY2NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1756674?v=4","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"repo":{"id":6899875,"node_id":"MDEwOlJlcG9zaXRvcnk2ODk5ODc1","name":"openproject","full_name":"opf/openproject","private":false,"owner":{"login":"opf","id":1756674,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NTY2NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1756674?v=4","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/opf/openproject","description":"OpenProject is the leading open source project management software.","fork":false,"url":"https://api.github.com/repos/opf/openproject","forks_url":"https://api.github.com/repos/opf/openproject/forks","keys_url":"https://api.github.com/repos/opf/openproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opf/openproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opf/openproject/teams","hooks_url":"https://api.github.com/repos/opf/openproject/hooks","issue_events_url":"https://api.github.com/repos/opf/openproject/issues/events{/number}","events_url":"https://api.github.com/repos/opf/openproject/events","assignees_url":"https://api.github.com/repos/opf/openproject/assignees{/user}","branches_url":"https://api.github.com/repos/opf/openproject/branches{/branch}","tags_url":"https://api.github.com/repos/opf/openproject/tags","blobs_url":"https://api.github.com/repos/opf/openproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opf/openproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opf/openproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/opf/openproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opf/openproject/statuses/{sha}","languages_url":"https://api.github.com/repos/opf/openproject/languages","stargazers_url":"https://api.github.com/repos/opf/openproject/stargazers","contributors_url":"https://api.github.com/repos/opf/openproject/contributors","subscribers_url":"https://api.github.com/repos/opf/openproject/subscribers","subscription_url":"https://api.github.com/repos/opf/openproject/subscription","commits_url":"https://api.github.com/repos/opf/openproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/opf/openproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/opf/openproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/opf/openproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/opf/openproject/contents/{+path}","compare_url":"https://api.github.com/repos/opf/openproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opf/openproject/merges","archive_url":"https://api.github.com/repos/opf/openproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opf/openproject/downloads","issues_url":"https://api.github.com/repos/opf/openproject/issues{/number}","pulls_url":"https://api.github.com/repos/opf/openproject/pulls{/number}","milestones_url":"https://api.github.com/repos/opf/openproject/milestones{/number}","notifications_url":"https://api.github.com/repos/opf/openproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opf/openproject/labels{/name}","releases_url":"https://api.github.com/repos/opf/openproject/releases{/id}","deployments_url":"https://api.github.com/repos/opf/openproject/deployments","created_at":"2012-11-28T09:59:11Z","updated_at":"2018-09-25T05:32:48Z","pushed_at":"2018-09-25T07:56:40Z","git_url":"git://github.com/opf/openproject.git","ssh_url":"git@github.com:opf/openproject.git","clone_url":"https://github.com/opf/openproject.git","svn_url":"https://github.com/opf/openproject","homepage":"https://www.openproject.org","size":122945,"stargazers_count":2356,"watchers_count":2356,"language":"Ruby","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":753,"mirror_url":null,"archived":false,"open_issues_count":11,"license":null,"forks":753,"open_issues":11,"watchers":2356,"default_branch":"dev"}},"base":{"label":"opf:release/8.0","ref":"release/8.0","sha":"a58636592d48de4c4a685951c0afeb80b06b920d","user":{"login":"opf","id":1756674,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NTY2NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1756674?v=4","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"repo":{"id":6899875,"node_id":"MDEwOlJlcG9zaXRvcnk2ODk5ODc1","name":"openproject","full_name":"opf/openproject","private":false,"owner":{"login":"opf","id":1756674,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NTY2NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1756674?v=4","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/opf/openproject","description":"OpenProject is the leading open source project management software.","fork":false,"url":"https://api.github.com/repos/opf/openproject","forks_url":"https://api.github.com/repos/opf/openproject/forks","keys_url":"https://api.github.com/repos/opf/openproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opf/openproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opf/openproject/teams","hooks_url":"https://api.github.com/repos/opf/openproject/hooks","issue_events_url":"https://api.github.com/repos/opf/openproject/issues/events{/number}","events_url":"https://api.github.com/repos/opf/openproject/events","assignees_url":"https://api.github.com/repos/opf/openproject/assignees{/user}","branches_url":"https://api.github.com/repos/opf/openproject/branches{/branch}","tags_url":"https://api.github.com/repos/opf/openproject/tags","blobs_url":"https://api.github.com/repos/opf/openproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opf/openproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opf/openproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/opf/openproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opf/openproject/statuses/{sha}","languages_url":"https://api.github.com/repos/opf/openproject/languages","stargazers_url":"https://api.github.com/repos/opf/openproject/stargazers","contributors_url":"https://api.github.com/repos/opf/openproject/contributors","subscribers_url":"https://api.github.com/repos/opf/openproject/subscribers","subscription_url":"https://api.github.com/repos/opf/openproject/subscription","commits_url":"https://api.github.com/repos/opf/openproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/opf/openproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/opf/openproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/opf/openproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/opf/openproject/contents/{+path}","compare_url":"https://api.github.com/repos/opf/openproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opf/openproject/merges","archive_url":"https://api.github.com/repos/opf/openproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opf/openproject/downloads","issues_url":"https://api.github.com/repos/opf/openproject/issues{/number}","pulls_url":"https://api.github.com/repos/opf/openproject/pulls{/number}","milestones_url":"https://api.github.com/repos/opf/openproject/milestones{/number}","notifications_url":"https://api.github.com/repos/opf/openproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opf/openproject/labels{/name}","releases_url":"https://api.github.com/repos/opf/openproject/releases{/id}","deployments_url":"https://api.github.com/repos/opf/openproject/deployments","created_at":"2012-11-28T09:59:11Z","updated_at":"2018-09-25T05:32:48Z","pushed_at":"2018-09-25T07:56:40Z","git_url":"git://github.com/opf/openproject.git","ssh_url":"git@github.com:opf/openproject.git","clone_url":"https://github.com/opf/openproject.git","svn_url":"https://github.com/opf/openproject","homepage":"https://www.openproject.org","size":122945,"stargazers_count":2356,"watchers_count":2356,"language":"Ruby","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":753,"mirror_url":null,"archived":false,"open_issues_count":11,"license":null,"forks":753,"open_issues":11,"watchers":2356,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/opf/openproject/pulls/6720"},"html":{"href":"https://github.com/opf/openproject/pull/6720"},"issue":{"href":"https://api.github.com/repos/opf/openproject/issues/6720"},"comments":{"href":"https://api.github.com/repos/opf/openproject/issues/6720/comments"},"review_comments":{"href":"https://api.github.com/repos/opf/openproject/pulls/6720/comments"},"review_comment":{"href":"https://api.github.com/repos/opf/openproject/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opf/openproject/pulls/6720/commits"},"statuses":{"href":"https://api.github.com/repos/opf/openproject/statuses/994c2d469c5fc2c7e58dba53fe7fe9cc2f7f28b5"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":7,"deletions":6,"changed_files":1}}
{"actor":{"display_login":"ulferts"}}