提交 3d064c73 编写于 作者: G GitLab Bot

Add latest changes from gitlab-org/gitlab@master

上级 7ba5b9ba
......@@ -2,8 +2,11 @@ export const SET_BASE_CONFIG = 'SET_BASE_CONFIG';
export const SET_LOADING = 'SET_LOADING';
export const SET_BATCH_LOADING = 'SET_BATCH_LOADING';
export const SET_RETRIEVING_BATCHES = 'SET_RETRIEVING_BATCHES';
export const SET_DIFF_DATA = 'SET_DIFF_DATA';
export const SET_DIFF_DATA_BATCH = 'SET_DIFF_DATA_BATCH';
export const SET_DIFF_FILES = 'SET_DIFF_FILES';
export const SET_DIFF_VIEW_TYPE = 'SET_DIFF_VIEW_TYPE';
export const SET_COVERAGE_DATA = 'SET_COVERAGE_DATA';
export const SET_MERGE_REQUEST_DIFFS = 'SET_MERGE_REQUEST_DIFFS';
......
......@@ -10,6 +10,10 @@ import {
} from './utils';
import * as types from './mutation_types';
function updateDiffFilesInState(state, files) {
return Object.assign(state, { diffFiles: files });
}
export default {
[types.SET_BASE_CONFIG](state, options) {
const {
......@@ -46,6 +50,10 @@ export default {
Object.assign(state, { retrievingBatches });
},
[types.SET_DIFF_FILES](state, files) {
updateDiffFilesInState(state, files);
},
[types.SET_DIFF_DATA](state, data) {
let files = state.diffFiles;
......@@ -58,8 +66,8 @@ export default {
Object.assign(state, {
...convertObjectPropsToCamelCase(data),
diffFiles: files,
});
updateDiffFilesInState(state, files);
},
[types.SET_DIFF_DATA_BATCH](state, data) {
......@@ -67,8 +75,8 @@ export default {
Object.assign(state, {
...convertObjectPropsToCamelCase(data),
diffFiles: files,
});
updateDiffFilesInState(state, files);
},
[types.SET_COVERAGE_DATA](state, coverageFiles) {
......
......@@ -98,7 +98,7 @@ export default {
<icon name="comment-next" />
</button>
</div>
<div v-if="isLoggedIn" class="btn-group btn-group-sm" role="group">
<div class="btn-group btn-group-sm" role="group">
<button
v-gl-tooltip
:title="__('Toggle all threads')"
......
......@@ -39,7 +39,7 @@ export default {
subtitleText() {
return sprintf(
__(
'Releases are based on Git tags. We recommend naming tags that fit within semantic versioning, for example %{codeStart}v1.0%{codeEnd}, %{codeStart}v2.0-pre%{codeEnd}.',
'Releases are based on Git tags. We recommend tags that use semantic versioning, for example %{codeStart}v1.0%{codeEnd}, %{codeStart}v2.0-pre%{codeEnd}.',
),
{
codeStart: '<code>',
......
......@@ -121,7 +121,7 @@ module Repositories
def snippet_request_allowed?
if repo_type.snippet? && Feature.disabled?(:version_snippets, user)
Gitlab::AppLogger.info('Snippet access attempt with feature disabled')
render plain: 'The project you were looking for could not be found.', status: :not_found
render plain: 'Snippet git access is disabled.', status: :forbidden
end
end
end
......
......@@ -196,6 +196,8 @@ module IssuablesHelper
author_output = link_to_member(project, issuable.author, size: 24, mobile_classes: "d-none d-sm-inline")
author_output << link_to_member(project, issuable.author, size: 24, by_username: true, avatar: false, mobile_classes: "d-inline d-sm-none")
author_output << gitlab_team_member_badge(issuable.author, css_class: 'ml-1')
if status = user_status(issuable.author)
author_output << "#{status}".html_safe
end
......@@ -240,6 +242,27 @@ module IssuablesHelper
html.html_safe
end
def gitlab_team_member_badge(author, css_class: nil)
return unless author.gitlab_employee?
default_css_class = 'd-inline-block align-middle'
gitlab_team_member = _('GitLab Team Member')
content_tag(
:span,
class: css_class ? "#{default_css_class} #{css_class}" : default_css_class,
data: { toggle: 'tooltip', title: gitlab_team_member, container: 'body' },
role: 'img',
aria: { label: gitlab_team_member }
) do
sprite_icon(
'tanuki-verified',
size: 16,
css_class: 'gl-text-purple d-block'
)
end
end
def issuable_first_contribution_icon
content_tag(:span, class: 'fa-stack') do
concat(icon('certificate', class: "fa-stack-2x"))
......
......@@ -24,6 +24,7 @@
&middot;
opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')}
by #{link_to_member(@project, issue.author, avatar: false)}
= gitlab_team_member_badge(issue.author)
- if issue.milestone
%span.issuable-milestone.d-none.d-sm-inline-block
&nbsp;
......
......@@ -20,6 +20,7 @@
&middot;
opened #{time_ago_with_tooltip(merge_request.created_at, placement: 'bottom')}
by #{link_to_member(@project, merge_request.author, avatar: false)}
= gitlab_team_member_badge(merge_request.author)
- if merge_request.milestone
%span.issuable-milestone.d-none.d-sm-inline-block
&nbsp;
......
---
title: Enable toggle all discussions button for logged out users
merge_request: 28809
author: Diego Louzán
type: fixed
---
title: Update copy when snippet git feature disabled
merge_request: 28913
author:
type: changed
---
title: Update informational text on Edit Release page
merge_request: 28938
author:
type: changed
......@@ -757,10 +757,8 @@ To indicate the steps of navigation through the UI:
the `.md` document that you're working on is located.
- Images should have a specific, non-generic name that will
differentiate and describe them properly.
- Always add to the end of the file name the GitLab release version
corresponding to the version the screenshot was taken from, using the format
`image_name_vX_Y.png`.
([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/61027) in GitLab 12.1.)
- For screenshots of GitLab software, append the GitLab version the screenshot was taken from to the
file name. Use the following format: `image_name_vX_Y.png`.
- For example, for a screenshot taken from the pipelines page of
GitLab 11.1, a valid name is `pipelines_v11_1.png`. If you're
adding an illustration that does not include parts of the UI,
......
......@@ -183,7 +183,7 @@ we recommend doing this as one of the last steps in your CI/CD release pipeline.
## Editing a release
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26016) in GitLab 12.6.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26016) in GitLab 12.6. Asset link editing was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/9427) in GitLab 12.10.
To edit the details of a release, navigate to **Project overview > Releases** and click
the edit button (pencil icon) in the top-right corner of the release you want to modify.
......@@ -193,14 +193,13 @@ the edit button (pencil icon) in the top-right corner of the release you want to
This will bring you to the **Edit Release** page, from which you can
change some of the release's details.
![Edit release page](img/edit_release_page_v12_6.png)
![Edit release page](img/edit_release_page_v12_10.png)
Currently, it is only possible to edit the release title and notes.
To change other release information, such as its tag, associated
milestones, or release date, use the
[Releases API](../../../api/releases/index.md#update-a-release). Editing this
information through the **Edit Release** page is planned for a future version
of GitLab.
Currently, it is only possible to edit the release title, notes, and asset
links. To change other release information, such as its tag, associated
milestones, or release date, use the [Releases
API](../../../api/releases/index.md#update-a-release). Editing this information
through the **Edit Release** page is planned for a future version of GitLab.
## Notification for Releases
......
......@@ -109,7 +109,7 @@ module API
# group resources based on its IP restrictions
post "/allowed" do
if repo_type.snippet? && Feature.disabled?(:version_snippets, actor.user)
break response_with_status(code: 404, success: false, message: 'The project you were looking for could not be found.')
break response_with_status(code: 401, success: false, message: 'Snippet git access is disabled.')
end
# It was moved to a separate method so that EE can alter its behaviour more
......
# frozen_string_literal: true
# For hardening usage ping and make it easier to add measures there is in place alt_usage_data method
# which handles StandardError and fallbacks into -1
# this way not all measures fail if we encounter one exception
#
# Examples:
# alt_usage_data { Gitlab::VERSION }
# alt_usage_data { Gitlab::CurrentSettings.uuid }
module Gitlab
class UsageData
BATCH_SIZE = 100
......@@ -24,17 +31,15 @@ module Gitlab
end
def license_usage_data
usage_data = {
uuid: Gitlab::CurrentSettings.uuid,
hostname: Gitlab.config.gitlab.host,
version: Gitlab::VERSION,
installation_type: installation_type,
{
uuid: alt_usage_data { Gitlab::CurrentSettings.uuid },
hostname: alt_usage_data { Gitlab.config.gitlab.host },
version: alt_usage_data { Gitlab::VERSION },
installation_type: alt_usage_data { installation_type },
active_user_count: count(User.active),
recorded_at: Time.now,
edition: 'CE'
}
usage_data
end
# rubocop: disable Metrics/AbcSize
......@@ -134,18 +139,18 @@ module Gitlab
def features_usage_data_ce
{
container_registry_enabled: Gitlab.config.registry.enabled,
container_registry_enabled: alt_usage_data { Gitlab.config.registry.enabled },
dependency_proxy_enabled: Gitlab.config.try(:dependency_proxy)&.enabled,
gitlab_shared_runners_enabled: Gitlab.config.gitlab_ci.shared_runners_enabled,
gravatar_enabled: Gitlab::CurrentSettings.gravatar_enabled?,
influxdb_metrics_enabled: Gitlab::Metrics.influx_metrics_enabled?,
ldap_enabled: Gitlab.config.ldap.enabled,
mattermost_enabled: Gitlab.config.mattermost.enabled,
omniauth_enabled: Gitlab::Auth.omniauth_enabled?,
prometheus_metrics_enabled: Gitlab::Metrics.prometheus_metrics_enabled?,
reply_by_email_enabled: Gitlab::IncomingEmail.enabled?,
signup_enabled: Gitlab::CurrentSettings.allow_signup?,
web_ide_clientside_preview_enabled: Gitlab::CurrentSettings.web_ide_clientside_preview_enabled?,
gitlab_shared_runners_enabled: alt_usage_data { Gitlab.config.gitlab_ci.shared_runners_enabled },
gravatar_enabled: alt_usage_data { Gitlab::CurrentSettings.gravatar_enabled? },
influxdb_metrics_enabled: alt_usage_data { Gitlab::Metrics.influx_metrics_enabled? },
ldap_enabled: alt_usage_data { Gitlab.config.ldap.enabled },
mattermost_enabled: alt_usage_data { Gitlab.config.mattermost.enabled },
omniauth_enabled: alt_usage_data { Gitlab::Auth.omniauth_enabled? },
prometheus_metrics_enabled: alt_usage_data { Gitlab::Metrics.prometheus_metrics_enabled? },
reply_by_email_enabled: alt_usage_data { Gitlab::IncomingEmail.enabled? },
signup_enabled: alt_usage_data { Gitlab::CurrentSettings.allow_signup? },
web_ide_clientside_preview_enabled: alt_usage_data { Gitlab::CurrentSettings.web_ide_clientside_preview_enabled? },
ingress_modsecurity_enabled: Feature.enabled?(:ingress_modsecurity)
}
end
......@@ -172,10 +177,20 @@ module Gitlab
def components_usage_data
{
git: { version: Gitlab::Git.version },
gitaly: { version: Gitaly::Server.all.first.server_version, servers: Gitaly::Server.count, filesystems: Gitaly::Server.filesystems },
gitlab_pages: { enabled: Gitlab.config.pages.enabled, version: Gitlab::Pages::VERSION },
database: { adapter: Gitlab::Database.adapter_name, version: Gitlab::Database.version },
git: { version: alt_usage_data { Gitlab::Git.version } },
gitaly: {
version: alt_usage_data { Gitaly::Server.all.first.server_version },
servers: alt_usage_data { Gitaly::Server.count },
filesystems: alt_usage_data { Gitaly::Server.filesystems }
},
gitlab_pages: {
enabled: alt_usage_data { Gitlab.config.pages.enabled },
version: alt_usage_data { Gitlab::Pages::VERSION }
},
database: {
adapter: alt_usage_data { Gitlab::Database.adapter_name },
version: alt_usage_data { Gitlab::Database.version }
},
app_server: { type: app_server_type }
}
end
......@@ -260,6 +275,18 @@ module Gitlab
fallback
end
def alt_usage_data(value = nil, fallback: -1, &block)
if block_given?
yield
else
value
end
rescue
fallback
end
private
def installation_type
if Rails.env.production?
Gitlab::INSTALLATION_TYPE
......
......@@ -1697,6 +1697,9 @@ msgstr ""
msgid "Allow only the selected protocols to be used for Git access."
msgstr ""
msgid "Allow owners to manually add users outside of LDAP"
msgstr ""
msgid "Allow projects within this group to use Git LFS"
msgstr ""
......@@ -9623,6 +9626,9 @@ msgstr ""
msgid "GitLab Support Bot"
msgstr ""
msgid "GitLab Team Member"
msgstr ""
msgid "GitLab User"
msgstr ""
......@@ -16571,7 +16577,7 @@ msgstr ""
msgid "Releases are based on Git tags and mark specific points in a project's development history. They can contain information about the type of changes and can also deliver binaries, like compiled versions of your software."
msgstr ""
msgid "Releases are based on Git tags. We recommend naming tags that fit within semantic versioning, for example %{codeStart}v1.0%{codeEnd}, %{codeStart}v2.0-pre%{codeEnd}."
msgid "Releases are based on Git tags. We recommend tags that use semantic versioning, for example %{codeStart}v1.0%{codeEnd}, %{codeStart}v2.0-pre%{codeEnd}."
msgstr ""
msgid "Releases documentation"
......
......@@ -145,13 +145,13 @@ describe Repositories::GitHttpController do
describe 'GET #info_refs' do
let(:params) { container_params.merge(service: 'git-upload-pack') }
it 'returns 404' do
it 'returns 403' do
expect(controller).not_to receive(:access_check)
get :info_refs, params: params
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to eq "The project you were looking for could not be found."
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq 'Snippet git access is disabled.'
end
end
......@@ -162,13 +162,13 @@ describe Repositories::GitHttpController do
allow(controller).to receive(:access_check).and_return(nil)
end
it 'returns 404' do
it 'returns 403' do
expect(controller).not_to receive(:access_check)
post :git_upload_pack, params: params
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to eq "The project you were looking for could not be found."
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq 'Snippet git access is disabled.'
end
end
end
......
......@@ -40,7 +40,7 @@ describe 'User edits Release', :js do
end
it 'renders the edit Release form' do
expect(page).to have_content('Releases are based on Git tags. We recommend naming tags that fit within semantic versioning, for example v1.0, v2.0-pre.')
expect(page).to have_content('Releases are based on Git tags. We recommend tags that use semantic versioning, for example v1.0, v2.0-pre.')
expect(find_field('Tag name', { disabled: true }).value).to eq(release.tag)
expect(find_field('Release title').value).to eq(release.name)
......
......@@ -51,6 +51,24 @@ describe('DiffsStoreMutations', () => {
});
});
describe('SET_DIFF_FILES', () => {
it('should set diffFiles in state', () => {
const state = {};
mutations[types.SET_DIFF_FILES](state, ['file', 'another file']);
expect(state.diffFiles.length).toEqual(2);
});
it('should not set anything except diffFiles in state', () => {
const state = {};
mutations[types.SET_DIFF_FILES](state, ['file', 'another file']);
expect(Object.keys(state)).toEqual(['diffFiles']);
});
});
describe('SET_DIFF_DATA', () => {
it('should set diff data type properly', () => {
const state = {
......
......@@ -66,7 +66,7 @@ describe('Release edit component', () => {
it('renders the description text at the top of the page', () => {
expect(wrapper.find('.js-subtitle-text').text()).toBe(
'Releases are based on Git tags. We recommend naming tags that fit within semantic versioning, for example v1.0, v2.0-pre.',
'Releases are based on Git tags. We recommend tags that use semantic versioning, for example v1.0, v2.0-pre.',
);
});
......
......@@ -303,4 +303,46 @@ describe IssuablesHelper do
end
end
end
describe '#gitlab_team_member_badge' do
let(:issue) { build(:issue, author: user) }
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
context 'when `:gitlab_employee_badge` feature flag is disabled' do
let(:user) { build(:user, email: 'test@gitlab.com') }
before do
stub_feature_flags(gitlab_employee_badge: false)
end
it 'returns nil' do
expect(helper.gitlab_team_member_badge(issue.author)).to be_nil
end
end
context 'when issue author is not a GitLab team member' do
let(:user) { build(:user, email: 'test@example.com') }
it 'returns nil' do
expect(helper.gitlab_team_member_badge(issue.author)).to be_nil
end
end
context 'when issue author is a GitLab team member' do
let(:user) { build(:user, email: 'test@gitlab.com') }
it 'returns span with svg icon' do
expect(helper.gitlab_team_member_badge(issue.author)).to have_selector('span > svg')
end
context 'when `css_class` parameter is passed' do
it 'adds CSS classes' do
expect(helper.gitlab_team_member_badge(issue.author, css_class: 'foo bar baz')).to have_selector('span.foo.bar.baz')
end
end
end
end
end
......@@ -269,4 +269,18 @@ describe Gitlab::UsageData, :aggregate_failures do
it_behaves_like 'usage data execution'
end
describe '#alt_usage_data' do
it 'returns the fallback when it gets an error' do
expect(described_class.alt_usage_data { raise StandardError } ).to eq(-1)
end
it 'returns the evaluated block when give' do
expect(described_class.alt_usage_data { Gitlab::CurrentSettings.uuid } ).to eq(Gitlab::CurrentSettings.uuid)
end
it 'returns the value when given' do
expect(described_class.alt_usage_data(1)).to eq 1
end
end
end
......@@ -325,12 +325,12 @@ describe API::Internal::Base do
shared_examples 'snippets with disabled feature flag' do
context 'when feature flag :version_snippets is disabled' do
it 'returns 404' do
it 'returns 401' do
stub_feature_flags(version_snippets: false)
subject
expect(response).to have_gitlab_http_status(:not_found)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
......
......@@ -13,7 +13,7 @@ describe 'projects/issues/show' do
assign(:noteable, issue)
stub_template 'shared/issuable/_sidebar' => ''
stub_template 'projects/issues/_discussion' => ''
allow(view).to receive(:issuable_meta).and_return('')
allow(view).to receive(:user_status).and_return('')
end
context 'when the issue is closed' do
......@@ -152,4 +152,18 @@ describe 'projects/issues/show' do
expect(rendered).not_to have_selector('#js-sentry-error-stack-trace')
end
end
context 'when issue is created by a GitLab team member' do
let(:user) { create(:user, email: 'test@gitlab.com') }
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
it 'renders an employee badge next to their name' do
render
expect(rendered).to have_selector('[aria-label="GitLab Team Member"]')
end
end
end
......@@ -93,6 +93,20 @@ describe 'projects/merge_requests/show.html.haml' do
end
end
context 'when merge request is created by a GitLab team member' do
let(:user) { create(:user, email: 'test@gitlab.com') }
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
it 'renders an employee badge next to their name' do
render
expect(rendered).to have_selector('[aria-label="GitLab Team Member"]')
end
end
def serialize_issuable_sidebar(user, project, merge_request)
MergeRequestSerializer
.new(current_user: user, project: project)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册