Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 09:09:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 09:09:25 +0300
commit3d064c737e8448880e6180aeddc59000a01aa6a8 (patch)
treec97dcfe02e48426f96865068ffe8dcdd17bb1a96
parent7ba5b9babaa5802c39e686c57cbf4a3f4725c4b0 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--app/assets/javascripts/diffs/store/mutation_types.js3
-rw-r--r--app/assets/javascripts/diffs/store/mutations.js12
-rw-r--r--app/assets/javascripts/notes/components/discussion_counter.vue2
-rw-r--r--app/assets/javascripts/releases/components/app_edit.vue2
-rw-r--r--app/controllers/repositories/git_http_controller.rb2
-rw-r--r--app/helpers/issuables_helper.rb23
-rw-r--r--app/views/projects/issues/_issue.html.haml1
-rw-r--r--app/views/projects/merge_requests/_merge_request.html.haml1
-rw-r--r--changelogs/unreleased/fix-enable-toggle-all-button-when-logged-out.yml5
-rw-r--r--changelogs/unreleased/fj-replace-snippet-git-message.yml5
-rw-r--r--changelogs/unreleased/nfriend-document-release-asset-links-editing-again.yml5
-rw-r--r--doc/development/documentation/styleguide.md6
-rw-r--r--doc/user/project/releases/img/edit_release_page_v12_10.pngbin0 -> 85295 bytes
-rw-r--r--doc/user/project/releases/index.md15
-rw-r--r--lib/api/internal/base.rb2
-rw-r--r--lib/gitlab/usage_data.rb71
-rw-r--r--locale/gitlab.pot8
-rw-r--r--spec/controllers/repositories/git_http_controller_spec.rb12
-rw-r--r--spec/features/projects/releases/user_views_edit_release_spec.rb2
-rw-r--r--spec/frontend/diffs/store/mutations_spec.js18
-rw-r--r--spec/frontend/releases/components/app_edit_spec.js2
-rw-r--r--spec/helpers/issuables_helper_spec.rb42
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb14
-rw-r--r--spec/requests/api/internal/base_spec.rb4
-rw-r--r--spec/views/projects/issues/show.html.haml_spec.rb16
-rw-r--r--spec/views/projects/merge_requests/show.html.haml_spec.rb14
27 files changed, 236 insertions, 53 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index e1e97da1292..e5ca41e1580 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-12.9.0-rc5
+12.10.0-rc1
diff --git a/app/assets/javascripts/diffs/store/mutation_types.js b/app/assets/javascripts/diffs/store/mutation_types.js
index 4436935c1ec..699c61b3ddd 100644
--- a/app/assets/javascripts/diffs/store/mutation_types.js
+++ b/app/assets/javascripts/diffs/store/mutation_types.js
@@ -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';
diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js
index bb4c80b5759..3c00ae98e75 100644
--- a/app/assets/javascripts/diffs/store/mutations.js
+++ b/app/assets/javascripts/diffs/store/mutations.js
@@ -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) {
diff --git a/app/assets/javascripts/notes/components/discussion_counter.vue b/app/assets/javascripts/notes/components/discussion_counter.vue
index c28ac94b3ed..07952f9edd9 100644
--- a/app/assets/javascripts/notes/components/discussion_counter.vue
+++ b/app/assets/javascripts/notes/components/discussion_counter.vue
@@ -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')"
diff --git a/app/assets/javascripts/releases/components/app_edit.vue b/app/assets/javascripts/releases/components/app_edit.vue
index e90adcd0e25..06e388002e4 100644
--- a/app/assets/javascripts/releases/components/app_edit.vue
+++ b/app/assets/javascripts/releases/components/app_edit.vue
@@ -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>',
diff --git a/app/controllers/repositories/git_http_controller.rb b/app/controllers/repositories/git_http_controller.rb
index 29bff3ef1e9..9e134ba9526 100644
--- a/app/controllers/repositories/git_http_controller.rb
+++ b/app/controllers/repositories/git_http_controller.rb
@@ -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
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index acfd972bb83..7e0cc591308 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -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"))
diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml
index a6c6b77c9dd..54002b9ca2e 100644
--- a/app/views/projects/issues/_issue.html.haml
+++ b/app/views/projects/issues/_issue.html.haml
@@ -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;
diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml
index 744dca1c462..1bde1a41975 100644
--- a/app/views/projects/merge_requests/_merge_request.html.haml
+++ b/app/views/projects/merge_requests/_merge_request.html.haml
@@ -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;
diff --git a/changelogs/unreleased/fix-enable-toggle-all-button-when-logged-out.yml b/changelogs/unreleased/fix-enable-toggle-all-button-when-logged-out.yml
new file mode 100644
index 00000000000..8ac44e1dc5a
--- /dev/null
+++ b/changelogs/unreleased/fix-enable-toggle-all-button-when-logged-out.yml
@@ -0,0 +1,5 @@
+---
+title: Enable toggle all discussions button for logged out users
+merge_request: 28809
+author: Diego Louzán
+type: fixed
diff --git a/changelogs/unreleased/fj-replace-snippet-git-message.yml b/changelogs/unreleased/fj-replace-snippet-git-message.yml
new file mode 100644
index 00000000000..ad32957ff3b
--- /dev/null
+++ b/changelogs/unreleased/fj-replace-snippet-git-message.yml
@@ -0,0 +1,5 @@
+---
+title: Update copy when snippet git feature disabled
+merge_request: 28913
+author:
+type: changed
diff --git a/changelogs/unreleased/nfriend-document-release-asset-links-editing-again.yml b/changelogs/unreleased/nfriend-document-release-asset-links-editing-again.yml
new file mode 100644
index 00000000000..c5737cd9e4f
--- /dev/null
+++ b/changelogs/unreleased/nfriend-document-release-asset-links-editing-again.yml
@@ -0,0 +1,5 @@
+---
+title: Update informational text on Edit Release page
+merge_request: 28938
+author:
+type: changed
diff --git a/doc/development/documentation/styleguide.md b/doc/development/documentation/styleguide.md
index 8e9ff0fb218..370effc940c 100644
--- a/doc/development/documentation/styleguide.md
+++ b/doc/development/documentation/styleguide.md
@@ -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,
diff --git a/doc/user/project/releases/img/edit_release_page_v12_10.png b/doc/user/project/releases/img/edit_release_page_v12_10.png
new file mode 100644
index 00000000000..ebb12a549b7
--- /dev/null
+++ b/doc/user/project/releases/img/edit_release_page_v12_10.png
Binary files differ
diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md
index 4a32644420f..37da3d0bb4a 100644
--- a/doc/user/project/releases/index.md
+++ b/doc/user/project/releases/index.md
@@ -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
diff --git a/lib/api/internal/base.rb b/lib/api/internal/base.rb
index 9c37b610cca..927639599d2 100644
--- a/lib/api/internal/base.rb
+++ b/lib/api/internal/base.rb
@@ -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
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 7277d288d63..6333e7923c6 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -1,5 +1,12 @@
# 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
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index c94f6b6804d..1cdfd83a1b4 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -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"
diff --git a/spec/controllers/repositories/git_http_controller_spec.rb b/spec/controllers/repositories/git_http_controller_spec.rb
index de14384eb6f..e565c757f95 100644
--- a/spec/controllers/repositories/git_http_controller_spec.rb
+++ b/spec/controllers/repositories/git_http_controller_spec.rb
@@ -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
diff --git a/spec/features/projects/releases/user_views_edit_release_spec.rb b/spec/features/projects/releases/user_views_edit_release_spec.rb
index 820e8277af3..217d6a25a23 100644
--- a/spec/features/projects/releases/user_views_edit_release_spec.rb
+++ b/spec/features/projects/releases/user_views_edit_release_spec.rb
@@ -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)
diff --git a/spec/frontend/diffs/store/mutations_spec.js b/spec/frontend/diffs/store/mutations_spec.js
index f486a53fc4d..ad05f27b325 100644
--- a/spec/frontend/diffs/store/mutations_spec.js
+++ b/spec/frontend/diffs/store/mutations_spec.js
@@ -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 = {
diff --git a/spec/frontend/releases/components/app_edit_spec.js b/spec/frontend/releases/components/app_edit_spec.js
index e27c27b292a..bf66f5a5183 100644
--- a/spec/frontend/releases/components/app_edit_spec.js
+++ b/spec/frontend/releases/components/app_edit_spec.js
@@ -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.',
);
});
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb
index 38ad11846d2..7eb5d2fc08c 100644
--- a/spec/helpers/issuables_helper_spec.rb
+++ b/spec/helpers/issuables_helper_spec.rb
@@ -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
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index c29a4dd9e00..37d9c5389dd 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -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
diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb
index 575d695ef54..09689c5794d 100644
--- a/spec/requests/api/internal/base_spec.rb
+++ b/spec/requests/api/internal/base_spec.rb
@@ -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
diff --git a/spec/views/projects/issues/show.html.haml_spec.rb b/spec/views/projects/issues/show.html.haml_spec.rb
index add4b44e9b6..fb09840c8f4 100644
--- a/spec/views/projects/issues/show.html.haml_spec.rb
+++ b/spec/views/projects/issues/show.html.haml_spec.rb
@@ -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
diff --git a/spec/views/projects/merge_requests/show.html.haml_spec.rb b/spec/views/projects/merge_requests/show.html.haml_spec.rb
index 6023527cb28..67e7c3cf2fb 100644
--- a/spec/views/projects/merge_requests/show.html.haml_spec.rb
+++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb
@@ -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)