{"action":"created","comment":{"url":"https://api.github.com/repos/openSUSE/osem/pulls/comments/50717048","id":50717048,"diff_hunk":"@@ -0,0 +1,71 @@\n+module Admin\n+  class RolesController < Admin::BaseController\n+    load_and_authorize_resource :conference, find_by: :short_title\n+    load_resource :user, only: [ :remove_user, :update ]\n+    before_action :set_selection\n+    # Show flash message with ajax calls\n+    after_filter :prepare_unobtrusive_flash, only: [:add_user, :remove_user]\n+\n+    def index\n+      @roles = Role.where(resource: @conference)\n+    end\n+\n+    def show\n+      @users = @role.users\n+    end\n+\n+    def edit\n+      @users = @role.users\n+    end\n+\n+    def update\n+      role_name = @role.name\n+\n+      if @role.name == 'organizer' && params[:role][:user_ids].reject(&:empty?).blank?\n+        flash[:error] = 'Could not remove user. The conference must have at least one organizer!'\n+        redirect_to admin_conference_roles_path(@conference.short_title) && return\n+      end\n+\n+      if params[:role] && @role.update_attributes(role_params)\n+        flash[:success] = 'Successfully updated role ' + @role.name\n+        redirect_to admin_conference_role_path(@conference.short_title, @role.name)\n+      else\n+        flash[:error] = 'Could not update role! ' + @role.errors.full_messages.to_sentence\n+        @role.name = role_name\n+        render :edit\n+      end\n+    end\n+\n+    def toggle_user\n+      if params[:user] && (user_email = params[:user][:email]) && user_email.present?","path":"app/controllers/admin/roles_controller.rb","position":40,"original_position":40,"commit_id":"a80427df6a5ce6e6f2e07718d28ab773e65d86e8","original_commit_id":"a80427df6a5ce6e6f2e07718d28ab773e65d86e8","user":{"login":"ChrisBr","id":3799140,"avatar_url":"https://avatars.githubusercontent.com/u/3799140?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisBr","html_url":"https://github.com/ChrisBr","followers_url":"https://api.github.com/users/ChrisBr/followers","following_url":"https://api.github.com/users/ChrisBr/following{/other_user}","gists_url":"https://api.github.com/users/ChrisBr/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisBr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisBr/subscriptions","organizations_url":"https://api.github.com/users/ChrisBr/orgs","repos_url":"https://api.github.com/users/ChrisBr/repos","events_url":"https://api.github.com/users/ChrisBr/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisBr/received_events","type":"User","site_admin":false},"body":"Please move \r\n``\r\nuser_email = params[:user][:email]\r\n``\r\nout of the conditional! This is really hard to understand ...","created_at":"2016-01-25T16:28:13Z","updated_at":"2016-01-25T16:28:13Z","html_url":"https://github.com/openSUSE/osem/pull/700#discussion_r50717048","pull_request_url":"https://api.github.com/repos/openSUSE/osem/pulls/700","_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/comments/50717048"},"html":{"href":"https://github.com/openSUSE/osem/pull/700#discussion_r50717048"},"pull_request":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/700"}}},"pull_request":{"url":"https://api.github.com/repos/openSUSE/osem/pulls/700","id":40897222,"html_url":"https://github.com/openSUSE/osem/pull/700","diff_url":"https://github.com/openSUSE/osem/pull/700.diff","patch_url":"https://github.com/openSUSE/osem/pull/700.patch","issue_url":"https://api.github.com/repos/openSUSE/osem/issues/700","number":700,"state":"open","locked":false,"title":"Roles updated","user":{"login":"differentreality","id":4322737,"avatar_url":"https://avatars.githubusercontent.com/u/4322737?v=3","gravatar_id":"","url":"https://api.github.com/users/differentreality","html_url":"https://github.com/differentreality","followers_url":"https://api.github.com/users/differentreality/followers","following_url":"https://api.github.com/users/differentreality/following{/other_user}","gists_url":"https://api.github.com/users/differentreality/gists{/gist_id}","starred_url":"https://api.github.com/users/differentreality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/differentreality/subscriptions","organizations_url":"https://api.github.com/users/differentreality/orgs","repos_url":"https://api.github.com/users/differentreality/repos","events_url":"https://api.github.com/users/differentreality/events{/privacy}","received_events_url":"https://api.github.com/users/differentreality/received_events","type":"User","site_admin":false},"body":"#583 ","created_at":"2015-07-27T12:19:10Z","updated_at":"2016-01-25T16:28:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15a35b1d0262cdb01d50856cc61cdf8e3eee71a5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openSUSE/osem/pulls/700/commits","review_comments_url":"https://api.github.com/repos/openSUSE/osem/pulls/700/comments","review_comment_url":"https://api.github.com/repos/openSUSE/osem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openSUSE/osem/issues/700/comments","statuses_url":"https://api.github.com/repos/openSUSE/osem/statuses/a80427df6a5ce6e6f2e07718d28ab773e65d86e8","head":{"label":"differentreality:roles_updated","ref":"roles_updated","sha":"a80427df6a5ce6e6f2e07718d28ab773e65d86e8","user":{"login":"differentreality","id":4322737,"avatar_url":"https://avatars.githubusercontent.com/u/4322737?v=3","gravatar_id":"","url":"https://api.github.com/users/differentreality","html_url":"https://github.com/differentreality","followers_url":"https://api.github.com/users/differentreality/followers","following_url":"https://api.github.com/users/differentreality/following{/other_user}","gists_url":"https://api.github.com/users/differentreality/gists{/gist_id}","starred_url":"https://api.github.com/users/differentreality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/differentreality/subscriptions","organizations_url":"https://api.github.com/users/differentreality/orgs","repos_url":"https://api.github.com/users/differentreality/repos","events_url":"https://api.github.com/users/differentreality/events{/privacy}","received_events_url":"https://api.github.com/users/differentreality/received_events","type":"User","site_admin":false},"repo":{"id":9815207,"name":"osem","full_name":"differentreality/osem","owner":{"login":"differentreality","id":4322737,"avatar_url":"https://avatars.githubusercontent.com/u/4322737?v=3","gravatar_id":"","url":"https://api.github.com/users/differentreality","html_url":"https://github.com/differentreality","followers_url":"https://api.github.com/users/differentreality/followers","following_url":"https://api.github.com/users/differentreality/following{/other_user}","gists_url":"https://api.github.com/users/differentreality/gists{/gist_id}","starred_url":"https://api.github.com/users/differentreality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/differentreality/subscriptions","organizations_url":"https://api.github.com/users/differentreality/orgs","repos_url":"https://api.github.com/users/differentreality/repos","events_url":"https://api.github.com/users/differentreality/events{/privacy}","received_events_url":"https://api.github.com/users/differentreality/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/differentreality/osem","description":"Open Source Event Manager","fork":true,"url":"https://api.github.com/repos/differentreality/osem","forks_url":"https://api.github.com/repos/differentreality/osem/forks","keys_url":"https://api.github.com/repos/differentreality/osem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/differentreality/osem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/differentreality/osem/teams","hooks_url":"https://api.github.com/repos/differentreality/osem/hooks","issue_events_url":"https://api.github.com/repos/differentreality/osem/issues/events{/number}","events_url":"https://api.github.com/repos/differentreality/osem/events","assignees_url":"https://api.github.com/repos/differentreality/osem/assignees{/user}","branches_url":"https://api.github.com/repos/differentreality/osem/branches{/branch}","tags_url":"https://api.github.com/repos/differentreality/osem/tags","blobs_url":"https://api.github.com/repos/differentreality/osem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/differentreality/osem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/differentreality/osem/git/refs{/sha}","trees_url":"https://api.github.com/repos/differentreality/osem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/differentreality/osem/statuses/{sha}","languages_url":"https://api.github.com/repos/differentreality/osem/languages","stargazers_url":"https://api.github.com/repos/differentreality/osem/stargazers","contributors_url":"https://api.github.com/repos/differentreality/osem/contributors","subscribers_url":"https://api.github.com/repos/differentreality/osem/subscribers","subscription_url":"https://api.github.com/repos/differentreality/osem/subscription","commits_url":"https://api.github.com/repos/differentreality/osem/commits{/sha}","git_commits_url":"https://api.github.com/repos/differentreality/osem/git/commits{/sha}","comments_url":"https://api.github.com/repos/differentreality/osem/comments{/number}","issue_comment_url":"https://api.github.com/repos/differentreality/osem/issues/comments{/number}","contents_url":"https://api.github.com/repos/differentreality/osem/contents/{+path}","compare_url":"https://api.github.com/repos/differentreality/osem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/differentreality/osem/merges","archive_url":"https://api.github.com/repos/differentreality/osem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/differentreality/osem/downloads","issues_url":"https://api.github.com/repos/differentreality/osem/issues{/number}","pulls_url":"https://api.github.com/repos/differentreality/osem/pulls{/number}","milestones_url":"https://api.github.com/repos/differentreality/osem/milestones{/number}","notifications_url":"https://api.github.com/repos/differentreality/osem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/differentreality/osem/labels{/name}","releases_url":"https://api.github.com/repos/differentreality/osem/releases{/id}","deployments_url":"https://api.github.com/repos/differentreality/osem/deployments","created_at":"2013-05-02T14:46:10Z","updated_at":"2015-04-22T15:53:13Z","pushed_at":"2016-01-22T09:00:13Z","git_url":"git://github.com/differentreality/osem.git","ssh_url":"git@github.com:differentreality/osem.git","clone_url":"https://github.com/differentreality/osem.git","svn_url":"https://github.com/differentreality/osem","homepage":null,"size":5453,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openSUSE:master","ref":"master","sha":"24f0625be10bce8a168d00819f6100ec4ff7cff1","user":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":5911225,"name":"osem","full_name":"openSUSE/osem","owner":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openSUSE/osem","description":"Open Source Event Manager. An event management tool tailored to Free and Open Source Software conferences.","fork":false,"url":"https://api.github.com/repos/openSUSE/osem","forks_url":"https://api.github.com/repos/openSUSE/osem/forks","keys_url":"https://api.github.com/repos/openSUSE/osem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openSUSE/osem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openSUSE/osem/teams","hooks_url":"https://api.github.com/repos/openSUSE/osem/hooks","issue_events_url":"https://api.github.com/repos/openSUSE/osem/issues/events{/number}","events_url":"https://api.github.com/repos/openSUSE/osem/events","assignees_url":"https://api.github.com/repos/openSUSE/osem/assignees{/user}","branches_url":"https://api.github.com/repos/openSUSE/osem/branches{/branch}","tags_url":"https://api.github.com/repos/openSUSE/osem/tags","blobs_url":"https://api.github.com/repos/openSUSE/osem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openSUSE/osem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openSUSE/osem/git/refs{/sha}","trees_url":"https://api.github.com/repos/openSUSE/osem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openSUSE/osem/statuses/{sha}","languages_url":"https://api.github.com/repos/openSUSE/osem/languages","stargazers_url":"https://api.github.com/repos/openSUSE/osem/stargazers","contributors_url":"https://api.github.com/repos/openSUSE/osem/contributors","subscribers_url":"https://api.github.com/repos/openSUSE/osem/subscribers","subscription_url":"https://api.github.com/repos/openSUSE/osem/subscription","commits_url":"https://api.github.com/repos/openSUSE/osem/commits{/sha}","git_commits_url":"https://api.github.com/repos/openSUSE/osem/git/commits{/sha}","comments_url":"https://api.github.com/repos/openSUSE/osem/comments{/number}","issue_comment_url":"https://api.github.com/repos/openSUSE/osem/issues/comments{/number}","contents_url":"https://api.github.com/repos/openSUSE/osem/contents/{+path}","compare_url":"https://api.github.com/repos/openSUSE/osem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openSUSE/osem/merges","archive_url":"https://api.github.com/repos/openSUSE/osem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openSUSE/osem/downloads","issues_url":"https://api.github.com/repos/openSUSE/osem/issues{/number}","pulls_url":"https://api.github.com/repos/openSUSE/osem/pulls{/number}","milestones_url":"https://api.github.com/repos/openSUSE/osem/milestones{/number}","notifications_url":"https://api.github.com/repos/openSUSE/osem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openSUSE/osem/labels{/name}","releases_url":"https://api.github.com/repos/openSUSE/osem/releases{/id}","deployments_url":"https://api.github.com/repos/openSUSE/osem/deployments","created_at":"2012-09-22T07:40:18Z","updated_at":"2016-01-13T09:21:45Z","pushed_at":"2016-01-25T16:20:24Z","git_url":"git://github.com/openSUSE/osem.git","ssh_url":"git@github.com:openSUSE/osem.git","clone_url":"https://github.com/openSUSE/osem.git","svn_url":"https://github.com/openSUSE/osem","homepage":"http://osem.io","size":21313,"stargazers_count":91,"watchers_count":91,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":66,"mirror_url":null,"open_issues_count":92,"forks":66,"open_issues":92,"watchers":91,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/700"},"html":{"href":"https://github.com/openSUSE/osem/pull/700"},"issue":{"href":"https://api.github.com/repos/openSUSE/osem/issues/700"},"comments":{"href":"https://api.github.com/repos/openSUSE/osem/issues/700/comments"},"review_comments":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/700/comments"},"review_comment":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/700/commits"},"statuses":{"href":"https://api.github.com/repos/openSUSE/osem/statuses/a80427df6a5ce6e6f2e07718d28ab773e65d86e8"}}}}