Skip to content
GitLab
Next
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
GitLab.org
GitLab FOSS
Commits
74d35955
Commit
74d35955
authored
Nov 06, 2020
by
🤖 GitLab Bot 🤖
Browse files
Add latest changes from gitlab-org/gitlab@master
parent
c9337409
Changes
54
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
54 changed files
with
1114 additions
and
358 deletions
+1114
-358
app/assets/javascripts/filtered_search/dropdown_ajax_filter.js
...ssets/javascripts/filtered_search/dropdown_ajax_filter.js
+6
-4
app/assets/javascripts/filtered_search/dropdown_user.js
app/assets/javascripts/filtered_search/dropdown_user.js
+1
-1
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
...ripts/filtered_search/filtered_search_dropdown_manager.js
+2
-0
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+12
-2
app/assets/javascripts/graphql_shared/utils.js
app/assets/javascripts/graphql_shared/utils.js
+5
-1
app/assets/javascripts/sidebar/components/labels/sidebar_labels.vue
.../javascripts/sidebar/components/labels/sidebar_labels.vue
+78
-22
app/assets/javascripts/sidebar/mount_sidebar.js
app/assets/javascripts/sidebar/mount_sidebar.js
+5
-0
app/assets/javascripts/sidebar/queries/update_merge_request_labels.mutation.graphql
...ebar/queries/update_merge_request_labels.mutation.graphql
+15
-0
app/assets/javascripts/sidebar/utils.js
app/assets/javascripts/sidebar/utils.js
+1
-0
app/controllers/registrations/welcome_controller.rb
app/controllers/registrations/welcome_controller.rb
+74
-0
app/controllers/registrations_controller.rb
app/controllers/registrations_controller.rb
+1
-63
app/graphql/mutations/boards/create.rb
app/graphql/mutations/boards/create.rb
+2
-31
app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb
.../mutations/concerns/mutations/resolves_resource_parent.rb
+43
-0
app/graphql/mutations/labels/create.rb
app/graphql/mutations/labels/create.rb
+43
-0
app/graphql/types/mutation_type.rb
app/graphql/types/mutation_type.rb
+1
-0
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+15
-0
app/views/registrations/welcome/show.html.haml
app/views/registrations/welcome/show.html.haml
+1
-1
app/views/shared/issuable/_search_bar.html.haml
app/views/shared/issuable/_search_bar.html.haml
+1
-0
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-11
changelogs/unreleased/263521-add-projects_with_enabled_alert_integrations-usage-ping.yml
...d-projects_with_enabled_alert_integrations-usage-ping.yml
+5
-0
changelogs/unreleased/271459-fix-remove-label-inconsistency.yml
...logs/unreleased/271459-fix-remove-label-inconsistency.yml
+5
-0
changelogs/unreleased/graphql_create_label.yml
changelogs/unreleased/graphql_create_label.yml
+5
-0
config/routes.rb
config/routes.rb
+1
-2
doc/.vale/gitlab/VersionText.yml
doc/.vale/gitlab/VersionText.yml
+1
-1
doc/administration/logs.md
doc/administration/logs.md
+37
-34
doc/administration/monitoring/github_imports.md
doc/administration/monitoring/github_imports.md
+6
-7
doc/administration/monitoring/performance/gitlab_configuration.md
...nistration/monitoring/performance/gitlab_configuration.md
+7
-11
doc/administration/monitoring/performance/index.md
doc/administration/monitoring/performance/index.md
+3
-3
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+60
-2
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+171
-2
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+10
-0
doc/api/issues.md
doc/api/issues.md
+3
-0
doc/development/documentation/styleguide.md
doc/development/documentation/styleguide.md
+53
-44
doc/topics/autodevops/stages.md
doc/topics/autodevops/stages.md
+1
-4
doc/user/application_security/index.md
doc/user/application_security/index.md
+1
-1
doc/user/application_security/offline_deployments/index.md
doc/user/application_security/offline_deployments/index.md
+25
-0
doc/user/application_security/sast/index.md
doc/user/application_security/sast/index.md
+8
-8
doc/user/application_security/secret_detection/index.md
doc/user/application_security/secret_detection/index.md
+3
-2
lib/api/helpers/issues_helpers.rb
lib/api/helpers/issues_helpers.rb
+3
-0
lib/api/issues.rb
lib/api/issues.rb
+2
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+1
-0
lib/rouge/formatters/html_gitlab.rb
lib/rouge/formatters/html_gitlab.rb
+1
-1
qa/qa/page/main/sign_up.rb
qa/qa/page/main/sign_up.rb
+1
-1
spec/controllers/registrations/welcome_controller_spec.rb
spec/controllers/registrations/welcome_controller_spec.rb
+79
-0
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+0
-39
spec/factories/usage_data.rb
spec/factories/usage_data.rb
+5
-0
spec/features/issues/user_edits_issue_spec.rb
spec/features/issues/user_edits_issue_spec.rb
+27
-0
spec/frontend/sidebar/sidebar_labels_spec.js
spec/frontend/sidebar/sidebar_labels_spec.js
+113
-58
spec/graphql/mutations/labels/create_spec.rb
spec/graphql/mutations/labels/create_spec.rb
+80
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+1
-0
spec/requests/api/graphql/mutations/labels/create_spec.rb
spec/requests/api/graphql/mutations/labels/create_spec.rb
+86
-0
spec/support/helpers/usage_data_helpers.rb
spec/support/helpers/usage_data_helpers.rb
+1
-0
spec/support/shared_examples/graphql/mutations/boards_create_shared_examples.rb
...amples/graphql/mutations/boards_create_shared_examples.rb
+1
-1
spec/views/registrations/welcome/show.html.haml_spec.rb
spec/views/registrations/welcome/show.html.haml_spec.rb
+1
-1
No files found.
app/assets/javascripts/filtered_search/dropdown_ajax_filter.js
View file @
74d35955
...
...
@@ -22,7 +22,7 @@ export default class DropdownAjaxFilter extends FilteredSearchDropdown {
ajaxFilterConfig
()
{
return
{
endpoint
:
`
${
gon
.
relative_url_root
||
''
}${
this
.
endpoint
}
`
,
endpoint
:
this
.
endpoint
,
searchKey
:
'
search
'
,
searchValueFunction
:
this
.
getSearchInput
.
bind
(
this
),
loadingTemplate
:
this
.
loadingTemplate
,
...
...
@@ -33,9 +33,11 @@ export default class DropdownAjaxFilter extends FilteredSearchDropdown {
}
itemClicked
(
e
)
{
super
.
itemClicked
(
e
,
selected
=>
selected
.
querySelector
(
'
.dropdown-light-content
'
).
innerText
.
trim
(),
);
super
.
itemClicked
(
e
,
selected
=>
{
const
title
=
selected
.
querySelector
(
'
.dropdown-light-content
'
).
innerText
.
trim
();
return
DropdownUtils
.
getEscapedText
(
title
);
});
}
renderContent
(
forceShowList
=
false
)
{
...
...
app/assets/javascripts/filtered_search/dropdown_user.js
View file @
74d35955
...
...
@@ -5,7 +5,7 @@ export default class DropdownUser extends DropdownAjaxFilter {
constructor
(
options
=
{})
{
super
({
...
options
,
endpoint
:
'
/-/autocomplete/users.json
'
,
endpoint
:
`
${
gon
.
relative_url_root
||
''
}
/-/autocomplete/users.json
`
,
symbol
:
'
@
'
,
});
}
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
View file @
74d35955
...
...
@@ -12,6 +12,7 @@ export default class FilteredSearchDropdownManager {
runnerTagsEndpoint
=
''
,
labelsEndpoint
=
''
,
milestonesEndpoint
=
''
,
iterationsEndpoint
=
''
,
releasesEndpoint
=
''
,
environmentsEndpoint
=
''
,
epicsEndpoint
=
''
,
...
...
@@ -28,6 +29,7 @@ export default class FilteredSearchDropdownManager {
this
.
runnerTagsEndpoint
=
removeTrailingSlash
(
runnerTagsEndpoint
);
this
.
labelsEndpoint
=
removeTrailingSlash
(
labelsEndpoint
);
this
.
milestonesEndpoint
=
removeTrailingSlash
(
milestonesEndpoint
);
this
.
iterationsEndpoint
=
removeTrailingSlash
(
iterationsEndpoint
);
this
.
releasesEndpoint
=
removeTrailingSlash
(
releasesEndpoint
);
this
.
epicsEndpoint
=
removeTrailingSlash
(
epicsEndpoint
);
this
.
environmentsEndpoint
=
removeTrailingSlash
(
environmentsEndpoint
);
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
74d35955
...
...
@@ -52,16 +52,24 @@ export default class FilteredSearchManager {
this
.
placeholder
=
placeholder
;
this
.
anchor
=
anchor
;
const
{
multipleAssignees
}
=
this
.
filteredSearchInput
.
dataset
;
const
{
multipleAssignees
,
epicsEndpoint
,
iterationsEndpoint
,
}
=
this
.
filteredSearchInput
.
dataset
;
if
(
multipleAssignees
&&
this
.
filteredSearchTokenKeys
.
enableMultipleAssignees
)
{
this
.
filteredSearchTokenKeys
.
enableMultipleAssignees
();
}
const
{
epicsEndpoint
}
=
this
.
filteredSearchInput
.
dataset
;
if
(
!
epicsEndpoint
&&
this
.
filteredSearchTokenKeys
.
removeEpicToken
)
{
this
.
filteredSearchTokenKeys
.
removeEpicToken
();
}
if
(
!
iterationsEndpoint
&&
this
.
filteredSearchTokenKeys
.
removeIterationToken
)
{
this
.
filteredSearchTokenKeys
.
removeIterationToken
();
}
this
.
recentSearchesStore
=
new
RecentSearchesStore
({
isLocalStorageAvailable
:
RecentSearchesService
.
isAvailable
(),
allowedKeys
:
this
.
filteredSearchTokenKeys
.
getKeys
(),
...
...
@@ -112,6 +120,7 @@ export default class FilteredSearchManager {
releasesEndpoint
=
''
,
environmentsEndpoint
=
''
,
epicsEndpoint
=
''
,
iterationsEndpoint
=
''
,
}
=
this
.
filteredSearchInput
.
dataset
;
this
.
dropdownManager
=
new
FilteredSearchDropdownManager
({
...
...
@@ -121,6 +130,7 @@ export default class FilteredSearchManager {
releasesEndpoint
,
environmentsEndpoint
,
epicsEndpoint
,
iterationsEndpoint
,
tokenizer
:
this
.
tokenizer
,
page
:
this
.
page
,
isGroup
:
this
.
isGroup
,
...
...
app/assets/javascripts/graphql_shared/utils.js
View file @
74d35955
...
...
@@ -9,4 +9,8 @@
export
const
getIdFromGraphQLId
=
(
gid
=
''
)
=>
parseInt
((
gid
||
''
).
replace
(
/gid:
\/\/
gitlab
\/
.*
\/
/g
,
''
),
10
)
||
null
;
export
default
{};
export
const
MutationOperationMode
=
{
Append
:
'
APPEND
'
,
Remove
:
'
REMOVE
'
,
Replace
:
'
REPLACE
'
,
};
app/assets/javascripts/sidebar/components/labels/sidebar_labels.vue
View file @
74d35955
<
script
>
import
$
from
'
jquery
'
;
import
{
difference
,
union
}
from
'
lodash
'
;
import
flash
from
'
~/flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
camelCase
,
difference
,
union
}
from
'
lodash
'
;
import
updateIssueLabelsMutation
from
'
~/boards/queries/issue_set_labels.mutation.graphql
'
;
import
createFlash
from
'
~/flash
'
;
import
{
IssuableType
}
from
'
~/issue_show/constants
'
;
import
{
__
}
from
'
~/locale
'
;
import
updateMergeRequestLabelsMutation
from
'
~/sidebar/queries/update_merge_request_labels.mutation.graphql
'
;
import
{
toLabelGid
}
from
'
~/sidebar/utils
'
;
import
{
DropdownVariant
}
from
'
~/vue_shared/components/sidebar/labels_select_vue/constants
'
;
import
LabelsSelect
from
'
~/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue
'
;
import
{
getIdFromGraphQLId
,
MutationOperationMode
}
from
'
~/graphql_shared/utils
'
;
const
mutationMap
=
{
[
IssuableType
.
Issue
]:
{
mutation
:
updateIssueLabelsMutation
,
mutationName
:
'
updateIssue
'
,
},
[
IssuableType
.
MergeRequest
]:
{
mutation
:
updateMergeRequestLabelsMutation
,
mutationName
:
'
mergeRequestSetLabels
'
,
},
};
export
default
{
components
:
{
...
...
@@ -21,7 +36,6 @@ export default {
'
issuableType
'
,
'
labelsFetchPath
'
,
'
labelsManagePath
'
,
'
labelsUpdatePath
'
,
'
projectIssuesPath
'
,
'
projectPath
'
,
],
...
...
@@ -35,37 +49,79 @@ export default {
handleDropdownClose
()
{
$
(
this
.
$el
).
trigger
(
'
hidden.gl.dropdown
'
);
},
handleUpdateSelectedLabel
s
(
dropdownLabels
)
{
getUpdateVariable
s
(
dropdownLabels
)
{
const
currentLabelIds
=
this
.
selectedLabels
.
map
(
label
=>
label
.
id
);
const
userAddedLabelIds
=
dropdownLabels
.
filter
(
label
=>
label
.
set
).
map
(
label
=>
label
.
id
);
const
userRemovedLabelIds
=
dropdownLabels
.
filter
(
label
=>
!
label
.
set
).
map
(
label
=>
label
.
id
);
const
labelIds
=
difference
(
union
(
currentLabelIds
,
userAddedLabelIds
),
userRemovedLabelIds
);
this
.
updateSelectedLabels
(
labelIds
);
switch
(
this
.
issuableType
)
{
case
IssuableType
.
Issue
:
return
{
addLabelIds
:
userAddedLabelIds
,
iid
:
this
.
iid
,
projectPath
:
this
.
projectPath
,
removeLabelIds
:
userRemovedLabelIds
,
};
case
IssuableType
.
MergeRequest
:
return
{
iid
:
this
.
iid
,
labelIds
:
labelIds
.
map
(
toLabelGid
),
operationMode
:
MutationOperationMode
.
Replace
,
projectPath
:
this
.
projectPath
,
};
default
:
return
{};
}
},
handleUpdateSelectedLabels
(
dropdownLabels
)
{
this
.
updateSelectedLabels
(
this
.
getUpdateVariables
(
dropdownLabels
));
},
getRemoveVariables
(
labelId
)
{
switch
(
this
.
issuableType
)
{
case
IssuableType
.
Issue
:
return
{
iid
:
this
.
iid
,
projectPath
:
this
.
projectPath
,
removeLabelIds
:
[
labelId
],
};
case
IssuableType
.
MergeRequest
:
return
{
iid
:
this
.
iid
,
labelIds
:
[
toLabelGid
(
labelId
)],
operationMode
:
MutationOperationMode
.
Remove
,
projectPath
:
this
.
projectPath
,
};
default
:
return
{};
}
},
handleLabelRemove
(
labelId
)
{
const
currentLabelIds
=
this
.
selectedLabels
.
map
(
label
=>
label
.
id
);
const
labelIds
=
difference
(
currentLabelIds
,
[
labelId
]);
this
.
updateSelectedLabels
(
labelIds
);
this
.
updateSelectedLabels
(
this
.
getRemoveVariables
(
labelId
));
},
updateSelectedLabels
(
labelId
s
)
{
updateSelectedLabels
(
inputVariable
s
)
{
this
.
isLabelsSelectInProgress
=
true
;
axios
({
data
:
{
[
this
.
issuableType
]:
{
label_ids
:
labelIds
,
},
},
method
:
'
put
'
,
url
:
this
.
labelsUpdatePath
,
})
this
.
$apollo
.
mutate
({
mutation
:
mutationMap
[
this
.
issuableType
].
mutation
,
variables
:
{
input
:
inputVariables
},
})
.
then
(({
data
})
=>
{
this
.
selectedLabels
=
data
.
labels
;
const
{
mutationName
}
=
mutationMap
[
this
.
issuableType
];
if
(
data
[
mutationName
]?.
errors
?.
length
)
{
throw
new
Error
();
}
const
issuableType
=
camelCase
(
this
.
issuableType
);
this
.
selectedLabels
=
data
[
mutationName
]?.[
issuableType
]?.
labels
?.
nodes
?.
map
(
label
=>
({
...
label
,
id
:
getIdFromGraphQLId
(
label
.
id
),
}));
})
.
catch
(()
=>
flash
(
__
(
'
An error occurred while updating labels.
'
)))
.
catch
(()
=>
createFlash
({
message
:
__
(
'
An error occurred while updating labels.
'
)
}
))
.
finally
(()
=>
{
this
.
isLabelsSelectInProgress
=
false
;
});
...
...
app/assets/javascripts/sidebar/mount_sidebar.js
View file @
74d35955
...
...
@@ -91,8 +91,13 @@ export function mountSidebarLabels() {
return
false
;
}
const
apolloProvider
=
new
VueApollo
({
defaultClient
:
createDefaultClient
(),
});
return
new
Vue
({
el
,
apolloProvider
,
provide
:
{
...
el
.
dataset
,
allowLabelCreate
:
parseBoolean
(
el
.
dataset
.
allowLabelCreate
),
...
...
app/assets/javascripts/sidebar/queries/update_merge_request_labels.mutation.graphql
0 → 100644
View file @
74d35955
mutation
mergeRequestSetLabels
(
$input
:
MergeRequestSetLabelsInput
!)
{
mergeRequestSetLabels
(
input
:
$input
)
{
errors
mergeRequest
{
labels
{
nodes
{
color
description
id
title
}
}
}
}
}
app/assets/javascripts/sidebar/utils.js
0 → 100644
View file @
74d35955
export
const
toLabelGid
=
id
=>
`gid://gitlab/Label/
${
id
}
`
;
app/controllers/registrations/welcome_controller.rb
0 → 100644
View file @
74d35955
# frozen_string_literal: true
module
Registrations
class
WelcomeController
<
ApplicationController
layout
'welcome'
skip_before_action
:authenticate_user!
,
:required_signup_info
,
:check_two_factor_requirement
,
only:
[
:show
,
:update
]
before_action
:require_current_user
feature_category
:authentication_and_authorization
def
show
return
redirect_to
path_for_signed_in_user
(
current_user
)
if
completed_welcome_step?
end
def
update
result
=
::
Users
::
SignupService
.
new
(
current_user
,
update_params
).
execute
if
result
[
:status
]
==
:success
process_gitlab_com_tracking
return
redirect_to
new_users_sign_up_group_path
if
experiment_enabled?
(
:onboarding_issues
)
&&
show_onboarding_issues_experiment?
redirect_to
path_for_signed_in_user
(
current_user
)
else
render
:show
end
end
private
def
require_current_user
return
redirect_to
new_user_registration_path
unless
current_user
end
def
completed_welcome_step?
current_user
.
role
.
present?
&&
!
current_user
.
setup_for_company
.
nil?
end
def
process_gitlab_com_tracking
return
false
unless
::
Gitlab
.
com?
return
false
unless
show_onboarding_issues_experiment?
track_experiment_event
(
:onboarding_issues
,
'signed_up'
)
record_experiment_user
(
:onboarding_issues
)
end
def
update_params
params
.
require
(
:user
).
permit
(
:role
,
:setup_for_company
)
end
def
requires_confirmation?
(
user
)
return
false
if
user
.
confirmed?
return
false
if
Feature
.
enabled?
(
:soft_email_confirmation
)
return
false
if
experiment_enabled?
(
:signup_flow
)
true
end
def
path_for_signed_in_user
(
user
)
return
users_almost_there_path
if
requires_confirmation?
(
user
)
stored_location_for
(
user
)
||
dashboard_projects_path
end
def
show_onboarding_issues_experiment?
!
helpers
.
in_subscription_flow?
&&
!
helpers
.
in_invitation_flow?
&&
!
helpers
.
in_oauth_flow?
&&
!
helpers
.
in_trial_flow?
end
end
end
Registrations
::
WelcomeController
.
prepend_if_ee
(
'EE::Registrations::WelcomeController'
)
app/controllers/registrations_controller.rb
View file @
74d35955
...
...
@@ -8,9 +8,8 @@ class RegistrationsController < Devise::RegistrationsController
BLOCKED_PENDING_APPROVAL_STATE
=
'blocked_pending_approval'
.
freeze
layout
:choose_layout
layout
'devise'
skip_before_action
:required_signup_info
,
:check_two_factor_requirement
,
only:
[
:welcome
,
:update_registration
]
prepend_before_action
:check_captcha
,
only: :create
before_action
:whitelist_query_limiting
,
:ensure_destroy_prerequisites_met
,
only:
[
:destroy
]
before_action
:load_recaptcha
,
only: :new
...
...
@@ -49,30 +48,6 @@ def destroy
end
end
def
welcome
return
redirect_to
new_user_registration_path
unless
current_user
return
redirect_to
path_for_signed_in_user
(
current_user
)
if
current_user
.
role
.
present?
&&
!
current_user
.
setup_for_company
.
nil?
end
def
update_registration
return
redirect_to
new_user_registration_path
unless
current_user
result
=
::
Users
::
SignupService
.
new
(
current_user
,
update_registration_params
).
execute
if
result
[
:status
]
==
:success
if
::
Gitlab
.
com?
&&
show_onboarding_issues_experiment?
track_experiment_event
(
:onboarding_issues
,
'signed_up'
)
record_experiment_user
(
:onboarding_issues
)
end
return
redirect_to
new_users_sign_up_group_path
if
experiment_enabled?
(
:onboarding_issues
)
&&
show_onboarding_issues_experiment?
redirect_to
path_for_signed_in_user
(
current_user
)
else
render
:welcome
end
end
protected
def
persist_accepted_terms_if_required
(
new_user
)
...
...
@@ -160,10 +135,6 @@ def sign_up_params
params
.
require
(
:user
).
permit
(
:username
,
:email
,
:name
,
:first_name
,
:last_name
,
:password
)
end
def
update_registration_params
params
.
require
(
:user
).
permit
(
:role
,
:setup_for_company
)
end
def
resource_name
:user
end
...
...
@@ -180,43 +151,10 @@ def whitelist_query_limiting
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-foss/issues/42380'
)
end
def
path_for_signed_in_user
(
user
)
if
requires_confirmation?
(
user
)
users_almost_there_path
else
stored_location_for
(
user
)
||
dashboard_projects_path
end
end
def
requires_confirmation?
(
user
)
return
false
if
user
.
confirmed?
return
false
if
Feature
.
enabled?
(
:soft_email_confirmation
)
return
false
if
experiment_enabled?
(
:signup_flow
)
true
end
def
load_recaptcha
Gitlab
::
Recaptcha
.
load_configurations!
end
# Part of an experiment to build a new sign up flow. Will be resolved
# with https://gitlab.com/gitlab-org/growth/engineering/issues/64
def
choose_layout
if
%w(welcome update_registration)
.
include?
(
action_name
)
'welcome'
else
'devise'
end
end
def
show_onboarding_issues_experiment?
!
helpers
.
in_subscription_flow?
&&
!
helpers
.
in_invitation_flow?
&&
!
helpers
.
in_oauth_flow?
&&
!
helpers
.
in_trial_flow?
end
def
set_user_state
return
unless
Gitlab
::
CurrentSettings
.
require_admin_approval_after_user_signup
...
...
app/graphql/mutations/boards/create.rb
View file @
74d35955
...
...
@@ -3,8 +3,7 @@
module
Mutations
module
Boards
class
Create
<
::
Mutations
::
BaseMutation
include
Mutations
::
ResolvesGroup
include
ResolvesProject
include
Mutations
::
ResolvesResourceParent
graphql_name
'CreateBoard'
...
...
@@ -13,12 +12,6 @@ class Create < ::Mutations::BaseMutation
null:
true
,
description:
'The board after mutation.'
argument
:project_path
,
GraphQL
::
ID_TYPE
,
required:
false
,
description:
'The project full path the board is associated with.'
argument
:group_path
,
GraphQL
::
ID_TYPE
,
required:
false
,
description:
'The group full path the board is associated with.'
argument
:name
,
GraphQL
::
STRING_TYPE
,
required:
false
,
...
...
@@ -43,10 +36,7 @@ class Create < ::Mutations::BaseMutation
authorize
:admin_board
def
resolve
(
args
)
group_path
=
args
.
delete
(
:group_path
)
project_path
=
args
.
delete
(
:project_path
)
board_parent
=
authorized_find!
(
group_path:
group_path
,
project_path:
project_path
)
board_parent
=
authorized_resource_parent_find!
(
args
)
response
=
::
Boards
::
CreateService
.
new
(
board_parent
,
current_user
,
args
).
execute
{
...
...
@@ -54,25 +44,6 @@ def resolve(args)
errors:
response
.
errors
}
end
def
ready?
(
**
args
)
if
args
.
values_at
(
:project_path
,
:group_path
).
compact
.
blank?
raise
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
'group_path or project_path arguments are required'
end
super
end
private
def
find_object
(
group_path:
nil
,
project_path:
nil
)
if
group_path
resolve_group
(
full_path:
group_path
)
else
resolve_project
(
full_path:
project_path
)
end
end
end
end
end
app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb
0 → 100644
View file @
74d35955
# frozen_string_literal: true
module
Mutations
module
ResolvesResourceParent
extend
ActiveSupport
::
Concern
include
Mutations
::
ResolvesGroup
include
ResolvesProject
included
do
argument
:project_path
,
GraphQL
::
ID_TYPE
,
required:
false
,
description:
'The project full path the resource is associated with'
argument
:group_path
,
GraphQL
::
ID_TYPE
,
required:
false
,
description:
'The group full path the resource is associated with'
end
def
ready?
(
**
args
)
unless
args
[
:project_path
].
present?
^
args
[
:group_path
].
present?
raise
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
'Exactly one of group_path or project_path arguments is required'
end
super
end
private
def
authorized_resource_parent_find!
(
args
)
authorized_find!
(
project_path:
args
.
delete
(
:project_path
),
group_path:
args
.
delete
(
:group_path
))
end
def
find_object
(
project_path:
nil
,
group_path:
nil
)
if
group_path
.
present?
resolve_group
(
full_path:
group_path
)
else
resolve_project
(
full_path:
project_path
)
end
end
end
end
app/graphql/mutations/labels/create.rb
0 → 100644
View file @
74d35955
# frozen_string_literal: true
module
Mutations
module
Labels
class
Create
<
BaseMutation
include
Mutations
::
ResolvesResourceParent
graphql_name
'LabelCreate'
field
:label
,
Types
::
LabelType
,
null:
true
,
description:
'The label after mutation'
argument
:title
,
GraphQL
::
STRING_TYPE
,
required:
true
,