diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 96faea5536..594472bd82 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -42,7 +42,8 @@ class JiraService < Service { type: 'text', name: 'project_url', placeholder: 'Url to JIRA, http://jira.example' }, { type: 'text', name: 'username', placeholder: '' }, { type: 'password', name: 'password', placeholder: '' }, - { type: 'text', name: 'api_version', placeholder: '2' } + { type: 'text', name: 'api_version', placeholder: '2' }, + { type: 'text', name: 'jira_issue_transition_id', placeholder: '2' } ] end @@ -69,7 +70,7 @@ class JiraService < Service }] }, 'transition' => { - 'id' => '2' + 'id' => jira_issue_transition_id } } diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index a662984969..20bbd29613 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -31,6 +31,17 @@ %strong = @group.created_at.stamp("March 1, 1999") + - if @group.ldap_cn.present? + %li + %span.light LDAP group cn: + %strong + = @group.ldap_cn + + %li + %span.light LDAP access level: + %strong + = @group.human_ldap_access + .panel.panel-default .panel-heading %h3.panel-title @@ -50,11 +61,11 @@ = paginate @projects, param_name: 'projects_page', theme: 'gitlab' - if @group.shared_projects.any? - .ui-box - .title + .panel.panel-default + .panel-heading Projects shared with #{@group.name} - %small - (#{@group.shared_projects.count}) + %span.badge + #{@group.shared_projects.count} %ul.well-list - @group.shared_projects.sort_by(&:name).each do |project| %li diff --git a/app/views/groups/members.html.haml b/app/views/groups/members.html.haml index 6e3b462b75..d00397c26a 100644 --- a/app/views/groups/members.html.haml +++ b/app/views/groups/members.html.haml @@ -18,7 +18,7 @@ - if current_user && current_user.can?(:manage_group, @group) .pull-right - if ldap_enabled? && @group.ldap_cn.present? - = link_to reset_access_group_ldap_path(@group), class: 'btn grouped', data: { confirm: "Reset the access level of all other LDAP group team members to '#{@group.human_ldap_access}'?" }, method: :put do + = link_to reset_access_group_ldap_path(@group), class: 'btn btn-grouped', data: { confirm: "Reset the access level of all other LDAP group team members to '#{@group.human_ldap_access}'?" }, method: :put do Reset access = link_to '#', class: 'btn btn-new js-toggle-button' do @@ -28,6 +28,14 @@ .js-toggle-content.hide.new-group-member-holder = render "new_group_member" +- if ldap_enabled? && @group.ldap_cn.present? + .bs-callout.bs-callout-info + The members of this group are synced with the LDAP group with cn + %code #{@group.ldap_cn} + \. They are given + %code #{@group.human_ldap_access} + access. + .panel.panel-default.prepend-top-20 .panel-heading %strong #{@group.name} diff --git a/db/migrate/20140811155127_add_jira_issue_transition_id_to_services.rb b/db/migrate/20140811155127_add_jira_issue_transition_id_to_services.rb new file mode 100644 index 0000000000..c687804fbe --- /dev/null +++ b/db/migrate/20140811155127_add_jira_issue_transition_id_to_services.rb @@ -0,0 +1,11 @@ +class AddJiraIssueTransitionIdToServices < ActiveRecord::Migration + def up + add_column :services, :jira_issue_transition_id, :string, default: '2' + Service.reset_column_information + Service.where(jira_issue_transition_id: nil).update_all jira_issue_transition_id: '2' + end + + def down + remove_column :services, :jira_issue_transition_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 8d51f26f78..c05897a8b7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140811083829) do +ActiveRecord::Schema.define(version: 20140811155127) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -273,10 +273,10 @@ ActiveRecord::Schema.define(version: 20140811083829) do t.string "type" t.string "title" t.string "token" - t.integer "project_id", null: false + t.integer "project_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.boolean "active", default: false, null: false + t.boolean "active", default: false, null: false t.string "project_url" t.string "subdomain" t.string "room" @@ -285,6 +285,7 @@ ActiveRecord::Schema.define(version: 20140811083829) do t.string "username" t.string "password" t.string "api_version" + t.string "jira_issue_transition_id", default: "2" end add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree diff --git a/spec/models/jira_service_spec.rb b/spec/models/jira_service_spec.rb index e1b2a91b78..ae81531c86 100644 --- a/spec/models/jira_service_spec.rb +++ b/spec/models/jira_service_spec.rb @@ -55,5 +55,13 @@ describe JiraService, models: true do body: /Issue solved with/ ).once end + + it "calls the api with jira_issue_transition_id" do + @jira_service.jira_issue_transition_id = 'this-is-a-custom-id' + @jira_service.execute(@sample_data, JiraIssue.new("JIRA-123")) + WebMock.should have_requested(:post, @api_url).with( + body: /this-is-a-custom-id/ + ).once + end end end