{"action":"created","comment":{"url":"https://api.github.com/repos/hennevogel/open-build-service/pulls/comments/45958191","id":45958191,"diff_hunk":"@@ -111,4 +111,43 @@ def get_build_flags_moi(flag_type)\n     the_flags\n   end\n \n+  def existing_flag(options = {})\n+    main_object.flags.where(\n+      repo: options[:repo], architecture: options[:architecture]\n+    ).first\n+  end\n+\n+  def temporary_flag(attributes = {})\n+    attributes.update(flag: 'build') # make it configurable\n+    attributes[:status] = Flag.default_state('build') unless attributes[:status]\n+\n+    main_object.flags.new(attributes)\n+  end\n+\n+  def fetch_flag(options = {})\n+    existing_flag(options) || temporary_flag(options)\n+  end\n+\n+  def get_build_flags_alt\n+    flags = { \"all\" => [] }\n+    flags['all'] << fetch_flag\n+\n+    status = flags['all'].first.status\n+\n+    main_object.architectures.each do |arch|\n+      flags['all'] << fetch_flag(architecture: arch, status: status)\n+    end\n+\n+    main_object.repositories.each do |repo|\n+      flags[repo.name] = []\n+      flags[repo.name] << fetch_flag(repo: repo.name, status: status)\n+\n+      main_object.architectures.each do |arch|\n+        flags[repo.name] << fetch_flag(repo: repo.name, architecture: arch, status: status)\n+      end\n+    end\n+\n+    flags\n+  end\n+","path":"src/api/app/mixins/webui/has_flags.rb","position":42,"original_position":42,"commit_id":"3cd6caef4c002aafdea71f9f15d648e1412b9a9a","original_commit_id":"3cd6caef4c002aafdea71f9f15d648e1412b9a9a","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Extra empty line detected at module body end.","created_at":"2015-11-26T09:32:48Z","updated_at":"2015-11-26T09:32:48Z","html_url":"https://github.com/hennevogel/open-build-service/pull/6#discussion_r45958191","pull_request_url":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/hennevogel/open-build-service/pulls/comments/45958191"},"html":{"href":"https://github.com/hennevogel/open-build-service/pull/6#discussion_r45958191"},"pull_request":{"href":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6","id":51887550,"html_url":"https://github.com/hennevogel/open-build-service/pull/6","diff_url":"https://github.com/hennevogel/open-build-service/pull/6.diff","patch_url":"https://github.com/hennevogel/open-build-service/pull/6.patch","issue_url":"https://api.github.com/repos/hennevogel/open-build-service/issues/6","number":6,"state":"open","locked":false,"title":"get_build_flags_alt","user":{"login":"bgeuken","id":968949,"avatar_url":"https://avatars.githubusercontent.com/u/968949?v=3","gravatar_id":"","url":"https://api.github.com/users/bgeuken","html_url":"https://github.com/bgeuken","followers_url":"https://api.github.com/users/bgeuken/followers","following_url":"https://api.github.com/users/bgeuken/following{/other_user}","gists_url":"https://api.github.com/users/bgeuken/gists{/gist_id}","starred_url":"https://api.github.com/users/bgeuken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgeuken/subscriptions","organizations_url":"https://api.github.com/users/bgeuken/orgs","repos_url":"https://api.github.com/users/bgeuken/repos","events_url":"https://api.github.com/users/bgeuken/events{/privacy}","received_events_url":"https://api.github.com/users/bgeuken/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-26T09:12:48Z","updated_at":"2015-11-26T09:32:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a33573f2818bc46c28198b6f16b3ba6dd69857a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6/commits","review_comments_url":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6/comments","review_comment_url":"https://api.github.com/repos/hennevogel/open-build-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hennevogel/open-build-service/issues/6/comments","statuses_url":"https://api.github.com/repos/hennevogel/open-build-service/statuses/3cd6caef4c002aafdea71f9f15d648e1412b9a9a","head":{"label":"bgeuken:flags","ref":"flags","sha":"3cd6caef4c002aafdea71f9f15d648e1412b9a9a","user":{"login":"bgeuken","id":968949,"avatar_url":"https://avatars.githubusercontent.com/u/968949?v=3","gravatar_id":"","url":"https://api.github.com/users/bgeuken","html_url":"https://github.com/bgeuken","followers_url":"https://api.github.com/users/bgeuken/followers","following_url":"https://api.github.com/users/bgeuken/following{/other_user}","gists_url":"https://api.github.com/users/bgeuken/gists{/gist_id}","starred_url":"https://api.github.com/users/bgeuken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgeuken/subscriptions","organizations_url":"https://api.github.com/users/bgeuken/orgs","repos_url":"https://api.github.com/users/bgeuken/repos","events_url":"https://api.github.com/users/bgeuken/events{/privacy}","received_events_url":"https://api.github.com/users/bgeuken/received_events","type":"User","site_admin":false},"repo":{"id":10003040,"name":"open-build-service","full_name":"bgeuken/open-build-service","owner":{"login":"bgeuken","id":968949,"avatar_url":"https://avatars.githubusercontent.com/u/968949?v=3","gravatar_id":"","url":"https://api.github.com/users/bgeuken","html_url":"https://github.com/bgeuken","followers_url":"https://api.github.com/users/bgeuken/followers","following_url":"https://api.github.com/users/bgeuken/following{/other_user}","gists_url":"https://api.github.com/users/bgeuken/gists{/gist_id}","starred_url":"https://api.github.com/users/bgeuken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgeuken/subscriptions","organizations_url":"https://api.github.com/users/bgeuken/orgs","repos_url":"https://api.github.com/users/bgeuken/repos","events_url":"https://api.github.com/users/bgeuken/events{/privacy}","received_events_url":"https://api.github.com/users/bgeuken/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bgeuken/open-build-service","description":"A generic system to build and distribute packages from sources in an automatic, consistent and reproducible way. Release your software for a wide range of operating systems and hardware architectures.","fork":true,"url":"https://api.github.com/repos/bgeuken/open-build-service","forks_url":"https://api.github.com/repos/bgeuken/open-build-service/forks","keys_url":"https://api.github.com/repos/bgeuken/open-build-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bgeuken/open-build-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bgeuken/open-build-service/teams","hooks_url":"https://api.github.com/repos/bgeuken/open-build-service/hooks","issue_events_url":"https://api.github.com/repos/bgeuken/open-build-service/issues/events{/number}","events_url":"https://api.github.com/repos/bgeuken/open-build-service/events","assignees_url":"https://api.github.com/repos/bgeuken/open-build-service/assignees{/user}","branches_url":"https://api.github.com/repos/bgeuken/open-build-service/branches{/branch}","tags_url":"https://api.github.com/repos/bgeuken/open-build-service/tags","blobs_url":"https://api.github.com/repos/bgeuken/open-build-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bgeuken/open-build-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bgeuken/open-build-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/bgeuken/open-build-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bgeuken/open-build-service/statuses/{sha}","languages_url":"https://api.github.com/repos/bgeuken/open-build-service/languages","stargazers_url":"https://api.github.com/repos/bgeuken/open-build-service/stargazers","contributors_url":"https://api.github.com/repos/bgeuken/open-build-service/contributors","subscribers_url":"https://api.github.com/repos/bgeuken/open-build-service/subscribers","subscription_url":"https://api.github.com/repos/bgeuken/open-build-service/subscription","commits_url":"https://api.github.com/repos/bgeuken/open-build-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/bgeuken/open-build-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/bgeuken/open-build-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/bgeuken/open-build-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/bgeuken/open-build-service/contents/{+path}","compare_url":"https://api.github.com/repos/bgeuken/open-build-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bgeuken/open-build-service/merges","archive_url":"https://api.github.com/repos/bgeuken/open-build-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bgeuken/open-build-service/downloads","issues_url":"https://api.github.com/repos/bgeuken/open-build-service/issues{/number}","pulls_url":"https://api.github.com/repos/bgeuken/open-build-service/pulls{/number}","milestones_url":"https://api.github.com/repos/bgeuken/open-build-service/milestones{/number}","notifications_url":"https://api.github.com/repos/bgeuken/open-build-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bgeuken/open-build-service/labels{/name}","releases_url":"https://api.github.com/repos/bgeuken/open-build-service/releases{/id}","created_at":"2013-05-11T17:48:20Z","updated_at":"2015-07-22T13:02:48Z","pushed_at":"2015-11-26T09:32:41Z","git_url":"git://github.com/bgeuken/open-build-service.git","ssh_url":"git@github.com:bgeuken/open-build-service.git","clone_url":"https://github.com/bgeuken/open-build-service.git","svn_url":"https://github.com/bgeuken/open-build-service","homepage":"http://openbuildservice.org/","size":34869,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hennevogel:refactoring_change_flag","ref":"refactoring_change_flag","sha":"d843010f97cf1d0dd6d1d9cab9a9036b83bbe233","user":{"login":"hennevogel","id":514785,"avatar_url":"https://avatars.githubusercontent.com/u/514785?v=3","gravatar_id":"","url":"https://api.github.com/users/hennevogel","html_url":"https://github.com/hennevogel","followers_url":"https://api.github.com/users/hennevogel/followers","following_url":"https://api.github.com/users/hennevogel/following{/other_user}","gists_url":"https://api.github.com/users/hennevogel/gists{/gist_id}","starred_url":"https://api.github.com/users/hennevogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hennevogel/subscriptions","organizations_url":"https://api.github.com/users/hennevogel/orgs","repos_url":"https://api.github.com/users/hennevogel/repos","events_url":"https://api.github.com/users/hennevogel/events{/privacy}","received_events_url":"https://api.github.com/users/hennevogel/received_events","type":"User","site_admin":false},"repo":{"id":6598365,"name":"open-build-service","full_name":"hennevogel/open-build-service","owner":{"login":"hennevogel","id":514785,"avatar_url":"https://avatars.githubusercontent.com/u/514785?v=3","gravatar_id":"","url":"https://api.github.com/users/hennevogel","html_url":"https://github.com/hennevogel","followers_url":"https://api.github.com/users/hennevogel/followers","following_url":"https://api.github.com/users/hennevogel/following{/other_user}","gists_url":"https://api.github.com/users/hennevogel/gists{/gist_id}","starred_url":"https://api.github.com/users/hennevogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hennevogel/subscriptions","organizations_url":"https://api.github.com/users/hennevogel/orgs","repos_url":"https://api.github.com/users/hennevogel/repos","events_url":"https://api.github.com/users/hennevogel/events{/privacy}","received_events_url":"https://api.github.com/users/hennevogel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hennevogel/open-build-service","description":"A generic system to build and distribute packages from sources in an automatic, consistent and reproducible way. Release your software for a wide range of operating systems and hardware architectures.","fork":true,"url":"https://api.github.com/repos/hennevogel/open-build-service","forks_url":"https://api.github.com/repos/hennevogel/open-build-service/forks","keys_url":"https://api.github.com/repos/hennevogel/open-build-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hennevogel/open-build-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hennevogel/open-build-service/teams","hooks_url":"https://api.github.com/repos/hennevogel/open-build-service/hooks","issue_events_url":"https://api.github.com/repos/hennevogel/open-build-service/issues/events{/number}","events_url":"https://api.github.com/repos/hennevogel/open-build-service/events","assignees_url":"https://api.github.com/repos/hennevogel/open-build-service/assignees{/user}","branches_url":"https://api.github.com/repos/hennevogel/open-build-service/branches{/branch}","tags_url":"https://api.github.com/repos/hennevogel/open-build-service/tags","blobs_url":"https://api.github.com/repos/hennevogel/open-build-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hennevogel/open-build-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hennevogel/open-build-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/hennevogel/open-build-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hennevogel/open-build-service/statuses/{sha}","languages_url":"https://api.github.com/repos/hennevogel/open-build-service/languages","stargazers_url":"https://api.github.com/repos/hennevogel/open-build-service/stargazers","contributors_url":"https://api.github.com/repos/hennevogel/open-build-service/contributors","subscribers_url":"https://api.github.com/repos/hennevogel/open-build-service/subscribers","subscription_url":"https://api.github.com/repos/hennevogel/open-build-service/subscription","commits_url":"https://api.github.com/repos/hennevogel/open-build-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/hennevogel/open-build-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/hennevogel/open-build-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/hennevogel/open-build-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/hennevogel/open-build-service/contents/{+path}","compare_url":"https://api.github.com/repos/hennevogel/open-build-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hennevogel/open-build-service/merges","archive_url":"https://api.github.com/repos/hennevogel/open-build-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hennevogel/open-build-service/downloads","issues_url":"https://api.github.com/repos/hennevogel/open-build-service/issues{/number}","pulls_url":"https://api.github.com/repos/hennevogel/open-build-service/pulls{/number}","milestones_url":"https://api.github.com/repos/hennevogel/open-build-service/milestones{/number}","notifications_url":"https://api.github.com/repos/hennevogel/open-build-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hennevogel/open-build-service/labels{/name}","releases_url":"https://api.github.com/repos/hennevogel/open-build-service/releases{/id}","created_at":"2012-11-08T15:30:07Z","updated_at":"2015-02-12T12:34:17Z","pushed_at":"2015-11-26T09:32:42Z","git_url":"git://github.com/hennevogel/open-build-service.git","ssh_url":"git@github.com:hennevogel/open-build-service.git","clone_url":"https://github.com/hennevogel/open-build-service.git","svn_url":"https://github.com/hennevogel/open-build-service","homepage":"http://openbuildservice.org/","size":35258,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6"},"html":{"href":"https://github.com/hennevogel/open-build-service/pull/6"},"issue":{"href":"https://api.github.com/repos/hennevogel/open-build-service/issues/6"},"comments":{"href":"https://api.github.com/repos/hennevogel/open-build-service/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/hennevogel/open-build-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hennevogel/open-build-service/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/hennevogel/open-build-service/statuses/3cd6caef4c002aafdea71f9f15d648e1412b9a9a"}}}}