Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-10-09 06:08:43 +00:00
parent f10d5f68c7
commit 5c47772686
4 changed files with 2 additions and 161 deletions

View File

@ -44,13 +44,10 @@
}
.border-width-1px { border-width: 1px; }
.border-bottom-width-1px { border-bottom-width: 1px; }
.border-style-dashed { border-style: dashed; }
.border-style-solid { border-style: solid; }
.border-bottom-style-solid { border-bottom-style: solid; }
.border-color-blue-300 { border-color: $blue-300; }
.border-color-default { border-color: $border-color; }
.border-bottom-color-default { border-bottom-color: $border-color; }
.border-radius-default { border-radius: $border-radius-default; }
.border-radius-small { border-radius: $border-radius-small; }
.box-shadow-default { box-shadow: 0 2px 4px 0 $black-transparent; }
@ -95,11 +92,6 @@
padding-bottom: $gl-spacing-scale-8;
}
// move this to GitLab UI once onboarding experiment is considered a success
.gl-pl-7 {
padding-left: $gl-spacing-scale-7;
}
.gl-transition-property-stroke-opacity {
transition-property: stroke-opacity;
}
@ -116,47 +108,6 @@
box-shadow: inset 0 0 3px $gl-border-size-1 $blue-500;
}
.gl-sm-align-items-flex-end {
@media (min-width: $breakpoint-sm) {
align-items: flex-end;
}
}
.gl-sm-text-body {
@media (min-width: $breakpoint-sm) {
color: $body-color;
}
}
.gl-sm-font-weight-bold {
@media (min-width: $breakpoint-sm) {
font-weight: $gl-font-weight-bold;
}
}
.gl-min-h-6 {
min-height: $gl-spacing-scale-6;
}
.gl-md-justify-content-end {
@media (min-width: $breakpoint-md) {
width: auto !important;
}
}
.gl-display-md-flex {
@media (min-width: $breakpoint-md) {
display: flex;
}
}
.gl-display-md-none {
@media (min-width: $breakpoint-md) {
display: none;
}
}
// This utility is used to force the z-index to match that of dropdown menu's
.gl-z-dropdown-menu\! {
z-index: 300 !important;

View File

@ -1,15 +0,0 @@
# frozen_string_literal: true
class ResourceWeightEvent < ResourceEvent
include IssueResourceEvent
validates :issue, presence: true
after_save :usage_metrics
private
def usage_metrics
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_weight_changed_action(author: user)
end
end

View File

@ -18,7 +18,6 @@ module Issuable
new_entity.update(update_attributes)
copy_resource_label_events
copy_resource_weight_events
copy_resource_milestone_events
copy_resource_state_events
end
@ -55,16 +54,6 @@ module Issuable
end
end
def copy_resource_weight_events
return unless both_respond_to?(:resource_weight_events)
copy_events(ResourceWeightEvent.table_name, original_entity.resource_weight_events) do |event|
event.attributes
.except('id', 'reference', 'reference_html')
.merge('issue_id' => new_entity.id)
end
end
def copy_resource_milestone_events
return unless milestone_events_supported?
@ -128,3 +117,5 @@ module Issuable
end
end
end
Issuable::Clone::AttributesRewriter.prepend_if_ee('EE::Issuable::Clone::AttributesRewriter')

View File

@ -1,86 +0,0 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ResourceWeightEvent, type: :model do
it_behaves_like 'a resource event'
it_behaves_like 'a resource event for issues'
let_it_be(:user1) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:issue1) { create(:issue, author: user1) }
let_it_be(:issue2) { create(:issue, author: user1) }
let_it_be(:issue3) { create(:issue, author: user2) }
describe 'validations' do
it { is_expected.not_to allow_value(nil).for(:issue) }
it { is_expected.to allow_value(nil).for(:weight) }
end
describe 'associations' do
it { is_expected.to belong_to(:issue) }
end
describe '.by_issue' do
let_it_be(:event1) { create(:resource_weight_event, issue: issue1) }
let_it_be(:event2) { create(:resource_weight_event, issue: issue2) }
let_it_be(:event3) { create(:resource_weight_event, issue: issue1) }
it 'returns the expected records for an issue with events' do
events = ResourceWeightEvent.by_issue(issue1)
expect(events).to contain_exactly(event1, event3)
end
it 'returns the expected records for an issue with no events' do
events = ResourceWeightEvent.by_issue(issue3)
expect(events).to be_empty
end
end
describe '.created_after' do
let!(:created_at1) { 1.day.ago }
let!(:created_at2) { 2.days.ago }
let!(:created_at3) { 3.days.ago }
let!(:event1) { create(:resource_weight_event, issue: issue1, created_at: created_at1) }
let!(:event2) { create(:resource_weight_event, issue: issue2, created_at: created_at2) }
let!(:event3) { create(:resource_weight_event, issue: issue2, created_at: created_at3) }
it 'returns the expected events' do
events = ResourceWeightEvent.created_after(created_at3)
expect(events).to contain_exactly(event1, event2)
end
it 'returns no events if time is after last record time' do
events = ResourceWeightEvent.created_after(1.minute.ago)
expect(events).to be_empty
end
end
describe '#discussion_id' do
let_it_be(:event) { create(:resource_weight_event, issue: issue1, created_at: Time.utc(2019, 12, 30)) }
it 'returns the expected id' do
allow(Digest::SHA1).to receive(:hexdigest)
.with("ResourceWeightEvent-#{event.id}-#{user1.id}")
.and_return('73d167c478')
expect(event.discussion_id).to eq('73d167c478')
end
end
context 'callbacks' do
describe '#usage_metrics' do
it 'tracks changed weights' do
expect(Gitlab::UsageDataCounters::IssueActivityUniqueCounter).to receive(:track_issue_weight_changed_action).with(author: user1)
create(:resource_weight_event, issue: issue1, user: user1)
end
end
end
end