Commit e797df72 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 1d64791c5762
<svg width="100" height="32" xmlns="http://www.w3.org/2000/svg"><g fill-rule="nonzero" fill="none"><path fill="#8C929D" d="M67.67 8.11h-2.06l.009 15.364h8.348v-1.9H67.68l-.01-13.465zM81.913 20.778a3.517 3.517 0 01-2.553 1.078c-1.57 0-2.203-.775-2.203-1.787 0-1.522 1.059-2.25 3.309-2.25.487.002.974.04 1.456.113v2.846h-.01zm-2.137-9.313a6.826 6.826 0 00-4.387 1.579l.728 1.267c.841-.492 1.872-.983 3.356-.983 1.693 0 2.44.87 2.44 2.326v.747a9.4 9.4 0 00-1.428-.114c-3.612 0-5.446 1.267-5.446 3.914 0 2.374 1.456 3.565 3.659 3.565 1.484 0 2.912-.68 3.404-1.787l.378 1.503h1.456v-7.866c-.01-2.487-1.087-4.151-4.16-4.151zM90.587 21.926c-.776 0-1.456-.094-1.967-.33v-7.102c.7-.586 1.57-1.011 2.676-1.011 1.995 0 2.76 1.408 2.76 3.687 0 3.234-1.238 4.756-3.47 4.756m.87-10.457a3.775 3.775 0 00-2.836 1.257V10.74l-.01-2.629h-2.013l.01 14.987c1.01.425 2.391.652 3.895.652 3.848 0 5.701-2.458 5.701-6.704-.01-3.356-1.72-5.578-4.746-5.578M45.228 9.776c1.825 0 3.006.605 3.772 1.22l.889-1.541c-1.2-1.06-2.827-1.627-4.567-1.627-4.387 0-7.46 2.676-7.46 8.075 0 5.654 3.319 7.857 7.11 7.857a12.083 12.083 0 004.577-.888L49.5 16.83v-1.9h-5.63v1.9h3.594l.047 4.586c-.473.236-1.286.425-2.392.425-3.045 0-5.087-1.92-5.087-5.957-.01-4.113 2.1-6.108 5.19-6.108M59.744 8.107H57.73l.01 2.582v8.916c0 2.487 1.078 4.15 4.15 4.15.416.002.83-.036 1.24-.113v-1.806c-.31.047-.624.07-.937.066-1.692 0-2.44-.87-2.44-2.326v-6.145h3.376v-1.683h-3.373l-.009-3.64h-.003zM52.608 23.474h2.014V11.75h-2.014zM52.608 10.133h2.014V8.119h-2.014z"/><path d="M31.864 17.907l-1.788-5.496-3.538-10.9a.612.612 0 00-1.16 0L21.84 12.406H10.085L6.547 1.512a.612.612 0 00-1.16 0L1.855 12.405.066 17.907c-.162.5.015 1.05.44 1.36L15.963 30.5l15.456-11.233a1.22 1.22 0 00.446-1.36" fill="#FC6D26"/><path d="M15.966 30.49l5.875-18.086H10.09z" fill="#E24329"/><path d="M15.962 30.49l-5.877-18.086H1.859z" fill="#FC6D26"/><path d="M1.852 12.41L.063 17.906c-.162.5.015 1.05.441 1.36L15.959 30.5 1.852 12.41z" fill="#FCA326"/><path d="M1.854 12.41h8.237L6.546 1.517a.612.612 0 00-1.16 0L1.854 12.41z" fill="#E24329"/><path d="M15.966 30.49l5.875-18.086h8.236z" fill="#FC6D26"/><path d="M30.074 12.41l1.79 5.496a1.219 1.219 0 01-.44 1.36L15.966 30.49l14.107-18.08z" fill="#FCA326"/><path d="M30.079 12.41H21.84L25.38 1.517a.612.612 0 011.16 0l3.539 10.893z" fill="#E24329"/></g></svg>
\ No newline at end of file
...@@ -104,6 +104,7 @@ export default { ...@@ -104,6 +104,7 @@ export default {
visibilityLevel: visibilityOptions.PUBLIC, visibilityLevel: visibilityOptions.PUBLIC,
issuesAccessLevel: 20, issuesAccessLevel: 20,
repositoryAccessLevel: 20, repositoryAccessLevel: 20,
forkingAccessLevel: 20,
mergeRequestsAccessLevel: 20, mergeRequestsAccessLevel: 20,
buildsAccessLevel: 20, buildsAccessLevel: 20,
wikiAccessLevel: 20, wikiAccessLevel: 20,
...@@ -300,6 +301,19 @@ export default { ...@@ -300,6 +301,19 @@ export default {
name="project[project_feature_attributes][merge_requests_access_level]" name="project[project_feature_attributes][merge_requests_access_level]"
/> />
</project-setting-row> </project-setting-row>
<project-setting-row
:label="s__('ProjectSettings|Forks')"
:help-text="
s__('ProjectSettings|Allow users to make copies of your repository to a new project')
"
>
<project-feature-setting
v-model="forkingAccessLevel"
:options="featureAccessLevelOptions"
:disabled-input="!repositoryEnabled"
name="project[project_feature_attributes][forking_access_level]"
/>
</project-setting-row>
<project-setting-row <project-setting-row
:label="s__('ProjectSettings|Pipelines')" :label="s__('ProjectSettings|Pipelines')"
:help-text="s__('ProjectSettings|Build, test, and deploy your changes')" :help-text="s__('ProjectSettings|Build, test, and deploy your changes')"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
pre { pre {
padding: 10px 0; padding: 10px 0;
border: 0; border: 0;
border-radius: 0 0 $border-radius-default $border-radius-default; border-radius: 0 0 $border-radius-default;
font-family: $monospace-font; font-family: $monospace-font;
font-size: $code-font-size; font-size: $code-font-size;
line-height: 1.5; line-height: 1.5;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
line-height: $code-line-height; line-height: $code-line-height;
color: $gl-text-color; color: $gl-text-color;
margin: 20px; margin: 20px;
font-weight: 200; font-weight: $gl-font-weight-normal;
.gl-snippet-icon { .gl-snippet-icon {
display: inline-block; display: inline-block;
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
.file-content.code { .file-content.code {
border: $border-style; border: $border-style;
border-radius: 0 0 4px 4px; border-radius: 0 0 $border-radius-default $border-radius-default;
display: flex; display: flex;
box-shadow: none; box-shadow: none;
margin: 0; margin: 0;
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
overflow-x: auto; overflow-x: auto;
pre { pre {
height: 100%;
padding: 10px; padding: 10px;
border: 0; border: 0;
border-radius: 0; border-radius: 0;
...@@ -110,17 +111,13 @@ ...@@ -110,17 +111,13 @@
} }
} }
.gitlab-logo { .gitlab-logo-wrapper {
display: inline-block; padding-left: $gl-padding-8;
padding-left: 5px; position: relative;
text-decoration: none; top: 2px;
color: $gl-text-color-secondary;
.logo-text { .gitlab-logo {
background: image_url('ext_snippet_icons/logo.png') no-repeat left center; height: 18px;
background-size: 18px;
font-weight: $gl-font-weight-normal;
padding-left: 24px;
} }
} }
} }
...@@ -128,7 +125,7 @@ ...@@ -128,7 +125,7 @@
img, img,
.gl-snippet-icon { .gl-snippet-icon {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: text-bottom;
} }
} }
...@@ -136,7 +133,7 @@ ...@@ -136,7 +133,7 @@
a.btn { a.btn {
background-color: $white-light; background-color: $white-light;
text-decoration: none; text-decoration: none;
padding: 7px 9px; padding: 8px 9px;
border: $border-style; border: $border-style;
border-right: 0; border-right: 0;
...@@ -147,11 +144,11 @@ ...@@ -147,11 +144,11 @@
} }
&:first-child { &:first-child {
border-radius: 3px 0 0 3px; border-radius: $border-radius-default 0 0 $border-radius-default;
} }
&:last-child { &:last-child {
border-radius: 0 3px 3px 0; border-radius: 0 $border-radius-default $border-radius-default 0;
border-right: $border-style; border-right: $border-style;
} }
} }
......
...@@ -9,6 +9,7 @@ class Projects::ForksController < Projects::ApplicationController ...@@ -9,6 +9,7 @@ class Projects::ForksController < Projects::ApplicationController
before_action :require_non_empty_project before_action :require_non_empty_project
before_action :authorize_download_code! before_action :authorize_download_code!
before_action :authenticate_user!, only: [:new, :create] before_action :authenticate_user!, only: [:new, :create]
before_action :authorize_fork_project!, only: [:new, :create]
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def index def index
...@@ -61,6 +62,8 @@ def create ...@@ -61,6 +62,8 @@ def create
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
private
def whitelist_query_limiting def whitelist_query_limiting
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42335') Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42335')
end end
......
...@@ -391,6 +391,7 @@ def project_params_attributes ...@@ -391,6 +391,7 @@ def project_params_attributes
project_feature_attributes: %i[ project_feature_attributes: %i[
builds_access_level builds_access_level
issues_access_level issues_access_level
forking_access_level
merge_requests_access_level merge_requests_access_level
repository_access_level repository_access_level
snippets_access_level snippets_access_level
......
...@@ -17,6 +17,9 @@ class GroupType < NamespaceType ...@@ -17,6 +17,9 @@ class GroupType < NamespaceType
group.avatar_url(only_path: false) group.avatar_url(only_path: false)
end end
field :mentions_disabled, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if a group is disabled from getting mentioned'
field :parent, GroupType, null: true, field :parent, GroupType, null: true,
description: 'Parent group', description: 'Parent group',
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find } resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find }
......
...@@ -563,6 +563,7 @@ def project_permissions_settings(project) ...@@ -563,6 +563,7 @@ def project_permissions_settings(project)
requestAccessEnabled: !!project.request_access_enabled, requestAccessEnabled: !!project.request_access_enabled,
issuesAccessLevel: feature.issues_access_level, issuesAccessLevel: feature.issues_access_level,
repositoryAccessLevel: feature.repository_access_level, repositoryAccessLevel: feature.repository_access_level,
forkingAccessLevel: feature.forking_access_level,
mergeRequestsAccessLevel: feature.merge_requests_access_level, mergeRequestsAccessLevel: feature.merge_requests_access_level,
buildsAccessLevel: feature.builds_access_level, buildsAccessLevel: feature.builds_access_level,
wikiAccessLevel: feature.wiki_access_level, wikiAccessLevel: feature.wiki_access_level,
......
...@@ -50,6 +50,10 @@ def merge_requests_access_level=(value) ...@@ -50,6 +50,10 @@ def merge_requests_access_level=(value)
write_feature_attribute_string(:merge_requests_access_level, value) write_feature_attribute_string(:merge_requests_access_level, value)
end end
def forking_access_level=(value)
write_feature_attribute_string(:forking_access_level, value)
end
def issues_access_level=(value) def issues_access_level=(value)
write_feature_attribute_string(:issues_access_level, value) write_feature_attribute_string(:issues_access_level, value)
end end
......
...@@ -128,7 +128,7 @@ def calculate_reactive_cache(request, opts) ...@@ -128,7 +128,7 @@ def calculate_reactive_cache(request, opts)
# -> # ->
# http://HOST/ORG/PROJECT # http://HOST/ORG/PROJECT
def self.extract_sentry_external_url(url) def self.extract_sentry_external_url(url)
url.sub('api/0/projects/', '') url&.sub('api/0/projects/', '')
end end
def api_host def api_host
......
...@@ -317,10 +317,12 @@ class Project < ApplicationRecord ...@@ -317,10 +317,12 @@ class Project < ApplicationRecord
accepts_nested_attributes_for :metrics_setting, update_only: true, allow_destroy: true accepts_nested_attributes_for :metrics_setting, update_only: true, allow_destroy: true
accepts_nested_attributes_for :grafana_integration, update_only: true, allow_destroy: true accepts_nested_attributes_for :grafana_integration, update_only: true, allow_destroy: true
delegate :feature_available?, :builds_enabled?, :wiki_enabled?, :merge_requests_enabled?, delegate :feature_available?, :builds_enabled?, :wiki_enabled?,
:issues_enabled?, :pages_enabled?, :public_pages?, :private_pages?, :merge_requests_enabled?, :forking_enabled?, :issues_enabled?,
:merge_requests_access_level, :issues_access_level, :wiki_access_level, :pages_enabled?, :public_pages?, :private_pages?,
:snippets_access_level, :builds_access_level, :repository_access_level, :merge_requests_access_level, :forking_access_level, :issues_access_level,
:wiki_access_level, :snippets_access_level, :builds_access_level,
:repository_access_level,
to: :project_feature, allow_nil: true to: :project_feature, allow_nil: true
delegate :scheduled?, :started?, :in_progress?, :failed?, :finished?, delegate :scheduled?, :started?, :in_progress?, :failed?, :finished?,
prefix: :import, to: :import_state, allow_nil: true prefix: :import, to: :import_state, allow_nil: true
......
...@@ -22,7 +22,7 @@ class ProjectFeature < ApplicationRecord ...@@ -22,7 +22,7 @@ class ProjectFeature < ApplicationRecord
ENABLED = 20 ENABLED = 20
PUBLIC = 30 PUBLIC = 30
FEATURES = %i(issues merge_requests wiki snippets builds repository pages).freeze FEATURES = %i(issues forking merge_requests wiki snippets builds repository pages).freeze
PRIVATE_FEATURES_MIN_ACCESS_LEVEL = { merge_requests: Gitlab::Access::REPORTER }.freeze PRIVATE_FEATURES_MIN_ACCESS_LEVEL = { merge_requests: Gitlab::Access::REPORTER }.freeze
PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT = { repository: Gitlab::Access::REPORTER }.freeze PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT = { repository: Gitlab::Access::REPORTER }.freeze
STRING_OPTIONS = HashWithIndifferentAccess.new({ STRING_OPTIONS = HashWithIndifferentAccess.new({
...@@ -92,6 +92,7 @@ def ensure_feature!(feature) ...@@ -92,6 +92,7 @@ def ensure_feature!(feature)
default_value_for :builds_access_level, value: ENABLED, allows_nil: false default_value_for :builds_access_level, value: ENABLED, allows_nil: false
default_value_for :issues_access_level, value: ENABLED, allows_nil: false default_value_for :issues_access_level, value: ENABLED, allows_nil: false
default_value_for :forking_access_level, value: ENABLED, allows_nil: false
default_value_for :merge_requests_access_level, value: ENABLED, allows_nil: false default_value_for :merge_requests_access_level, value: ENABLED, allows_nil: false
default_value_for :snippets_access_level, value: ENABLED, allows_nil: false default_value_for :snippets_access_level, value: ENABLED, allows_nil: false
default_value_for :wiki_access_level, value: ENABLED, allows_nil: false default_value_for :wiki_access_level, value: ENABLED, allows_nil: false
...@@ -132,6 +133,10 @@ def merge_requests_enabled? ...@@ -132,6 +133,10 @@ def merge_requests_enabled?
merge_requests_access_level > DISABLED merge_requests_access_level > DISABLED
end end
def forking_enabled?
forking_access_level > DISABLED
end
def issues_enabled? def issues_enabled?
issues_access_level > DISABLED issues_access_level > DISABLED
end end
......
...@@ -83,6 +83,11 @@ class ProjectPolicy < BasePolicy ...@@ -83,6 +83,11 @@ class ProjectPolicy < BasePolicy
project.merge_requests_allowing_push_to_user(user).any? project.merge_requests_allowing_push_to_user(user).any?
end end
with_scope :subject
condition(:forking_allowed) do
@subject.feature_available?(:forking, @user)
end
with_scope :global with_scope :global
condition(:mirror_available, score: 0) do condition(:mirror_available, score: 0) do
::Gitlab::CurrentSettings.current_application_settings.mirror_available ::Gitlab::CurrentSettings.current_application_settings.mirror_available
...@@ -203,7 +208,6 @@ class ProjectPolicy < BasePolicy ...@@ -203,7 +208,6 @@ class ProjectPolicy < BasePolicy
enable :download_code enable :download_code
enable :read_statistics enable :read_statistics
enable :download_wiki_code enable :download_wiki_code
enable :fork_project
enable :create_project_snippet enable :create_project_snippet
enable :update_issue enable :update_issue
enable :reopen_issue enable :reopen_issue
...@@ -232,12 +236,15 @@ class ProjectPolicy < BasePolicy ...@@ -232,12 +236,15 @@ class ProjectPolicy < BasePolicy
enable :public_access enable :public_access
enable :guest_access enable :guest_access
enable :fork_project
enable :build_download_code enable :build_download_code
enable :build_read_container_image enable :build_read_container_image
enable :request_access enable :request_access
end end
rule { can?(:download_code) & forking_allowed }.policy do
enable :fork_project
end
rule { owner | admin | guest | group_member }.prevent :request_access rule { owner | admin | guest | group_member }.prevent :request_access
rule { ~request_access_enabled }.prevent :request_access rule { ~request_access_enabled }.prevent :request_access
......
...@@ -60,9 +60,7 @@ def change_milestone(noteable, project, author, milestone) ...@@ -60,9 +60,7 @@ def change_milestone(noteable, project, author, milestone)
# #
# Returns the created Note object # Returns the created Note object
def change_due_date(noteable, project, author, due_date) def change_due_date(noteable, project, author, due_date)
body = due_date ? "changed due date to #{due_date.to_s(:long)}" : 'removed due date' ::SystemNotes::TimeTrackingService.new(noteable: noteable, project: project, author: author).change_due_date(due_date)
create_note(NoteSummary.new(noteable, project, author, body, action: 'due_date'))
end end
# Called when the estimated time of a Noteable is changed # Called when the estimated time of a Noteable is changed
...@@ -80,14 +78,7 @@ def change_due_date(noteable, project, author, due_date) ...@@ -80,14 +78,7 @@ def change_due_date(noteable, project, author, due_date)
# #
# Returns the created Note object # Returns the created Note object
def change_time_estimate(noteable, project, author) def change_time_estimate(noteable, project, author)
parsed_time = Gitlab::TimeTrackingFormatter.output(noteable.time_estimate) ::SystemNotes::TimeTrackingService.new(noteable: noteable, project: project, author: author).change_time_estimate
body = if noteable.time_estimate == 0
"removed time estimate"
else
"changed time estimate to #{parsed_time}"
end
create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking'))
end end
# Called when the spent time of a Noteable is changed # Called when the spent time of a Noteable is changed
...@@ -105,21 +96,7 @@ def change_time_estimate(noteable, project, author) ...@@ -105,21 +96,7 @@ def change_time_estimate(noteable, project, author)
# #
# Returns the created Note object # Returns the created Note object
def change_time_spent(noteable, project, author) def change_time_spent(noteable, project, author)
time_spent = noteable.time_spent ::SystemNotes::TimeTrackingService.new(noteable: noteable, project: project, author: author).change_time_spent
if time_spent == :reset
body = "removed time spent"
else
spent_at = noteable.spent_at
parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs)
action = time_spent > 0 ? 'added' : 'subtracted'
text_parts = ["#{action} #{parsed_time} of time spent"]
text_parts << "at #{spent_at}" if spent_at
body = text_parts.join(' ')
end
create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking'))
end end
def change_status(noteable, project, author, status, source = nil) def change_status(noteable, project, author, status, source = nil)
......
# frozen_string_literal: true
module SystemNotes
class TimeTrackingService < ::SystemNotes::BaseService
# Called when the due_date of a Noteable is changed
#
# due_date - Due date being assigned, or nil
#
# Example Note text:
#
# "removed due date"
#
# "changed due date to September 20, 2018"
#
# Returns the created Note object
def change_due_date(due_date)
body = due_date ? "changed due date to #{due_date.to_s(:long)}" : 'removed due date'
create_note(NoteSummary.new(noteable, project, author, body, action: 'due_date'))
end
# Called when the estimated time of a Noteable is changed
#
# time_estimate - Estimated time
#
# Example Note text:
#
# "removed time estimate"
#
# "changed time estimate to 3d 5h"
#
# Returns the created Note object
def change_time_estimate
parsed_time = Gitlab::TimeTrackingFormatter.output(noteable.time_estimate)
body = if noteable.time_estimate == 0
"removed time estimate"
else
"changed time estimate to #{parsed_time}"
end
create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking'))
end
# Called when the spent time of a Noteable is changed
#
# time_spent - Spent time
#
# Example Note text:
#
# "removed time spent"
#
# "added 2h 30m of time spent"
#
# Returns the created Note object
def change_time_spent
time_spent = noteable.time_spent
if time_spent == :reset
body = "removed time spent"
else
spent_at = noteable.spent_at
parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs)
action = time_spent > 0 ? 'added' : 'subtracted'
text_parts = ["#{action} #{parsed_time} of time spent"]
text_parts << "at #{spent_at}" if spent_at
body = text_parts.join(' ')
end
create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking'))
end
end
end
...@@ -10,10 +10,8 @@ ...@@ -10,10 +10,8 @@
%small %small
= number_to_human_size(blob.raw_size) = number_to_human_size(blob.raw_size)
%a.gitlab-logo{ href: url_for(only_path: false, overwrite_params: nil), title: 'view on gitlab' } %a.gitlab-logo-wrapper{ href: url_for(only_path: false, overwrite_params: nil), title: 'view on gitlab' }
on &nbsp; %img.gitlab-logo{ src: image_url('ext_snippet_icons/logo.svg'), alt: "GitLab logo" }
%span.logo-text
GitLab
.file-actions.d-none.d-sm-block .file-actions.d-none.d-sm-block
.btn-group{ role: "group" }< .btn-group{ role: "group" }<
......
---
title: Add an option to configure forking restriction
merge_request: 17988
author:
type: added
---
title: Add ability to create an issue in an epic
merge_request: 22833
author:
type: added
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