Commit 2895937c authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'master' into 27963-tooltips-jobs

* master:
  Remove orange caret icon from mr widget
  Add index to ci_trigger_requests for commit_id
  rspec_profiling: Discover the correct branch name in GitLab CI
  Show parent group members for nested group
  Updated protected branches dropdown image in docs
  Fix admin_labels_spec.rb transient failure
  Make sure our current .gitlab-ci.yml is valid
  Show Pipeline(not Job) in MR desktop notification
  Make min width smaller for user settings
parents 6e3e0ec3 1ce973b5
...@@ -272,7 +272,7 @@ header { ...@@ -272,7 +272,7 @@ header {
.header-user { .header-user {
.dropdown-menu-nav { .dropdown-menu-nav {
width: 140px; min-width: 140px;
margin-top: -5px; margin-top: -5px;
} }
} }
......
...@@ -96,13 +96,6 @@ ...@@ -96,13 +96,6 @@
padding-right: 4px; padding-right: 4px;
} }
&.ci-success_with_warnings {
i {
color: $gl-warning;
}
}
@media (max-width: $screen-xs-max) { @media (max-width: $screen-xs-max) {
flex-wrap: wrap; flex-wrap: wrap;
} }
......
...@@ -9,7 +9,7 @@ class Groups::GroupMembersController < Groups::ApplicationController ...@@ -9,7 +9,7 @@ class Groups::GroupMembersController < Groups::ApplicationController
@sort = params[:sort].presence || sort_value_name @sort = params[:sort].presence || sort_value_name
@project = @group.projects.find(params[:project_id]) if params[:project_id] @project = @group.projects.find(params[:project_id]) if params[:project_id]
@members = @group.group_members @members = GroupMembersFinder.new(@group).execute
@members = @members.non_invite unless can?(current_user, :admin_group, @group) @members = @members.non_invite unless can?(current_user, :admin_group, @group)
@members = @members.search(params[:search]) if params[:search].present? @members = @members.search(params[:search]) if params[:search].present?
@members = @members.sort(@sort) @members = @members.sort(@sort)
......
class GroupMembersFinder < Projects::ApplicationController
def initialize(group)
@group = group
end
def execute
group_members = @group.members
return group_members unless @group.parent
parents_members = GroupMember.non_request.
where(source_id: @group.ancestors.select(:id)).
where.not(user_id: @group.users.select(:id))
wheres = ["members.id IN (#{group_members.select(:id).to_sql})"]
wheres << "members.id IN (#{parents_members.select(:id).to_sql})"
GroupMember.where(wheres.join(' OR '))
end
end
...@@ -206,7 +206,7 @@ class Group < Namespace ...@@ -206,7 +206,7 @@ class Group < Namespace
end end
def members_with_parents def members_with_parents
GroupMember.where(requested_at: nil, source_id: ancestors.map(&:id).push(id)) GroupMember.non_request.where(source_id: ancestors.map(&:id).push(id))
end end
def users_with_parents def users_with_parents
......
...@@ -47,6 +47,7 @@ class Member < ActiveRecord::Base ...@@ -47,6 +47,7 @@ class Member < ActiveRecord::Base
scope :invite, -> { where.not(invite_token: nil) } scope :invite, -> { where.not(invite_token: nil) }
scope :non_invite, -> { where(invite_token: nil) } scope :non_invite, -> { where(invite_token: nil) }
scope :request, -> { where.not(requested_at: nil) } scope :request, -> { where.not(requested_at: nil) }
scope :non_request, -> { where(requested_at: nil) }
scope :has_access, -> { active.where('access_level > 0') } scope :has_access, -> { active.where('access_level > 0') }
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
gitlab_icon: "#{asset_path 'gitlab_logo.png'}", gitlab_icon: "#{asset_path 'gitlab_logo.png'}",
ci_status: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.status : ''}", ci_status: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.status : ''}",
ci_message: { ci_message: {
normal: "Job {{status}} for \"{{title}}\"", normal: "Pipeline {{status}} for \"{{title}}\"",
preparing: "{{status}} job for \"{{title}}\"" preparing: "{{status}} job for \"{{title}}\""
}, },
ci_enable: #{@project.ci_service ? "true" : "false"}, ci_enable: #{@project.ci_service ? "true" : "false"},
ci_title: { ci_title: {
preparing: "{{status}} job", preparing: "{{status}} job",
normal: "Job {{status}}" normal: "Pipeline {{status}}"
}, },
ci_sha: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.short_sha : ''}", ci_sha: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.short_sha : ''}",
ci_pipeline: #{@merge_request.head_pipeline.try(:id).to_json}, ci_pipeline: #{@merge_request.head_pipeline.try(:id).to_json},
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
%label.label.label-danger %label.label.label-danger
%strong Blocked %strong Blocked
- if source.instance_of?(Group) && !@group - if source.instance_of?(Group) && source != @group
&middot; &middot;
= link_to source.name, source, class: "member-group-link" = link_to source.full_name, source, class: "member-group-link"
.hidden-xs.cgray .hidden-xs.cgray
- if member.request? - if member.request?
...@@ -44,8 +44,9 @@ ...@@ -44,8 +44,9 @@
= link_to member.created_by.name, user_path(member.created_by) = link_to member.created_by.name, user_path(member.created_by)
= time_ago_with_tooltip(member.created_at) = time_ago_with_tooltip(member.created_at)
- if show_roles - if show_roles
- current_resource = @project || @group
.controls.member-controls .controls.member-controls
- if show_controls && (member.respond_to?(:group) && @group) || (member.respond_to?(:project) && @project) - if show_controls && member.source == current_resource
- if user != current_user - if user != current_user
= form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f| = form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f|
= f.hidden_field :access_level = f.hidden_field :access_level
......
---
title: Show Pipeline(not Job) in MR desktop notification
merge_request:
author:
---
title: Fix icon colors in merge request widget mini graph
merge_request:
author:
---
title: Add index to ci_trigger_requests for commit_id
merge_request:
author:
...@@ -4,6 +4,12 @@ module RspecProfilingConnection ...@@ -4,6 +4,12 @@ module RspecProfilingConnection
end end
end end
module RspecProfilingGitBranchCi
def branch
ENV['CI_BUILD_REF_NAME'] || super
end
end
if Rails.env.test? if Rails.env.test?
RspecProfiling.configure do |config| RspecProfiling.configure do |config|
if ENV['RSPEC_PROFILING_POSTGRES_URL'] if ENV['RSPEC_PROFILING_POSTGRES_URL']
...@@ -11,4 +17,6 @@ if Rails.env.test? ...@@ -11,4 +17,6 @@ if Rails.env.test?
config.collector = RspecProfiling::Collectors::PSQL config.collector = RspecProfiling::Collectors::PSQL
end end
end end
RspecProfiling::VCS::Git.prepend(RspecProfilingGitBranchCi) if ENV.has_key?('CI')
end end
class AddIndexToCiTriggerRequestsForCommitId < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def change
add_concurrent_index :ci_trigger_requests, :commit_id
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170206101030) do ActiveRecord::Schema.define(version: 20170210075922) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -367,6 +367,8 @@ ActiveRecord::Schema.define(version: 20170206101030) do ...@@ -367,6 +367,8 @@ ActiveRecord::Schema.define(version: 20170206101030) do
t.integer "commit_id" t.integer "commit_id"
end end
add_index "ci_trigger_requests", ["commit_id"], name: "index_ci_trigger_requests_on_commit_id", using: :btree
create_table "ci_triggers", force: :cascade do |t| create_table "ci_triggers", force: :cascade do |t|
t.string "token" t.string "token"
t.integer "project_id" t.integer "project_id"
......
...@@ -35,15 +35,16 @@ RSpec.describe 'admin issues labels' do ...@@ -35,15 +35,16 @@ RSpec.describe 'admin issues labels' do
it 'deletes all labels', js: true do it 'deletes all labels', js: true do
page.within '.labels' do page.within '.labels' do
page.all('.btn-remove').each do |remove| page.all('.btn-remove').each do |remove|
wait_for_ajax
remove.click remove.click
wait_for_ajax
end end
end end
page.within '.manage-labels-list' do wait_for_ajax
expect(page).not_to have_content('bug')
expect(page).not_to have_content('feature_label') expect(page).to have_content("There are no labels yet")
end expect(page).not_to have_content('bug')
expect(page).not_to have_content('feature_label')
end end
end end
......
require 'spec_helper'
feature 'Groups members list', feature: true do
let(:user1) { create(:user, name: 'John Doe') }
let(:user2) { create(:user, name: 'Mary Jane') }
let(:group) { create(:group) }
let(:nested_group) { create(:group, parent: group) }
background do
login_as(user1)
end
scenario 'show members from current group and parent' do
group.add_developer(user1)
nested_group.add_developer(user2)
visit group_group_members_path(nested_group)
expect(first_row.text).to include(user1.name)
expect(second_row.text).to include(user2.name)
end
scenario 'show user once if member of both current group and parent' do
group.add_developer(user1)
nested_group.add_developer(user1)
visit group_group_members_path(nested_group)
expect(first_row.text).to include(user1.name)
expect(second_row).to be_blank
end
def first_row
page.all('ul.content-list > li')[0]
end
def second_row
page.all('ul.content-list > li')[1]
end
end
require 'spec_helper'
describe GroupMembersFinder, '#execute' do
let(:group) { create(:group) }
let(:nested_group) { create(:group, :access_requestable, parent: group) }
let(:user1) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:user4) { create(:user) }
it 'returns members for top-level group' do
member1 = group.add_master(user1)
member2 = group.add_master(user2)
member3 = group.add_master(user3)
result = described_class.new(group).execute
expect(result.to_a).to eq([member3, member2, member1])
end
it 'returns members for nested group' do
group.add_master(user2)
nested_group.request_access(user4)
member1 = group.add_master(user1)
member3 = nested_group.add_master(user2)
member4 = nested_group.add_master(user3)
result = described_class.new(nested_group).execute
expect(result.to_a).to eq([member4, member3, member1])
end
end
...@@ -4,6 +4,16 @@ module Ci ...@@ -4,6 +4,16 @@ module Ci
describe GitlabCiYamlProcessor, lib: true do describe GitlabCiYamlProcessor, lib: true do
let(:path) { 'path' } let(:path) { 'path' }
describe 'our current .gitlab-ci.yml' do
let(:config) { File.read("#{Rails.root}/.gitlab-ci.yml") }
it 'is valid' do
error_message = described_class.validation_message(config)
expect(error_message).to be_nil
end
end
describe '#build_attributes' do describe '#build_attributes' do
describe 'coverage entry' do describe 'coverage entry' do
subject { described_class.new(config, path).build_attributes(:rspec) } subject { described_class.new(config, path).build_attributes(:rspec) }
......
...@@ -129,6 +129,14 @@ describe Member, models: true do ...@@ -129,6 +129,14 @@ describe Member, models: true do
it { expect(described_class.request).not_to include @accepted_request_member } it { expect(described_class.request).not_to include @accepted_request_member }
end end
describe '.non_request' do
it { expect(described_class.non_request).to include @master }
it { expect(described_class.non_request).to include @invited_member }
it { expect(described_class.non_request).to include @accepted_invite_member }
it { expect(described_class.non_request).not_to include @requested_member }
it { expect(described_class.non_request).to include @accepted_request_member }
end
describe '.developers' do describe '.developers' do
subject { described_class.developers.to_a } subject { described_class.developers.to_a }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment