Skip to content

Commit 339b346

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 8abe394 commit 339b346

File tree

55 files changed

+1164
-828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1164
-828
lines changed

.gitlab/ci/rules.gitlab-ci.yml

+23
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,12 @@
503503
.frontend-predictive-patterns: &frontend-predictive-patterns
504504
- "{,ee/,jh/}{app/assets/javascripts,spec/frontend}/**/*"
505505

506+
.frontend-code-patterns: &frontend-code-patterns
507+
- "**/{package.json,yarn.lock}"
508+
- "**/*.{js,cjs,mjs,vue,graphql}"
509+
# match the .rc config files like .browserslistrc, .stylelintrc etc.,
510+
- "{.,}*rc"
511+
506512
# Code patterns + .ci-patterns
507513
.code-patterns: &code-patterns
508514
- ".{gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
@@ -1387,6 +1393,23 @@
13871393
- <<: *if-default-refs
13881394
changes: *workhorse-patterns
13891395

1396+
.frontend:rules:eslint-changed-files:
1397+
rules:
1398+
- <<: *if-merge-request-labels-pipeline-expedite
1399+
when: never
1400+
- <<: *if-default-branch-refs
1401+
when: never
1402+
- !reference [".prevent-tier-2-and-above", "rules"]
1403+
- <<: *if-merge-request-no-tier
1404+
changes: *frontend-code-patterns
1405+
- <<: *if-merge-request-tier-1
1406+
changes: *frontend-code-patterns
1407+
1408+
.frontend:rules:eslint-default:
1409+
rules:
1410+
- !reference [".prevent-tier-1", "rules"]
1411+
- !reference [.frontend:rules:default-frontend-jobs, rules]
1412+
13901413
.frontend:rules:default-frontend-jobs:
13911414
rules:
13921415
- <<: *if-merge-request-labels-pipeline-expedite

.gitlab/ci/static-analysis.gitlab-ci.yml

+21-5
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,22 @@ generate-apollo-graphql-schema:
6969
paths:
7070
- "${GRAPHQL_SCHEMA_APOLLO_FILE}"
7171

72-
eslint:
72+
.eslint-base:
7373
extends:
7474
- .static-analysis-base
7575
- .yarn-cache
76-
- .frontend:rules:default-frontend-jobs
7776
needs: ['generate-apollo-graphql-schema']
7877
variables:
7978
USE_BUNDLE_INSTALL: "false"
8079
ESLINT_CODE_QUALITY_REPORT: "gl-code-quality-report.json"
80+
artifacts:
81+
reports:
82+
codequality: gl-code-quality-report.json
83+
84+
eslint-changed-files:
85+
extends:
86+
- .eslint-base
87+
- .frontend:rules:eslint-changed-files
8188
script:
8289
- |
8390
function eslint_script() {
@@ -87,9 +94,18 @@ eslint:
8794
8895
run_with_custom_exit_code eslint_script
8996
90-
artifacts:
91-
reports:
92-
codequality: gl-code-quality-report.json
97+
eslint:
98+
extends:
99+
- .eslint-base
100+
- .frontend:rules:eslint-default
101+
script:
102+
- |
103+
function eslint_script() {
104+
yarn_install_script
105+
yarn run lint:eslint:all --format gitlab
106+
}
107+
108+
run_with_custom_exit_code eslint_script
93109
94110
eslint-docs:
95111
extends:

GITALY_SERVER_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5603e4787366e8a2b02491ab921364627efc3ed3
1+
e1930fa23a9c7548bdd5af3dc938ab0bb4075db7

app/assets/javascripts/groups_projects/components/tabs_with_list.vue

+6-30
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export default {
270270
return;
271271
}
272272
273-
this.trackEvent(this.eventTracking.tabs, { label: tab.text });
273+
this.trackEvent(this.eventTracking.tabs, { label: tab.value });
274274
},
275275
tabCount(tab) {
276276
return this.tabCounts[tab.value];
@@ -296,7 +296,7 @@ export default {
296296
return;
297297
}
298298
299-
this.trackEvent(this.eventTracking.sort, { label: this.activeTab.text, property: sort });
299+
this.trackEvent(this.eventTracking.sort, { label: this.activeTab.value, property: sort });
300300
},
301301
onFilter(filters) {
302302
const { sort } = this.$route.query;
@@ -317,38 +317,14 @@ export default {
317317
// Don't record the value when using text search.
318318
// Only record with pre-set values (e.g language or access level).
319319
if (filter === this.filteredSearchTermKey) {
320-
this.trackEvent(event, { label: this.activeTab.text });
320+
this.trackEvent(event, { label: this.activeTab.value });
321321
322322
return;
323323
}
324324
325-
const filteredSearchToken = this.filteredSearchTokens.find(
326-
(token) => token.type === filter,
327-
);
328-
329-
if (!filteredSearchToken) {
330-
return;
331-
}
332-
333-
const optionTitles = filterValues.flatMap((filterValue) => {
334-
const optionTitle = filteredSearchToken.options.find(
335-
({ value }) => filterValue === value,
336-
)?.title;
337-
338-
if (!optionTitle) {
339-
return [];
340-
}
341-
342-
return [optionTitle];
343-
});
344-
345-
if (!optionTitles.length) {
346-
return;
347-
}
348-
349325
this.trackEvent(event, {
350-
label: this.activeTab.text,
351-
property: optionTitles.join(','),
326+
label: this.activeTab.value,
327+
property: filterValues.join(','),
352328
});
353329
});
354330
},
@@ -362,7 +338,7 @@ export default {
362338
}
363339
364340
this.trackEvent(this.eventTracking.pagination, {
365-
label: this.activeTab.text,
341+
label: this.activeTab.value,
366342
property: pagination.startCursor === null ? 'next' : 'previous',
367343
});
368344
},

app/assets/javascripts/merge_requests/components/reviewers/reviewer_dropdown.vue

+28
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { GlCollapsibleListbox, GlButton, GlAvatar, GlIcon } from '@gitlab/ui';
44
import { __ } from '~/locale';
55
import { InternalEvents } from '~/tracking';
66
import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
7+
import { uuids } from '~/lib/utils/uuids';
78
import { TYPENAME_MERGE_REQUEST } from '~/graphql_shared/constants';
89
import { convertToGraphQLId } from '~/graphql_shared/utils';
910
import userAutocompleteWithMRPermissionsQuery from '~/graphql_shared/queries/project_autocomplete_users_with_mr_permissions.query.graphql';
@@ -14,6 +15,11 @@ import {
1415
SEARCH_SELECT_REVIEWER_EVENT,
1516
SELECT_REVIEWER_EVENT,
1617
} from '../../constants';
18+
import {
19+
getReviewersForList,
20+
suggestedPosition,
21+
setReviewersForList,
22+
} from '../../utils/reviewer_positions';
1723
1824
import UpdateReviewers from './update_reviewers.vue';
1925
import userPermissionsQuery from './queries/user_permissions.query.graphql';
@@ -66,6 +72,11 @@ export default {
6672
required: false,
6773
default: () => 'complex',
6874
},
75+
uniqueId: {
76+
type: String,
77+
required: false,
78+
default: () => uuids()[0],
79+
},
6980
},
7081
data() {
7182
return {
@@ -159,6 +170,17 @@ export default {
159170
},
160171
});
161172
173+
if (!search) {
174+
const theseUsers = toUsernames(users);
175+
const newOptions = difference(theseUsers, this.currentSelectedReviewers);
176+
177+
setReviewersForList({
178+
issuableId: this.issuableId,
179+
listId: this.uniqueId,
180+
reviewers: newOptions,
181+
});
182+
}
183+
162184
this.fetchedUsers = users;
163185
this.searching = false;
164186
},
@@ -169,6 +191,10 @@ export default {
169191
const telemetryEvent = this.search ? SEARCH_SELECT_REVIEWER_EVENT : SELECT_REVIEWER_EVENT;
170192
const previousUsernames = toUsernames(this.selectedReviewers);
171193
const listUsernames = toUsernames(this.usersForList);
194+
const suggested = getReviewersForList({
195+
issuableId: this.issuableId,
196+
listId: this.uniqueId,
197+
});
172198
// Reviewers are always shown first if they are in the list,
173199
// so we should exclude them for when we check the position
174200
const selectableList = difference(listUsernames, previousUsernames);
@@ -177,9 +203,11 @@ export default {
177203
additions.forEach((added) => {
178204
// Convert from 0- to 1-index
179205
const listPosition = selectableList.findIndex((user) => user === added) + 1;
206+
const suggestedPos = suggestedPosition({ username: added, list: suggested });
180207
181208
this.trackEvent(telemetryEvent, {
182209
value: listPosition,
210+
suggested_position: suggestedPos,
183211
selectable_reviewers_count: selectableList.length,
184212
});
185213
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function cacheId({ issuableId, listId } = {}) {
2+
return `MergeRequest/${issuableId}/${listId}`;
3+
}
4+
5+
export function setReviewersForList({ issuableId, listId, reviewers = [] } = {}) {
6+
const id = cacheId({ issuableId, listId });
7+
8+
window.sessionStorage.setItem(id, JSON.stringify(reviewers, null, 0));
9+
}
10+
11+
export function getReviewersForList({ issuableId, listId } = {}) {
12+
const id = cacheId({ issuableId, listId });
13+
const list = window.sessionStorage.getItem(id);
14+
15+
return list ? JSON.parse(list) : [];
16+
}
17+
18+
export function suggestedPosition({ username, list = [] } = {}) {
19+
return list.indexOf(username) + 1; // 1-index, so that "0" means they weren't in the list
20+
}

app/assets/javascripts/repository/components/header_area/blob_controls.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,13 @@ export default {
282282
<template>
283283
<div
284284
v-if="showBlobControls"
285-
class="gl-flex gl-flex-wrap gl-items-center gl-gap-3"
285+
class="gl-flex gl-flex-wrap gl-items-center gl-gap-3 gl-self-end"
286286
data-testid="blob-controls"
287287
>
288288
<open-mr-badge
289289
v-if="glFeatures.filterBlobPath"
290290
:project-path="projectPath"
291291
:blob-path="filePath"
292-
class="!gl-ml-auto"
293292
/>
294293
<gl-button
295294
v-gl-tooltip.html="findFileTooltip"

app/assets/javascripts/sidebar/components/time_tracking/create_timelog_form.vue

+10-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@gitlab/ui';
1111
import { convertToGraphQLId } from '~/graphql_shared/utils';
1212
import { issuableTypeText, TYPE_ISSUE } from '~/issues/constants';
13-
import { toISODateFormat } from '~/lib/utils/datetime_utility';
13+
import { toISOStringWithoutMilliseconds } from '~/lib/utils/datetime_utility';
1414
import { TYPENAME_ISSUE, TYPENAME_MERGE_REQUEST } from '~/graphql_shared/constants';
1515
import { joinPaths } from '~/lib/utils/url_utility';
1616
import { s__, sprintf } from '~/locale';
@@ -115,6 +115,13 @@ export default {
115115
this.isLoading = true;
116116
this.saveError = '';
117117
118+
let isoSpentAt = null;
119+
if (this.spentAt) {
120+
const spentAtMidday = this.spentAt;
121+
spentAtMidday.setHours(spentAtMidday.getHours() + 12);
122+
isoSpentAt = toISOStringWithoutMilliseconds(spentAtMidday);
123+
}
124+
118125
if (this.workItemId) {
119126
return this.$apollo
120127
.mutate({
@@ -124,7 +131,7 @@ export default {
124131
id: this.workItemId,
125132
timeTrackingWidget: {
126133
timelog: {
127-
spentAt: this.spentAt ? toISODateFormat(this.spentAt) : null,
134+
spentAt: isoSpentAt,
128135
summary: this.summary,
129136
timeSpent: this.timeSpent,
130137
},
@@ -155,7 +162,7 @@ export default {
155162
variables: {
156163
input: {
157164
timeSpent: this.timeSpent,
158-
spentAt: this.spentAt ? toISODateFormat(this.spentAt) : null,
165+
spentAt: isoSpentAt,
159166
summary: this.summary,
160167
issuableId: this.getIssuableId(),
161168
},

app/finders/database/batched_background_migrations_finder.rb

+33-5
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,52 @@ module Database
44
class BatchedBackgroundMigrationsFinder
55
RETURNED_MIGRATIONS = 20
66

7-
def initialize(connection:)
8-
@connection = connection
7+
def initialize(params:)
8+
@params = params
99
end
1010

1111
def execute
12-
batched_migration_class.ordered_by_created_at_desc.for_gitlab_schema(schema).limit(RETURNED_MIGRATIONS)
12+
raise ArgumentError, 'database parameter is required' if params[:database].blank?
13+
14+
return batched_migration_class.none unless Gitlab::Database.has_config?(database_name)
15+
16+
@migrations = migrations
17+
18+
filter_by_job_class_name
19+
20+
@migrations.limit(RETURNED_MIGRATIONS)
1321
end
1422

1523
private
1624

17-
attr_accessor :connection
25+
attr_reader :params
26+
27+
def migrations
28+
batched_migration_class
29+
.ordered_by_created_at_desc
30+
.for_gitlab_schema(schema)
31+
end
32+
33+
def filter_by_job_class_name
34+
return unless params[:job_class_name].present?
35+
36+
@migrations = @migrations.for_job_class(params[:job_class_name])
37+
end
1838

1939
def batched_migration_class
2040
Gitlab::Database::BackgroundMigration::BatchedMigration
2141
end
2242

2343
def schema
24-
Gitlab::Database.gitlab_schemas_for_connection(connection)
44+
Gitlab::Database.gitlab_schemas_for_connection(base_model.connection)
45+
end
46+
47+
def base_model
48+
Gitlab::Database.database_base_models[database_name]
49+
end
50+
51+
def database_name
52+
params[:database]
2553
end
2654
end
2755
end

config/events/click_pagination_on_your_work_projects.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ identifiers:
66
- user
77
additional_properties:
88
label:
9-
description: Tab name (e.g. "Contributed")
9+
description: Tab name (e.g. "contributed")
1010
property:
1111
description: Direction
1212
product_group: organizations

config/events/click_sort_on_your_work_projects.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ identifiers:
66
- user
77
additional_properties:
88
label:
9-
description: Tab name (e.g. "Contributed")
9+
description: Tab name (e.g. "contributed")
1010
property:
1111
description: Sort value
1212
product_group: organizations

config/events/click_tab_on_your_work_projects.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ identifiers:
66
- user
77
additional_properties:
88
label:
9-
description: Tab name (e.g. "Contributed")
9+
description: Tab name (e.g. "contributed")
1010
product_group: organizations
1111
product_categories:
1212
- groups_and_projects

0 commit comments

Comments
 (0)