Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2019-12-04 18:08:46 +00:00
parent 8d3aee3636
commit b41cd8cb92
20 changed files with 3217 additions and 34 deletions

View file

@ -1 +1 @@
10.2.0
10.3.0

View file

@ -144,6 +144,9 @@ export default {
isLimitedContainer() {
return !this.showTreeList && !this.isParallelView && !this.isFluidLayout;
},
shouldSetDiscussions() {
return this.isNotesFetched && !this.assignedDiscussions && !this.isLoading;
},
},
watch: {
diffViewType() {
@ -160,6 +163,11 @@ export default {
},
isLoading: 'adjustView',
showTreeList: 'adjustView',
shouldSetDiscussions(newVal) {
if (newVal) {
this.setDiscussions();
}
},
},
mounted() {
this.setBaseConfig({
@ -214,26 +222,28 @@ export default {
isLatestVersion() {
return window.location.search.indexOf('diff_id') === -1;
},
startDiffRendering() {
requestIdleCallback(
() => {
this.startRenderDiffsQueue();
},
{ timeout: 1000 },
);
},
fetchData(toggleTree = true) {
if (this.isLatestVersion() && this.glFeatures.diffsBatchLoad) {
this.fetchDiffFilesMeta()
.then(() => {
if (toggleTree) this.hideTreeListIfJustOneFile();
this.startDiffRendering();
})
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
this.fetchDiffFilesBatch()
.then(() => {
requestIdleCallback(
() => {
this.setDiscussions();
this.startRenderDiffsQueue();
},
{ timeout: 1000 },
);
})
.then(() => this.startDiffRendering())
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
@ -246,7 +256,6 @@ export default {
requestIdleCallback(
() => {
this.setDiscussions();
this.startRenderDiffsQueue();
},
{ timeout: 1000 },
@ -262,7 +271,7 @@ export default {
}
},
setDiscussions() {
if (this.isNotesFetched && !this.assignedDiscussions && !this.isLoading) {
if (this.shouldSetDiscussions) {
this.assignedDiscussions = true;
requestIdleCallback(

View file

@ -119,7 +119,7 @@ export const fetchDiffFilesMeta = ({ commit, state }) => {
.get(state.endpointMetadata)
.then(({ data }) => {
const strippedData = { ...data };
strippedData.diff_files = [];
delete strippedData.diff_files;
commit(types.SET_LOADING, false);
commit(types.SET_MERGE_REQUEST_DIFFS, data.merge_request_diffs || []);
commit(types.SET_DIFF_DATA, strippedData);

View file

@ -39,7 +39,16 @@ export default {
},
[types.SET_DIFF_DATA](state, data) {
prepareDiffData(data);
if (
!(
gon &&
gon.features &&
gon.features.diffsBatchLoad &&
window.location.search.indexOf('diff_id') === -1
)
) {
prepareDiffData(data);
}
Object.assign(state, {
...convertObjectPropsToCamelCase(data),

View file

@ -28,7 +28,9 @@ export default {
return this.report.name || __('Summary');
},
successPercentage() {
return Math.round((this.report.success_count / this.report.total_count) * 100) || 0;
// Returns a full number when the decimals equal .00.
// Otherwise returns a float to two decimal points
return Number(((this.report.success_count / this.report.total_count) * 100 || 0).toFixed(2));
},
formattedDuration() {
return formatTime(secondsToMilliseconds(this.report.total_time));

View file

@ -3,6 +3,12 @@
class Issue::Metrics < ApplicationRecord
belongs_to :issue
scope :for_issues, ->(issues) { where(issue: issues) }
scope :with_first_mention_not_earlier_than, -> (timestamp) {
where(first_mentioned_in_commit_at: nil)
.or(where(arel_table['first_mentioned_in_commit_at'].gteq(timestamp)))
}
def record!
if issue.milestone_id.present? && self.first_associated_with_milestone_at.blank?
self.first_associated_with_milestone_at = Time.now

View file

@ -55,16 +55,15 @@ class ProcessCommitWorker
end
end
# rubocop: disable CodeReuse/ActiveRecord
def update_issue_metrics(commit, author)
mentioned_issues = commit.all_references(author).issues
return if mentioned_issues.empty?
Issue::Metrics.where(issue_id: mentioned_issues.map(&:id), first_mentioned_in_commit_at: nil)
Issue::Metrics.for_issues(mentioned_issues)
.with_first_mention_not_earlier_than(commit.committed_date)
.update_all(first_mentioned_in_commit_at: commit.committed_date)
end
# rubocop: enable CodeReuse/ActiveRecord
def build_commit(project, hash)
date_suffix = '_date'

View file

@ -0,0 +1,5 @@
---
title: Adjust issue metrics first_mentioned_in_commit_at calculation
merge_request: 20923
author:
type: fixed

View file

@ -0,0 +1,5 @@
---
title: Junit success percentage no longer displays 100% if there are failures
merge_request: 20835
author:
type: fixed

View file

@ -0,0 +1,5 @@
---
title: Update GitLab Shell to v10.3.0
merge_request: 21151
author:
type: other

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,957 @@
{
"name": "group",
"path": "group",
"owner_id": null,
"created_at": "2019-11-20 17:01:53 UTC",
"updated_at": "2019-11-20 17:05:44 UTC",
"description": "Group Description",
"avatar": {
"url": null
},
"membership_lock": false,
"share_with_group_lock": false,
"visibility_level": 0,
"request_access_enabled": true,
"ldap_sync_status": "ready",
"ldap_sync_error": null,
"ldap_sync_last_update_at": null,
"ldap_sync_last_successful_update_at": null,
"ldap_sync_last_sync_at": null,
"lfs_enabled": null,
"parent_id": null,
"shared_runners_minutes_limit": null,
"repository_size_limit": null,
"require_two_factor_authentication": false,
"two_factor_grace_period": 48,
"plan_id": null,
"project_creation_level": 2,
"trial_ends_on": null,
"file_template_project_id": null,
"saml_discovery_token": "rBKx3ioz",
"custom_project_templates_group_id": null,
"auto_devops_enabled": null,
"extra_shared_runners_minutes_limit": null,
"last_ci_minutes_notification_at": null,
"last_ci_minutes_usage_notification_level": null,
"subgroup_creation_level": 1,
"emails_disabled": null,
"max_pages_size": null,
"max_artifacts_size": null,
"milestones": [
{
"id": 7642,
"title": "v4.0",
"project_id": null,
"description": "Et laudantium enim omnis ea reprehenderit iure.",
"due_date": null,
"created_at": "2019-11-20T17:02:14.336Z",
"updated_at": "2019-11-20T17:02:14.336Z",
"state": "closed",
"iid": 5,
"start_date": null,
"group_id": 4351
},
{
"id": 7641,
"title": "v3.0",
"project_id": null,
"description": "Et repellat culpa nemo consequatur ut reprehenderit.",
"due_date": null,
"created_at": "2019-11-20T17:02:14.323Z",
"updated_at": "2019-11-20T17:02:14.323Z",
"state": "active",
"iid": 4,
"start_date": null,
"group_id": 4351
},
{
"id": 7640,
"title": "v2.0",
"project_id": null,
"description": "Velit cupiditate est neque voluptates iste rem sunt.",
"due_date": null,
"created_at": "2019-11-20T17:02:14.309Z",
"updated_at": "2019-11-20T17:02:14.309Z",
"state": "active",
"iid": 3,
"start_date": null,
"group_id": 4351
},
{
"id": 7639,
"title": "v1.0",
"project_id": null,
"description": "Amet velit repellat ut rerum aut cum.",
"due_date": null,
"created_at": "2019-11-20T17:02:14.296Z",
"updated_at": "2019-11-20T17:02:14.296Z",
"state": "active",
"iid": 2,
"start_date": null,
"group_id": 4351
},
{
"id": 7638,
"title": "v0.0",
"project_id": null,
"description": "Ea quia asperiores ut modi dolorem sunt non numquam.",
"due_date": null,
"created_at": "2019-11-20T17:02:14.282Z",
"updated_at": "2019-11-20T17:02:14.282Z",
"state": "active",
"iid": 1,
"start_date": null,
"group_id": 4351
}
],
"badges": [
{
"id": 10,
"link_url": "https://localhost:3443/%{default_branch}",
"image_url": "https://badge_image.png",
"project_id": null,
"group_id": 4351,
"created_at": "2019-11-20T17:27:02.047Z",
"updated_at": "2019-11-20T17:27:02.047Z",
"type": "GroupBadge"
}
],
"labels": [
{
"id": 23452,
"title": "Bruffefunc",
"color": "#1d2da4",
"project_id": null,
"created_at": "2019-11-20T17:02:20.546Z",
"updated_at": "2019-11-20T17:02:20.546Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23446,
"title": "Cafunc",
"color": "#73ed5b",
"project_id": null,
"created_at": "2019-11-20T17:02:20.526Z",
"updated_at": "2019-11-20T17:02:20.526Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23451,
"title": "Casche",
"color": "#649a75",
"project_id": null,
"created_at": "2019-11-20T17:02:20.544Z",
"updated_at": "2019-11-20T17:02:20.544Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23444,
"title": "Cocell",
"color": "#1b365c",
"project_id": null,
"created_at": "2019-11-20T17:02:20.521Z",
"updated_at": "2019-11-20T17:02:20.521Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23449,
"title": "Packfunc",
"color": "#e33bba",
"project_id": null,
"created_at": "2019-11-20T17:02:20.537Z",
"updated_at": "2019-11-20T17:02:20.537Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23443,
"title": "Panabalt",
"color": "#84f708",
"project_id": null,
"created_at": "2019-11-20T17:02:20.518Z",
"updated_at": "2019-11-20T17:02:20.518Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23447,
"title": "Phierefunc",
"color": "#4ab4a8",
"project_id": null,
"created_at": "2019-11-20T17:02:20.530Z",
"updated_at": "2019-11-20T17:02:20.530Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23445,
"title": "Pons",
"color": "#47f440",
"project_id": null,
"created_at": "2019-11-20T17:02:20.523Z",
"updated_at": "2019-11-20T17:02:20.523Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23448,
"title": "Sosync",
"color": "#110320",
"project_id": null,
"created_at": "2019-11-20T17:02:20.532Z",
"updated_at": "2019-11-20T17:02:20.532Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
},
{
"id": 23450,
"title": "TSL",
"color": "#58796f",
"project_id": null,
"created_at": "2019-11-20T17:02:20.541Z",
"updated_at": "2019-11-20T17:02:20.541Z",
"template": false,
"description": null,
"group_id": 4351,
"type": "GroupLabel",
"priorities": [],
"textColor": "#FFFFFF"
}
],
"boards": [
{
"id": 56,
"project_id": null,
"created_at": "2019-11-20T17:27:16.808Z",
"updated_at": "2019-11-20T17:27:16.808Z",
"name": "Development",
"milestone_id": null,
"group_id": 4351,
"weight": null,
"labels": []
},
{
"id": 57,
"project_id": null,
"created_at": "2019-11-20T17:27:41.118Z",
"updated_at": "2019-11-20T17:27:41.118Z",
"name": "Board!",
"milestone_id": 7638,
"group_id": 4351,
"weight": null,
"labels": []
}
],
"members": [
{
"id": 13766,
"access_level": 30,
"source_id": 4351,
"source_type": "Namespace",
"user_id": 42,
"notification_level": 3,
"created_at": "2019-11-20T17:04:36.184Z",
"updated_at": "2019-11-20T17:04:36.184Z",
"created_by_id": null,
"invite_email": null,
"invite_token": null,
"invite_accepted_at": null,
"requested_at": null,
"expires_at": null,
"ldap": false,
"override": false,
"user": {
"id": 42,
"email": "moriah@collinsmurphy.com",
"username": "reported_user_15"
}
},
{
"id": 13765,
"access_level": 40,
"source_id": 4351,
"source_type": "Namespace",
"user_id": 271,
"notification_level": 3,
"created_at": "2019-11-20T17:04:36.044Z",
"updated_at": "2019-11-20T17:04:36.044Z",
"created_by_id": null,
"invite_email": null,
"invite_token": null,
"invite_accepted_at": null,
"requested_at": null,
"expires_at": null,
"ldap": false,
"override": false,
"user": {
"id": 271,
"email": "garret@connellystark.ca",
"username": "charlesetta"
}
},
{
"id": 13764,
"access_level": 30,
"source_id": 4351,
"source_type": "Namespace",
"user_id": 206,
"notification_level": 3,
"created_at": "2019-11-20T17:04:35.840Z",
"updated_at": "2019-11-20T17:04:35.840Z",
"created_by_id": null,
"invite_email": null,
"invite_token": null,
"invite_accepted_at": null,
"requested_at": null,
"expires_at": null,
"ldap": false,
"override": false,
"user": {
"id": 206,
"email": "margaret.bergnaum@reynolds.us",
"username": "gwendolyn_robel"
}
},
{
"id": 13763,
"access_level": 10,
"source_id": 4351,
"source_type": "Namespace",
"user_id": 39,
"notification_level": 3,
"created_at": "2019-11-20T17:04:35.704Z",
"updated_at": "2019-11-20T17:04:35.704Z",
"created_by_id": null,
"invite_email": null,
"invite_token": null,
"invite_accepted_at": null,
"requested_at": null,
"expires_at": null,
"ldap": false,
"override": false,
"user": {
"id": 39,
"email": "alexis_berge@kerlukeklein.us",
"username": "reported_user_12"
}
},
{
"id": 13762,
"access_level": 20,
"source_id": 4351,
"source_type": "Namespace",
"user_id": 1624,
"notification_level": 3,
"created_at": "2019-11-20T17:04:35.566Z",
"updated_at": "2019-11-20T17:04:35.566Z",
"created_by_id": null,
"invite_email": null,
"invite_token": null,
"invite_accepted_at": null,
"requested_at": null,
"expires_at": null,
"ldap": false,
"override": false,
"user": {
"id": 1624,
"email": "nakesha.herzog@powlowski.com",
"username": "adriene.mcclure"
}
},
{
"id": 12920,
"access_level": 50,
"source_id": 4351,
"source_type": "Namespace",
"user_id": 1,
"notification_level": 3,
"created_at": "2019-11-20T17:01:53.505Z",
"updated_at": "2019-11-20T17:01:53.505Z",
"created_by_id": null,
"invite_email": null,
"invite_token": null,
"invite_accepted_at": null,
"requested_at": null,
"expires_at": null,
"ldap": false,
"override": false,
"user": {
"id": 1,
"email": "admin@example.com",
"username": "root"
}
}
],
"epics": [
{
"id": 13622,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.754Z",
"updated_at": "2019-11-20T18:38:40.054Z",
"title": "Provident neque consequatur numquam ad laboriosam voluptatem magnam.",
"description": "Fugit nisi est ut numquam quia rerum vitae qui. Et in est aliquid voluptas et ut vitae. In distinctio voluptates ut deleniti iste.\n\nReiciendis eum sunt vero blanditiis at quia. Voluptate eum facilis illum ea distinctio maiores. Doloribus aut nemo ea distinctio.\n\nNihil cum distinctio voluptates quam. Laboriosam distinctio ea accusantium soluta perspiciatis nesciunt impedit. Id qui natus quis minima voluptatum velit ut reprehenderit. Molestiae quia est harum sapiente rem error architecto id. Et minus ipsa et ut ut.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": [
{
"id": 44170,
"note": "added epic \u00265 as child epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:40.031Z",
"updated_at": "2019-11-20T18:38:40.035Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13622,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "ba005d8dd59cd37a4f32406d46e759b08fd15510",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
},
{
"id": 44168,
"note": "added epic \u00264 as child epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:35.669Z",
"updated_at": "2019-11-20T18:38:35.673Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13622,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "9b49d3b017aadc1876d477b960e6f8efb99ce29f",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
},
{
"id": 44166,
"note": "added epic \u00263 as child epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:30.944Z",
"updated_at": "2019-11-20T18:38:30.948Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13622,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "cccfe967f48e699a466c87a55a9f8acb00fec1a1",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
},
{
"id": 44164,
"note": "added epic \u00262 as child epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:26.689Z",
"updated_at": "2019-11-20T18:38:26.724Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13622,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "133f0c3001860fa8d2031e398a65db74477378c4",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
}
]
},
{
"id": 13623,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 2,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.769Z",
"updated_at": "2019-11-20T18:38:26.851Z",
"title": "Omnis accusantium commodi voluptas odio illo eum ut.",
"description": "Eius vero et iste amet est voluptatem modi. Doloribus ipsam beatae et ut autem ut animi. Dolor culpa dolor omnis delectus est tempora inventore ab. Optio labore tenetur libero quia provident et quis. Blanditiis architecto sint possimus cum aut adipisci.\n\nDolores quisquam sunt cupiditate unde qui vitae nemo. Odio quas omnis ut nobis. Possimus fugit deserunt quia sed ab numquam veritatis nihil.\n\nQui nemo adipisci magnam perferendis voluptatem modi. Eius enim iure dolores consequuntur eum nobis adipisci. Consequatur architecto et quas deleniti hic id laborum officiis. Enim perferendis quis quasi totam delectus rerum deleniti.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": 13622,
"relative_position": 1073741323,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"parent": {
"id": 13622,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.754Z",
"updated_at": "2019-11-20T18:38:40.054Z",
"title": "Provident neque consequatur numquam ad laboriosam voluptatem magnam.",
"description": "Fugit nisi est ut numquam quia rerum vitae qui. Et in est aliquid voluptas et ut vitae. In distinctio voluptates ut deleniti iste.\n\nReiciendis eum sunt vero blanditiis at quia. Voluptate eum facilis illum ea distinctio maiores. Doloribus aut nemo ea distinctio.\n\nNihil cum distinctio voluptates quam. Laboriosam distinctio ea accusantium soluta perspiciatis nesciunt impedit. Id qui natus quis minima voluptatum velit ut reprehenderit. Molestiae quia est harum sapiente rem error architecto id. Et minus ipsa et ut ut.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null
},
"notes": [
{
"id": 44165,
"note": "added epic \u00261 as parent epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:26.822Z",
"updated_at": "2019-11-20T18:38:26.826Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13623,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "15f0a7f4ed16a07bc78841e122524bb867edcf86",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
}
]
},
{
"id": 13624,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 3,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.783Z",
"updated_at": "2019-11-20T18:38:31.018Z",
"title": "Quis dolore velit possimus eaque aut amet esse voluptate aliquam.",
"description": "Ab veritatis reprehenderit nulla laboriosam et sed asperiores corporis. Est accusantium maxime perferendis et. Omnis a qui voluptates non excepturi.\n\nAdipisci labore maiores dicta sed magnam aut. Veritatis delectus dolorum qui id. Dolorum tenetur quo iure amet. Eveniet reprehenderit dolor ipsam quia ratione quo. Facilis voluptatem vel repellat id illum.\n\nAut et magnam aut minus aspernatur. Fuga quo necessitatibus mollitia maxime quasi. Qui aspernatur quia accusamus est quod. Qui assumenda veritatis dolor non eveniet quibusdam quos qui.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": 13622,
"relative_position": 1073740823,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"parent": {
"id": 13622,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.754Z",
"updated_at": "2019-11-20T18:38:40.054Z",
"title": "Provident neque consequatur numquam ad laboriosam voluptatem magnam.",
"description": "Fugit nisi est ut numquam quia rerum vitae qui. Et in est aliquid voluptas et ut vitae. In distinctio voluptates ut deleniti iste.\n\nReiciendis eum sunt vero blanditiis at quia. Voluptate eum facilis illum ea distinctio maiores. Doloribus aut nemo ea distinctio.\n\nNihil cum distinctio voluptates quam. Laboriosam distinctio ea accusantium soluta perspiciatis nesciunt impedit. Id qui natus quis minima voluptatum velit ut reprehenderit. Molestiae quia est harum sapiente rem error architecto id. Et minus ipsa et ut ut.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null
},
"notes": [
{
"id": 44167,
"note": "added epic \u00261 as parent epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:30.989Z",
"updated_at": "2019-11-20T18:38:30.993Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13624,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "423ffec14a3ce148c11a802eb1f2613fa8ca9a94",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
}
]
},
{
"id": 13625,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 4,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.798Z",
"updated_at": "2019-11-20T18:38:35.765Z",
"title": "Possimus et ut iste temporibus earum cupiditate voluptatem esse assumenda amet.",
"description": "Et at corporis sed id rerum ullam dolore. Odio magnam corporis excepturi neque est. Est accusamus nostrum qui rerum.\n\nEt aut dolores eaque quibusdam aut quas explicabo id. Est necessitatibus praesentium omnis et vero laboriosam et. Sunt in saepe qui laudantium et voluptas.\n\nVelit sunt odit eum omnis beatae eius aut. Dolores commodi qui impedit deleniti et magnam pariatur. Aut odit amet ipsum ea atque. Itaque est ut sunt ullam eum nam.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": 13622,
"relative_position": 1073740323,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"parent": {
"id": 13622,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.754Z",
"updated_at": "2019-11-20T18:38:40.054Z",
"title": "Provident neque consequatur numquam ad laboriosam voluptatem magnam.",
"description": "Fugit nisi est ut numquam quia rerum vitae qui. Et in est aliquid voluptas et ut vitae. In distinctio voluptates ut deleniti iste.\n\nReiciendis eum sunt vero blanditiis at quia. Voluptate eum facilis illum ea distinctio maiores. Doloribus aut nemo ea distinctio.\n\nNihil cum distinctio voluptates quam. Laboriosam distinctio ea accusantium soluta perspiciatis nesciunt impedit. Id qui natus quis minima voluptatum velit ut reprehenderit. Molestiae quia est harum sapiente rem error architecto id. Et minus ipsa et ut ut.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null
},
"notes": [
{
"id": 44169,
"note": "added epic \u00261 as parent epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:35.737Z",
"updated_at": "2019-11-20T18:38:35.741Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13625,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "5bc3e30d508affafc61de2b4e1d9f21039505cc3",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
}
]
},
{
"id": 13626,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 5,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.812Z",
"updated_at": "2019-11-20T18:38:40.101Z",
"title": "Ab deleniti ipsum voluptatem dolor qui quos saepe repellat quo.",
"description": "Sunt minus sunt reiciendis culpa sed excepturi. Aperiam sed quod nemo nesciunt et quia molestias incidunt. Ipsum nam magnam labore eos a molestiae rerum possimus. Sequi autem asperiores voluptas assumenda.\n\nRerum ipsa quia cum ab corrupti omnis. Velit libero et nihil ipsa aut quo rem ipsam. Architecto omnis distinctio sed doloribus perspiciatis consequatur aut et. Fugit consequuntur est minima reiciendis reprehenderit et.\n\nConsequatur distinctio et ut blanditiis perferendis officiis inventore. Alias aut voluptatem in facere. Ut perferendis dolorum hic dolores. Ipsa dolorem soluta at mollitia. Placeat et ea numquam dicta molestias.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": 13622,
"relative_position": 1073739823,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"parent": {
"id": 13622,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-11-20T17:02:09.754Z",
"updated_at": "2019-11-20T18:38:40.054Z",
"title": "Provident neque consequatur numquam ad laboriosam voluptatem magnam.",
"description": "Fugit nisi est ut numquam quia rerum vitae qui. Et in est aliquid voluptas et ut vitae. In distinctio voluptates ut deleniti iste.\n\nReiciendis eum sunt vero blanditiis at quia. Voluptate eum facilis illum ea distinctio maiores. Doloribus aut nemo ea distinctio.\n\nNihil cum distinctio voluptates quam. Laboriosam distinctio ea accusantium soluta perspiciatis nesciunt impedit. Id qui natus quis minima voluptatum velit ut reprehenderit. Molestiae quia est harum sapiente rem error architecto id. Et minus ipsa et ut ut.",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null
},
"notes": [
{
"id": 44171,
"note": "added epic \u00261 as parent epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2019-11-20T18:38:40.074Z",
"updated_at": "2019-11-20T18:38:40.077Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 13626,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "a6231acdaef5f4d2e569dfb604f1baf85c49e1a0",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"type": null,
"author": {
"name": "Administrator"
}
}
]
}
],
"children": []
}

View file

@ -79,4 +79,25 @@ describe('Test reports summary', () => {
expect(duration().text()).toBe('00:00:00');
});
});
describe('success percentage calculation', () => {
it.each`
name | successCount | totalCount | result
${'displays 0 when there are no tests'} | ${0} | ${0} | ${'0'}
${'displays whole number when possible'} | ${10} | ${50} | ${'20'}
${'rounds to 0.01'} | ${1} | ${16604} | ${'0.01'}
${'correctly rounds to 50'} | ${8302} | ${16604} | ${'50'}
${'rounds down for large close numbers'} | ${16603} | ${16604} | ${'99.99'}
${'correctly displays 100'} | ${16604} | ${16604} | ${'100'}
`('$name', ({ successCount, totalCount, result }) => {
createComponent({
report: {
success_count: successCount,
total_count: totalCount,
},
});
expect(successRate().text()).toBe(`${result}% success rate`);
});
});
});

View file

@ -77,16 +77,17 @@ describe('diffs/components/app', () => {
spyOn(wrapper.vm, 'startRenderDiffsQueue');
});
it('calls fetchDiffFiles if diffsBatchLoad is not enabled', () => {
it('calls fetchDiffFiles if diffsBatchLoad is not enabled', done => {
wrapper.vm.glFeatures.diffsBatchLoad = false;
wrapper.vm.fetchData(false);
expect(wrapper.vm.fetchDiffFiles).toHaveBeenCalled();
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.setDiscussions).toHaveBeenCalled();
setTimeout(() => {
expect(wrapper.vm.startRenderDiffsQueue).toHaveBeenCalled();
expect(wrapper.vm.fetchDiffFilesMeta).not.toHaveBeenCalled();
expect(wrapper.vm.fetchDiffFilesBatch).not.toHaveBeenCalled();
done();
});
});
@ -97,7 +98,6 @@ describe('diffs/components/app', () => {
expect(wrapper.vm.fetchDiffFiles).toHaveBeenCalled();
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.setDiscussions).toHaveBeenCalled();
expect(wrapper.vm.startRenderDiffsQueue).toHaveBeenCalled();
expect(wrapper.vm.fetchDiffFilesMeta).not.toHaveBeenCalled();
expect(wrapper.vm.fetchDiffFilesBatch).not.toHaveBeenCalled();
@ -110,7 +110,6 @@ describe('diffs/components/app', () => {
expect(wrapper.vm.fetchDiffFiles).not.toHaveBeenCalled();
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.setDiscussions).toHaveBeenCalled();
expect(wrapper.vm.startRenderDiffsQueue).toHaveBeenCalled();
expect(wrapper.vm.fetchDiffFilesMeta).toHaveBeenCalled();
expect(wrapper.vm.fetchDiffFilesBatch).toHaveBeenCalled();

View file

@ -186,7 +186,7 @@ describe('DiffsStoreActions', () => {
{ type: types.SET_LOADING, payload: true },
{ type: types.SET_LOADING, payload: false },
{ type: types.SET_MERGE_REQUEST_DIFFS, payload: [] },
{ type: types.SET_DIFF_DATA, payload: { data, diff_files: [] } },
{ type: types.SET_DIFF_DATA, payload: { data } },
],
[],
() => {

View file

@ -2,7 +2,7 @@
require 'spec_helper'
describe Gitlab::Auth do
describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
let(:gl_auth) { described_class }
set(:project) { create(:project) }

View file

@ -7,6 +7,33 @@ describe Issue::Metrics do
subject { create(:issue, project: project) }
describe '.for_issues' do
subject(:scope) { described_class.for_issues([issue1, issue2]) }
let(:issue1) { create(:issue) }
let(:issue2) { create(:issue) }
it 'returns metrics associated with given issues' do
create(:issue)
expect(scope).to match_array([issue1.metrics, issue2.metrics])
end
end
describe '.with_first_mention_not_earlier_than' do
subject(:scope) { described_class.with_first_mention_not_earlier_than(timestamp) }
let(:timestamp) { DateTime.now }
it 'returns metrics without mentioning in commit or with mentioning after given timestamp' do
issue1 = create(:issue)
issue2 = create(:issue).tap { |i| i.metrics.update!(first_mentioned_in_commit_at: timestamp + 1.day) }
create(:issue).tap { |i| i.metrics.update!(first_mentioned_in_commit_at: timestamp - 1.day) }
expect(scope).to match_array([issue1.metrics, issue2.metrics])
end
end
describe "when recording the default set of issue metrics on issue save" do
context "milestones" do
it "records the first time an issue is associated with a milestone" do

View file

@ -129,21 +129,54 @@ describe ProcessCommitWorker do
end
describe '#update_issue_metrics' do
it 'updates any existing issue metrics' do
allow(commit).to receive(:safe_message).and_return("Closes #{issue.to_reference}")
context 'when commit has issue reference' do
subject(:update_metrics_and_reload) do
-> {
worker.update_issue_metrics(commit, user)
issue.metrics.reload
}
end
worker.update_issue_metrics(commit, user)
before do
allow(commit).to receive(:safe_message).and_return("Closes #{issue.to_reference}")
end
metric = Issue::Metrics.first
context 'when issue has no first_mentioned_in_commit_at set' do
it 'updates issue metrics' do
expect(update_metrics_and_reload)
.to change { issue.metrics.first_mentioned_in_commit_at }.to(commit.committed_date)
end
end
expect(metric.first_mentioned_in_commit_at).to eq(commit.committed_date)
context 'when issue has first_mentioned_in_commit_at earlier than given committed_date' do
before do
issue.metrics.update(first_mentioned_in_commit_at: commit.committed_date - 1.day)
end
it "doesn't update issue metrics" do
expect(update_metrics_and_reload).not_to change { issue.metrics.first_mentioned_in_commit_at }
end
end
context 'when issue has first_mentioned_in_commit_at later than given committed_date' do
before do
issue.metrics.update(first_mentioned_in_commit_at: commit.committed_date + 1.day)
end
it "doesn't update issue metrics" do
expect(update_metrics_and_reload)
.to change { issue.metrics.first_mentioned_in_commit_at }.to(commit.committed_date)
end
end
end
it "doesn't execute any queries with false conditions" do
allow(commit).to receive(:safe_message).and_return("Lorem Ipsum")
context 'when commit has no issue references' do
it "doesn't execute any queries with false conditions" do
allow(commit).to receive(:safe_message).and_return("Lorem Ipsum")
expect { worker.update_issue_metrics(commit, user) }
.not_to make_queries_matching(/WHERE (?:1=0|0=1)/)
expect { worker.update_issue_metrics(commit, user) }
.not_to make_queries_matching(/WHERE (?:1=0|0=1)/)
end
end
end

0
vendor/gitignore/C++.gitignore vendored Executable file → Normal file
View file

0
vendor/gitignore/Java.gitignore vendored Executable file → Normal file
View file