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:
authorMayra Cabrera <mcabrera@gitlab.com>2018-06-13 20:49:25 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2018-06-13 20:49:25 +0300
commit662276be52e477c0d0c61adb02a6f356843787f1 (patch)
treed0e8c327e93953b82ad467e9718023b5eea36234
parent70891b79cf576ac22d35e85fac49a3cac31e0d3a (diff)
parentda1792488405d6a93a8cbc1d2cbde64d97a7d07f (diff)
Merge branch '11-0-stable-prepare-rc11' into '11-0-stable'
Prepare 11.0 RC11 release See merge request gitlab-org/gitlab-ce!19761
-rw-r--r--app/assets/javascripts/boards/models/list.js3
-rw-r--r--app/assets/javascripts/milestone_select.js2
-rw-r--r--app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_image.vue1
-rw-r--r--app/assets/stylesheets/bootstrap_migration.scss1
-rw-r--r--app/assets/stylesheets/framework/header.scss2
-rw-r--r--app/assets/stylesheets/framework/mixins.scss1
-rw-r--r--app/assets/stylesheets/framework/secondary_navigation_elements.scss2
-rw-r--r--app/assets/stylesheets/framework/tables.scss2
-rw-r--r--app/assets/stylesheets/pages/labels.scss6
-rw-r--r--app/assets/stylesheets/pages/members.scss4
-rw-r--r--app/assets/stylesheets/pages/merge_requests.scss1
-rw-r--r--app/assets/stylesheets/pages/projects.scss6
-rw-r--r--app/controllers/registrations_controller.rb27
-rw-r--r--app/controllers/users/terms_controller.rb3
-rw-r--r--app/views/admin/application_settings/_terms.html.haml6
-rw-r--r--app/views/admin/application_settings/show.html.haml4
-rw-r--r--app/views/devise/shared/_signup_box.html.haml7
-rw-r--r--app/views/groups/group_members/index.html.haml7
-rw-r--r--app/views/projects/merge_requests/show.html.haml39
-rw-r--r--app/views/projects/project_members/_team.html.haml7
-rw-r--r--app/views/users/terms/index.html.haml27
-rw-r--r--changelogs/unreleased/bvl-terms-on-registration.yml5
-rw-r--r--changelogs/unreleased/fj-restore-users-v3-endpoint.yml5
-rw-r--r--doc/user/admin_area/settings/img/enforce_terms.pngbin51979 -> 54881 bytes
-rw-r--r--doc/user/admin_area/settings/img/sign_up_terms.pngbin0 -> 18174 bytes
-rw-r--r--doc/user/admin_area/settings/terms.md13
-rw-r--r--doc/user/project/issue_board.md4
-rw-r--r--doc/user/project/web_ide/index.md21
-rw-r--r--lib/api/entities.rb4
-rw-r--r--lib/api/users.rb26
-rw-r--r--lib/banzai/filter/milestone_reference_filter.rb2
-rw-r--r--lib/gitlab/url_builder.rb2
-rw-r--r--locale/gitlab.pot231
-rw-r--r--spec/controllers/registrations_controller_spec.rb21
-rw-r--r--spec/features/admin/admin_settings_spec.rb2
-rw-r--r--spec/features/users/signup_spec.rb21
-rw-r--r--spec/features/users/terms_spec.rb143
-rw-r--r--spec/fixtures/api/schemas/public_api/v4/milestones.json3
-rw-r--r--spec/lib/banzai/filter/milestone_reference_filter_spec.rb10
-rw-r--r--spec/lib/gitlab/url_builder_spec.rb25
-rw-r--r--spec/requests/api/users_spec.rb73
-rw-r--r--spec/support/api/scopes/read_user_shared_examples.rb10
42 files changed, 553 insertions, 226 deletions
diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js
index a79dd62e2e4..1f0fe7f9e85 100644
--- a/app/assets/javascripts/boards/models/list.js
+++ b/app/assets/javascripts/boards/models/list.js
@@ -55,7 +55,8 @@ class List {
entityType = 'assignee_id';
}
- return gl.boardService.createList(this.label.id)
+ return gl.boardService
+ .createList(entity.id, entityType)
.then(res => res.data)
.then(data => {
this.id = data.id;
diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js
index f8b3d3061f0..d269c45203a 100644
--- a/app/assets/javascripts/milestone_select.js
+++ b/app/assets/javascripts/milestone_select.js
@@ -56,7 +56,7 @@ export default class MilestoneSelect {
if (issueUpdateURL) {
milestoneLinkTemplate = _.template(
- '<a href="/<%- full_path %>/milestones/<%- iid %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>',
+ '<a href="<%- web_url %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>',
);
milestoneLinkNoneTemplate = '<span class="no-value">None</span>';
}
diff --git a/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_image.vue b/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_image.vue
index cc9cc46bb4c..a5c4fbcce31 100644
--- a/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_image.vue
+++ b/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_image.vue
@@ -86,6 +86,7 @@ export default {
<img
v-tooltip
class="avatar"
+ data-boundary="window"
:class="{
lazy: lazy,
[avatarSizeClass]: true,
diff --git a/app/assets/stylesheets/bootstrap_migration.scss b/app/assets/stylesheets/bootstrap_migration.scss
index 88d6bae349a..810ed5bb0a6 100644
--- a/app/assets/stylesheets/bootstrap_migration.scss
+++ b/app/assets/stylesheets/bootstrap_migration.scss
@@ -94,6 +94,7 @@ hr {
}
.form-group.row .col-form-label {
+ padding-top: 0;
// Bootstrap 4 aligns labels to the left
// for horizontal forms
@include media-breakpoint-up(md) {
diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss
index 1d5bdaa8961..db59c91e375 100644
--- a/app/assets/stylesheets/framework/header.scss
+++ b/app/assets/stylesheets/framework/header.scss
@@ -268,6 +268,8 @@
.navbar-sub-nav,
.navbar-nav {
+ align-items: center;
+
> li {
> a:hover,
> a:focus {
diff --git a/app/assets/stylesheets/framework/mixins.scss b/app/assets/stylesheets/framework/mixins.scss
index d76cf8f8182..0b645eb811b 100644
--- a/app/assets/stylesheets/framework/mixins.scss
+++ b/app/assets/stylesheets/framework/mixins.scss
@@ -186,6 +186,7 @@
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
display: flex;
+ flex-wrap: nowrap;
&::-webkit-scrollbar {
display: none;
diff --git a/app/assets/stylesheets/framework/secondary_navigation_elements.scss b/app/assets/stylesheets/framework/secondary_navigation_elements.scss
index 847fc8c0792..4e2cc498883 100644
--- a/app/assets/stylesheets/framework/secondary_navigation_elements.scss
+++ b/app/assets/stylesheets/framework/secondary_navigation_elements.scss
@@ -230,6 +230,8 @@
}
.scrolling-tabs-container {
+ position: relative;
+
.merge-request-tabs-container & {
overflow: hidden;
}
diff --git a/app/assets/stylesheets/framework/tables.scss b/app/assets/stylesheets/framework/tables.scss
index ba9de6941ac..339388392df 100644
--- a/app/assets/stylesheets/framework/tables.scss
+++ b/app/assets/stylesheets/framework/tables.scss
@@ -58,7 +58,7 @@ table {
display: none;
}
- table,
+ &,
tbody,
td {
display: block;
diff --git a/app/assets/stylesheets/pages/labels.scss b/app/assets/stylesheets/pages/labels.scss
index 3c74c5ed2b4..144e9c16943 100644
--- a/app/assets/stylesheets/pages/labels.scss
+++ b/app/assets/stylesheets/pages/labels.scss
@@ -58,7 +58,7 @@
}
.color-label {
- padding: $gl-padding-4 $grid-size;
+ padding: 0 $grid-size;
line-height: 16px;
border-radius: $label-border-radius;
color: $white-light;
@@ -112,6 +112,10 @@
}
}
}
+
+ .color-label {
+ padding: $gl-padding-4 $grid-size;
+ }
}
.prioritized-labels {
diff --git a/app/assets/stylesheets/pages/members.scss b/app/assets/stylesheets/pages/members.scss
index 9914555d309..5fdb2b4a90a 100644
--- a/app/assets/stylesheets/pages/members.scss
+++ b/app/assets/stylesheets/pages/members.scss
@@ -121,10 +121,6 @@
background: transparent;
border: 0;
outline: 0;
-
- @include media-breakpoint-up(sm) {
- right: 160px;
- }
}
.flex-project-members-panel {
diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss
index 9eceb3e9a33..f50ca677800 100644
--- a/app/assets/stylesheets/pages/merge_requests.scss
+++ b/app/assets/stylesheets/pages/merge_requests.scss
@@ -678,6 +678,7 @@
.merge-request-tabs {
display: flex;
+ flex-wrap: nowrap;
margin-bottom: 0;
padding: 0;
}
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index 22964163e95..caafda5fb05 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -354,12 +354,6 @@
min-width: 200px;
}
-.deploy-keys {
- .scrolling-tabs-container {
- position: relative;
- }
-}
-
.deploy-key {
// Ensure that the fingerprint does not overflow on small screens
.fingerprint {
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index f5a222b3a48..e6d6965036e 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -3,6 +3,9 @@ class RegistrationsController < Devise::RegistrationsController
include AcceptsPendingInvitations
before_action :whitelist_query_limiting, only: [:destroy]
+ before_action :ensure_terms_accepted,
+ if: -> { Gitlab::CurrentSettings.current_application_settings.enforce_terms? },
+ only: [:create]
def new
redirect_to(new_user_session_path)
@@ -18,7 +21,9 @@ class RegistrationsController < Devise::RegistrationsController
if !Gitlab::Recaptcha.load_configurations! || verify_recaptcha
accept_pending_invitations
- super
+ super do |new_user|
+ persist_accepted_terms_if_required(new_user)
+ end
else
flash[:alert] = 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'
flash.delete :recaptcha_error
@@ -40,6 +45,16 @@ class RegistrationsController < Devise::RegistrationsController
protected
+ def persist_accepted_terms_if_required(new_user)
+ return unless new_user.persisted?
+ return unless Gitlab::CurrentSettings.current_application_settings.enforce_terms?
+
+ if terms_accepted?
+ terms = ApplicationSetting::Term.latest
+ Users::RespondToTermsService.new(new_user, terms).execute(accepted: true)
+ end
+ end
+
def destroy_confirmation_valid?
if current_user.confirm_deletion_with_password?
current_user.valid_password?(params[:password])
@@ -91,4 +106,14 @@ class RegistrationsController < Devise::RegistrationsController
def whitelist_query_limiting
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42380')
end
+
+ def ensure_terms_accepted
+ return if terms_accepted?
+
+ redirect_to new_user_session_path, alert: _('You must accept our Terms of Service and privacy policy in order to register an account')
+ end
+
+ def terms_accepted?
+ Gitlab::Utils.to_boolean(params[:terms_opt_in])
+ end
end
diff --git a/app/controllers/users/terms_controller.rb b/app/controllers/users/terms_controller.rb
index f7c6d1d59db..1b1560a2a00 100644
--- a/app/controllers/users/terms_controller.rb
+++ b/app/controllers/users/terms_controller.rb
@@ -2,6 +2,7 @@ module Users
class TermsController < ApplicationController
include InternalRedirect
+ skip_before_action :authenticate_user!
skip_before_action :enforce_terms!
skip_before_action :check_password_expiration
skip_before_action :check_two_factor_requirement
@@ -14,7 +15,7 @@ module Users
def index
@redirect = redirect_path
- if @term.accepted_by_user?(current_user)
+ if current_user && @term.accepted_by_user?(current_user)
flash.now[:notice] = "You have already accepted the Terms of Service as #{current_user.to_reference}"
end
end
diff --git a/app/views/admin/application_settings/_terms.html.haml b/app/views/admin/application_settings/_terms.html.haml
index 257565ce193..7941c8508e8 100644
--- a/app/views/admin/application_settings/_terms.html.haml
+++ b/app/views/admin/application_settings/_terms.html.haml
@@ -1,4 +1,4 @@
-= form_for @application_setting, url: admin_application_settings_path do |f|
+= form_for @application_setting, url: admin_application_settings_path, html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
@@ -7,13 +7,13 @@
.form-check
= f.check_box :enforce_terms, class: 'form-check-input'
= f.label :enforce_terms, class: 'form-check-label' do
- = _("Require all users to accept Terms of Service when they access GitLab.")
+ = _("Require all users to accept Terms of Service and Privacy Policy when they access GitLab.")
.form-text.text-muted
= _("When enabled, users cannot use GitLab until the terms have been accepted.")
.form-group.row
.col-sm-12
= f.label :terms do
- = _("Terms of Service Agreement")
+ = _("Terms of Service Agreement and Privacy Policy")
.col-sm-12
= f.text_area :terms, class: 'form-control', rows: 8
.form-text.text-muted
diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml
index 3f440c76ee0..eeac441d973 100644
--- a/app/views/admin/application_settings/show.html.haml
+++ b/app/views/admin/application_settings/show.html.haml
@@ -50,11 +50,11 @@
%section.settings.as-terms.no-animate#js-terms-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
- = _('Terms of Service')
+ = _('Terms of Service and Privacy Policy')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
- = _('Include a Terms of Service agreement that all users must accept.')
+ = _('Include a Terms of Service agreement and Privacy Policy that all users must accept.')
.settings-content
= render 'terms'
diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml
index 2554b2688bb..ee7369f54a9 100644
--- a/app/views/devise/shared/_signup_box.html.haml
+++ b/app/views/devise/shared/_signup_box.html.haml
@@ -22,6 +22,13 @@
= f.label :password
= f.password_field :password, class: "form-control bottom", required: true, pattern: ".{#{@minimum_password_length},}", title: "Minimum length is #{@minimum_password_length} characters."
%p.gl-field-hint Minimum length is #{@minimum_password_length} characters
+ - if Gitlab::CurrentSettings.current_application_settings.enforce_terms?
+ .form-group
+ = check_box_tag :terms_opt_in, '1', false, required: true
+ = label_tag :terms_opt_in do
+ - terms_link = link_to s_("I accept the|Terms of Service and Privacy Policy"), terms_path, target: "_blank"
+ - accept_terms_label = _("I accept the %{terms_link}") % { terms_link: terms_link }
+ = accept_terms_label.html_safe
%div
- if Gitlab::Recaptcha.enabled?
= recaptcha_tags
diff --git a/app/views/groups/group_members/index.html.haml b/app/views/groups/group_members/index.html.haml
index 6a0321bcd2b..13d584f5f1d 100644
--- a/app/views/groups/group_members/index.html.haml
+++ b/app/views/groups/group_members/index.html.haml
@@ -25,9 +25,10 @@
%span.badge= @members.total_count
= form_tag group_group_members_path(@group), method: :get, class: 'form-inline member-search-form flex-project-members-form' do
.form-group
- = search_field_tag :search, params[:search], { placeholder: 'Find existing members by name', class: 'form-control', spellcheck: false }
- %button.member-search-btn{ type: "submit", "aria-label" => "Submit search" }
- = icon("search")
+ .position-relative.append-right-8
+ = search_field_tag :search, params[:search], { placeholder: 'Find existing members by name', class: 'form-control', spellcheck: false }
+ %button.member-search-btn{ type: "submit", "aria-label" => "Submit search" }
+ = icon("search")
- if can_manage_members
= render 'shared/members/filter_2fa_dropdown'
= render 'shared/members/sort_dropdown'
diff --git a/app/views/projects/merge_requests/show.html.haml b/app/views/projects/merge_requests/show.html.haml
index 01e38ffee20..2f1877a15c2 100644
--- a/app/views/projects/merge_requests/show.html.haml
+++ b/app/views/projects/merge_requests/show.html.haml
@@ -32,26 +32,25 @@
.scrolling-tabs-container.inner-page-scroll-tabs.is-smaller
.fade-left= icon('angle-left')
.fade-right= icon('angle-right')
- .nav-links.scrolling-tabs.nav.nav-tabs
- %ul.merge-request-tabs.nav-tabs.nav
- %li.notes-tab
- = tab_link_for @merge_request, :show, force_link: @commit.present? do
- Discussion
- %span.badge.badge-pill= @merge_request.related_notes.user.count
- - if @merge_request.source_project
- %li.commits-tab
- = tab_link_for @merge_request, :commits do
- Commits
- %span.badge.badge-pill= @commits_count
- - if @pipelines.any?
- %li.pipelines-tab
- = tab_link_for @merge_request, :pipelines do
- Pipelines
- %span.badge.badge-pill.js-pipelines-mr-count= @pipelines.size
- %li.diffs-tab
- = tab_link_for @merge_request, :diffs do
- Changes
- %span.badge.badge-pill= @merge_request.diff_size
+ %ul.merge-request-tabs.nav-tabs.nav.nav-links.scrolling-tabs
+ %li.notes-tab
+ = tab_link_for @merge_request, :show, force_link: @commit.present? do
+ Discussion
+ %span.badge.badge-pill= @merge_request.related_notes.user.count
+ - if @merge_request.source_project
+ %li.commits-tab
+ = tab_link_for @merge_request, :commits do
+ Commits
+ %span.badge.badge-pill= @commits_count
+ - if @pipelines.any?
+ %li.pipelines-tab
+ = tab_link_for @merge_request, :pipelines do
+ Pipelines
+ %span.badge.badge-pill.js-pipelines-mr-count= @pipelines.size
+ %li.diffs-tab
+ = tab_link_for @merge_request, :diffs do
+ Changes
+ %span.badge.badge-pill= @merge_request.diff_size
- if has_vue_discussions_cookie?
#js-vue-discussion-counter
diff --git a/app/views/projects/project_members/_team.html.haml b/app/views/projects/project_members/_team.html.haml
index a30870a241c..0c5a187f208 100644
--- a/app/views/projects/project_members/_team.html.haml
+++ b/app/views/projects/project_members/_team.html.haml
@@ -9,9 +9,10 @@
%span.badge.badge-pill= members.total_count
= form_tag project_project_members_path(project), method: :get, class: 'form-inline member-search-form flex-project-members-form' do
.form-group
- = search_field_tag :search, params[:search], { placeholder: 'Find existing members by name', class: 'form-control', spellcheck: false }
- %button.member-search-btn{ type: "submit", "aria-label" => "Submit search" }
- = icon("search")
+ .position-relative
+ = search_field_tag :search, params[:search], { placeholder: 'Find existing members by name', class: 'form-control', spellcheck: false }
+ %button.member-search-btn{ type: "submit", "aria-label" => "Submit search" }
+ = icon("search")
= render 'shared/members/sort_dropdown'
%ul.content-list.members-list
= render partial: 'shared/members/member', collection: members, as: :member
diff --git a/app/views/users/terms/index.html.haml b/app/views/users/terms/index.html.haml
index 33cddf63952..a869cf9cdee 100644
--- a/app/views/users/terms/index.html.haml
+++ b/app/views/users/terms/index.html.haml
@@ -2,16 +2,17 @@
.card-body.rendered-terms
= markdown_field(@term, :terms)
-.card-footer.footer-block.clearfix
- - if can?(current_user, :accept_terms, @term)
- .float-right
- = button_to accept_term_path(@term, redirect_params), class: 'btn btn-success prepend-left-8' do
- = _('Accept terms')
- - else
- .pull-right
- = link_to root_path, class: 'btn btn-success prepend-left-8' do
- = _('Continue')
- - if can?(current_user, :decline_terms, @term)
- .float-right
- = button_to decline_term_path(@term, redirect_params), class: 'btn btn-default prepend-left-8' do
- = _('Decline and sign out')
+- if current_user
+ .card-footer.footer-block.clearfix
+ - if can?(current_user, :accept_terms, @term)
+ .float-right
+ = button_to accept_term_path(@term, redirect_params), class: 'btn btn-success prepend-left-8' do
+ = _('Accept terms')
+ - else
+ .pull-right
+ = link_to root_path, class: 'btn btn-success prepend-left-8' do
+ = _('Continue')
+ - if can?(current_user, :decline_terms, @term)
+ .float-right
+ = button_to decline_term_path(@term, redirect_params), class: 'btn btn-default prepend-left-8' do
+ = _('Decline and sign out')
diff --git a/changelogs/unreleased/bvl-terms-on-registration.yml b/changelogs/unreleased/bvl-terms-on-registration.yml
new file mode 100644
index 00000000000..3e6e499dd02
--- /dev/null
+++ b/changelogs/unreleased/bvl-terms-on-registration.yml
@@ -0,0 +1,5 @@
+---
+title: Users can accept terms during registration
+merge_request: 19583
+author:
+type: other
diff --git a/changelogs/unreleased/fj-restore-users-v3-endpoint.yml b/changelogs/unreleased/fj-restore-users-v3-endpoint.yml
new file mode 100644
index 00000000000..c5f952dfa88
--- /dev/null
+++ b/changelogs/unreleased/fj-restore-users-v3-endpoint.yml
@@ -0,0 +1,5 @@
+---
+title: Restore API v3 user endpoint
+merge_request:
+author:
+type: changed
diff --git a/doc/user/admin_area/settings/img/enforce_terms.png b/doc/user/admin_area/settings/img/enforce_terms.png
index e5f0a2683b5..3d93e1cc891 100644
--- a/doc/user/admin_area/settings/img/enforce_terms.png
+++ b/doc/user/admin_area/settings/img/enforce_terms.png
Binary files differ
diff --git a/doc/user/admin_area/settings/img/sign_up_terms.png b/doc/user/admin_area/settings/img/sign_up_terms.png
new file mode 100644
index 00000000000..4cac9d426c9
--- /dev/null
+++ b/doc/user/admin_area/settings/img/sign_up_terms.png
Binary files differ
diff --git a/doc/user/admin_area/settings/terms.md b/doc/user/admin_area/settings/terms.md
index 8e1fb982aba..aa817c9a209 100644
--- a/doc/user/admin_area/settings/terms.md
+++ b/doc/user/admin_area/settings/terms.md
@@ -20,6 +20,19 @@ When an admin enables this feature, they will automattically be
directed to the page to accept the terms themselves. After they
accept, they will be directed back to the settings page.
+## New registrations
+
+When this feature is enabled, a checkbox will be available in the
+sign-up form.
+
+![Sign up form](img/sign_up_terms.png)
+
+This checkbox will be required during sign up.
+
+Users can review the terms entered in the admin panel before
+accepting. The page will be opened in a new window so they can
+continue their registration afterwards.
+
## Accepting terms
When this feature was enabled, the users that have not accepted the
diff --git a/doc/user/project/issue_board.md b/doc/user/project/issue_board.md
index 7eab825fa32..aa2fcd82787 100644
--- a/doc/user/project/issue_board.md
+++ b/doc/user/project/issue_board.md
@@ -237,13 +237,15 @@ Issue Board, that is create/delete lists and drag issues around.
## Group Issue Board
->Introduced in GitLab 10.6
+> Introduced in [GitLab 10.6](https://about.gitlab.com/2018/03/22/gitlab-10-6-released/#single-group-issue-board-in-core-and-free)
Group issue board is analogous to project-level issue board and it is accessible at the group
navigation level. A group-level issue board allows you to view all issues from all projects in that group or descendant subgroups. Similarly, you can only filter by group labels for these
boards. When updating milestones and labels for an issue through the sidebar update mechanism, again only
group-level objects are available.
+One group issue board per group was made available in GitLab 10.6 Core after multiple group issue boards were originally introduced in [GitLab 10.0 Premium](https://about.gitlab.com/2017/09/22/gitlab-10-0-released/#group-issue-boards).
+
## Features per tier
Different issue board features are available in different [GitLab tiers](https://about.gitlab.com/pricing/), as shown in the following table:
diff --git a/doc/user/project/web_ide/index.md b/doc/user/project/web_ide/index.md
index 105d8a6ab61..b0143e45ab6 100644
--- a/doc/user/project/web_ide/index.md
+++ b/doc/user/project/web_ide/index.md
@@ -42,5 +42,26 @@ list.
An additional review mode is available when you open a merge request, which
shows you a preview of the merge request diff if you commit your changes.
+## View CI job logs
+
+> [Introduced in](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19279) [GitLab Core][ce] 11.0.
+
+The Web IDE can be used to quickly fix failing tests by opening the branch or
+merge request in the Web IDE and opening the logs of the failed job. The status
+of all jobs for the most recent pipeline and job traces for the current commit
+can be accessed by clicking the **Pipelines** button in the top right.
+
+The pipeline status is also shown at all times in the status bar in the bottom
+left.
+
+## Switching merge requests
+
+> [Introduced in](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19318) [GitLab Core][ce] 11.0.
+
+Switching between your authored and assigned merge requests can be done without
+leaving the Web IDE. Click the project name in the top left to open a list of
+merge requests. You will need to commit or discard all your changes before
+switching to a different merge request.
+
[ce]: https://about.gitlab.com/pricing/
[ee]: https://about.gitlab.com/pricing/
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 22afcb9edf2..3c9c87ac1c4 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -412,6 +412,10 @@ module API
expose :state, :created_at, :updated_at
expose :due_date
expose :start_date
+
+ expose :web_url do |milestone, _options|
+ Gitlab::UrlBuilder.build(milestone)
+ end
end
class IssueBasic < ProjectEntity
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 14b8a796c8e..e8df2c5a74a 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -531,18 +531,22 @@ module API
authenticate!
end
- desc 'Get the currently authenticated user' do
- success Entities::UserPublic
- end
- get do
- entity =
- if current_user.admin?
- Entities::UserWithAdmin
- else
- Entities::UserPublic
- end
+ # Enabling /user endpoint for the v3 version to allow oauth
+ # authentication through this endpoint.
+ version %w(v3 v4), using: :path do
+ desc 'Get the currently authenticated user' do
+ success Entities::UserPublic
+ end
+ get do
+ entity =
+ if current_user.admin?
+ Entities::UserWithAdmin
+ else
+ Entities::UserPublic
+ end
- present current_user, with: entity
+ present current_user, with: entity
+ end
end
desc "Get the currently authenticated user's SSH keys" do
diff --git a/lib/banzai/filter/milestone_reference_filter.rb b/lib/banzai/filter/milestone_reference_filter.rb
index b144bd8cf54..858e790005c 100644
--- a/lib/banzai/filter/milestone_reference_filter.rb
+++ b/lib/banzai/filter/milestone_reference_filter.rb
@@ -65,7 +65,7 @@ module Banzai
# We don't support IID lookups for group milestones, because IIDs can
# clash between group and project milestones.
if project.group && !params[:iid]
- finder_params[:group_ids] = [project.group.id]
+ finder_params[:group_ids] = project.group.self_and_ancestors.select(:id)
end
MilestonesFinder.new(finder_params).find_by(params)
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
index 824e2d7251f..e64033b0dba 100644
--- a/lib/gitlab/url_builder.rb
+++ b/lib/gitlab/url_builder.rb
@@ -26,6 +26,8 @@ module Gitlab
project_snippet_url(object.project, object)
when Snippet
snippet_url(object)
+ when Milestone
+ milestone_url(object)
else
raise NotImplementedError.new("No URL builder defined for #{object.class}")
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index bf0214401ef..8eff9b0d77a 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-05-29 09:43-0500\n"
-"PO-Revision-Date: 2018-05-29 09:43-0500\n"
+"POT-Creation-Date: 2018-06-13 17:00+0100\n"
+"PO-Revision-Date: 2018-06-13 17:00+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
@@ -370,7 +370,7 @@ msgstr ""
msgid "An error occurred while getting projects"
msgstr ""
-msgid "An error occurred while importing project"
+msgid "An error occurred while importing project: ${details}"
msgstr ""
msgid "An error occurred while loading commits"
@@ -463,6 +463,9 @@ msgstr ""
msgid "Assigned to :name"
msgstr ""
+msgid "Assigned to me"
+msgstr ""
+
msgid "Assignee"
msgstr ""
@@ -616,9 +619,6 @@ msgstr ""
msgid "Begin with the selected commit"
msgstr ""
-msgid "Blame"
-msgstr ""
-
msgid "Branch (%{branch_count})"
msgid_plural "Branches (%{branch_count})"
msgstr[0] ""
@@ -780,9 +780,6 @@ msgstr ""
msgid "CI/CD settings"
msgstr ""
-msgid "CICD|A domain is required to use Auto Review Apps and Auto Deploy Stages."
-msgstr ""
-
msgid "CICD|An explicit %{ci_file} needs to be specified before you can begin using Continuous Integration and Delivery."
msgstr ""
@@ -792,6 +789,18 @@ msgstr ""
msgid "CICD|Auto DevOps will automatically build, test, and deploy your application based on a predefined Continuous Integration and Delivery configuration."
msgstr ""
+msgid "CICD|Automatic deployment to staging, manual deployment to production"
+msgstr ""
+
+msgid "CICD|Continuous deployment to production"
+msgstr ""
+
+msgid "CICD|Deployment strategy"
+msgstr ""
+
+msgid "CICD|Deployment strategy needs a domain name to work correctly."
+msgstr ""
+
msgid "CICD|Disable Auto DevOps"
msgstr ""
@@ -813,6 +822,9 @@ msgstr ""
msgid "CICD|The Auto DevOps pipeline configuration will be used when there is no %{ci_file} in the project."
msgstr ""
+msgid "CICD|You need to specify a domain if you want to use Auto Review Apps and Auto Deploy stages."
+msgstr ""
+
msgid "Can run untagged jobs"
msgstr ""
@@ -1041,6 +1053,9 @@ msgstr ""
msgid "ClusterIntegration|Copy Ingress IP Address to clipboard"
msgstr ""
+msgid "ClusterIntegration|Copy Jupyter Hostname to clipboard"
+msgstr ""
+
msgid "ClusterIntegration|Copy Kubernetes cluster name"
msgstr ""
@@ -1119,6 +1134,12 @@ msgstr ""
msgid "ClusterIntegration|Integration status"
msgstr ""
+msgid "ClusterIntegration|Jupyter Hostname"
+msgstr ""
+
+msgid "ClusterIntegration|JupyterHub"
+msgstr ""
+
msgid "ClusterIntegration|Kubernetes cluster"
msgstr ""
@@ -1519,6 +1540,9 @@ msgstr ""
msgid "ContainerRegistry|You can also use a %{deploy_token} for read-only access to the registry images."
msgstr ""
+msgid "Continue"
+msgstr ""
+
msgid "Continuous Integration and Deployment"
msgstr ""
@@ -1558,6 +1582,9 @@ msgstr ""
msgid "Copy reference to clipboard"
msgstr ""
+msgid "Copy to clipboard"
+msgstr ""
+
msgid "Create"
msgstr ""
@@ -1627,6 +1654,9 @@ msgstr ""
msgid "Created"
msgstr ""
+msgid "Created by me"
+msgstr ""
+
msgid "Cron Timezone"
msgstr ""
@@ -1818,6 +1848,9 @@ msgstr ""
msgid "DeployTokens|Your new project deploy token has been created."
msgstr ""
+msgid "Deprioritize label"
+msgstr ""
+
msgid "Description"
msgstr ""
@@ -2010,6 +2043,9 @@ msgstr ""
msgid "Error fetching contributors data."
msgstr ""
+msgid "Error fetching job trace"
+msgstr ""
+
msgid "Error fetching labels."
msgstr ""
@@ -2028,6 +2064,9 @@ msgstr ""
msgid "Error loading last commit."
msgstr ""
+msgid "Error loading merge requests."
+msgstr ""
+
msgid "Error loading project data. Please try again."
msgstr ""
@@ -2106,6 +2145,9 @@ msgstr ""
msgid "Failed to update issues, please try again."
msgstr ""
+msgid "Failure"
+msgstr ""
+
msgid "Feb"
msgstr ""
@@ -2156,6 +2198,9 @@ msgstr ""
msgid "Format"
msgstr ""
+msgid "Found errors in your .gitlab-ci.yml:"
+msgstr ""
+
msgid "From %{provider_title}"
msgstr ""
@@ -2204,10 +2249,10 @@ msgstr ""
msgid "Gitaly"
msgstr ""
-msgid "Gitaly|Address"
+msgid "Gitaly Servers"
msgstr ""
-msgid "Gitaly Servers"
+msgid "Gitaly|Address"
msgstr ""
msgid "Go Back"
@@ -2344,6 +2389,12 @@ msgstr ""
msgid "Housekeeping successfully started"
msgstr ""
+msgid "I accept the %{terms_link}"
+msgstr ""
+
+msgid "I accept the|Terms of Service and Privacy Policy"
+msgstr ""
+
msgid "IDE|Commit"
msgstr ""
@@ -2353,6 +2404,9 @@ msgstr ""
msgid "IDE|Go back"
msgstr ""
+msgid "IDE|Open in file view"
+msgstr ""
+
msgid "IDE|Review"
msgstr ""
@@ -2377,7 +2431,7 @@ msgstr ""
msgid "Import repository"
msgstr ""
-msgid "Include a Terms of Service agreement that all users must accept."
+msgid "Include a Terms of Service agreement and Privacy Policy that all users must accept."
msgstr ""
msgid "Install Runner on Kubernetes"
@@ -2479,6 +2533,9 @@ msgstr ""
msgid "Label"
msgstr ""
+msgid "Label actions dropdown"
+msgstr ""
+
msgid "LabelSelect|%{firstLabelName} +%{remainingLabelCount} more"
msgstr ""
@@ -2494,6 +2551,9 @@ msgstr ""
msgid "Labels can be applied to issues and merge requests to categorize them."
msgstr ""
+msgid "Labels can be applied to issues and merge requests."
+msgstr ""
+
msgid "Labels|<span>Promote label</span> %{labelTitle} <span>to Group Label?</span>"
msgstr ""
@@ -2804,7 +2864,10 @@ msgstr ""
msgid "No files found."
msgstr ""
-msgid "No labels created yet."
+msgid "No merge requests found"
+msgstr ""
+
+msgid "No messages were logged"
msgstr ""
msgid "No repository"
@@ -2930,6 +2993,9 @@ msgstr ""
msgid "Only project members can comment."
msgstr ""
+msgid "Open in Xcode"
+msgstr ""
+
msgid "OpenedNDaysAgo|Opened"
msgstr ""
@@ -2942,6 +3008,9 @@ msgstr ""
msgid "Options"
msgstr ""
+msgid "Other Labels"
+msgstr ""
+
msgid "Otherwise it is recommended you start with one of the options below."
msgstr ""
@@ -2987,9 +3056,6 @@ msgstr ""
msgid "Performance optimization"
msgstr ""
-msgid "Permalink"
-msgstr ""
-
msgid "Permissions"
msgstr ""
@@ -3167,6 +3233,21 @@ msgstr ""
msgid "Preferences"
msgstr ""
+msgid "Preferences|Navigation theme"
+msgstr ""
+
+msgid "Prioritize"
+msgstr ""
+
+msgid "Prioritize label"
+msgstr ""
+
+msgid "Prioritized Labels"
+msgstr ""
+
+msgid "Prioritized label"
+msgstr ""
+
msgid "Private - Project access must be granted explicitly to each user."
msgstr ""
@@ -3392,10 +3473,10 @@ msgstr ""
msgid "Promote these project milestones into a group milestone."
msgstr ""
-msgid "Promote to Group Label"
+msgid "Promote to Group Milestone"
msgstr ""
-msgid "Promote to Group Milestone"
+msgid "Promote to group label"
msgstr ""
msgid "Protip:"
@@ -3419,9 +3500,6 @@ msgstr ""
msgid "Quick actions can be used in the issues description and comment boxes."
msgstr ""
-msgid "Raw"
-msgstr ""
-
msgid "Read more"
msgstr ""
@@ -3482,6 +3560,9 @@ msgstr ""
msgid "Remove avatar"
msgstr ""
+msgid "Remove priority"
+msgstr ""
+
msgid "Remove project"
msgstr ""
@@ -3500,7 +3581,7 @@ msgstr ""
msgid "Request Access"
msgstr ""
-msgid "Require all users to accept Terms of Service when they access GitLab."
+msgid "Require all users to accept Terms of Service and Privacy Policy when they access GitLab."
msgstr ""
msgid "Reset git storage health information"
@@ -3589,6 +3670,12 @@ msgstr ""
msgid "Scheduling Pipelines"
msgstr ""
+msgid "Scroll to bottom"
+msgstr ""
+
+msgid "Scroll to top"
+msgstr ""
+
msgid "Search"
msgstr ""
@@ -3604,6 +3691,9 @@ msgstr ""
msgid "Search for projects, issues, etc."
msgstr ""
+msgid "Search merge requests"
+msgstr ""
+
msgid "Search milestones"
msgstr ""
@@ -3712,6 +3802,9 @@ msgstr ""
msgid "Show command"
msgstr ""
+msgid "Show complete raw log"
+msgstr ""
+
msgid "Show parent pages"
msgstr ""
@@ -3747,9 +3840,6 @@ msgstr ""
msgid "Something went wrong when toggling the button"
msgstr ""
-msgid "Something went wrong while fetching the latest pipeline status."
-msgstr ""
-
msgid "Something went wrong while fetching the projects."
msgstr ""
@@ -3873,6 +3963,12 @@ msgstr ""
msgid "Specify the following URL during the Runner setup:"
msgstr ""
+msgid "Squash commits"
+msgstr ""
+
+msgid "Stage"
+msgstr ""
+
msgid "Stage all"
msgstr ""
@@ -3885,6 +3981,9 @@ msgstr ""
msgid "Staged %{type}"
msgstr ""
+msgid "Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging."
+msgstr ""
+
msgid "StarProject|Star"
msgstr ""
@@ -3924,6 +4023,15 @@ msgstr ""
msgid "Subgroups"
msgstr ""
+msgid "Subscribe"
+msgstr ""
+
+msgid "Subscribe at group level"
+msgstr ""
+
+msgid "Subscribe at project level"
+msgstr ""
+
msgid "Switch branch/tag"
msgstr ""
@@ -4019,10 +4127,10 @@ msgstr ""
msgid "Team"
msgstr ""
-msgid "Terms of Service"
+msgid "Terms of Service Agreement and Privacy Policy"
msgstr ""
-msgid "Terms of Service Agreement"
+msgid "Terms of Service and Privacy Policy"
msgstr ""
msgid "The Issue Tracker is the place to add things that need to be improved or solved in a project"
@@ -4250,6 +4358,9 @@ msgstr ""
msgid "Timeago|%s days remaining"
msgstr ""
+msgid "Timeago|%s hours ago"
+msgstr ""
+
msgid "Timeago|%s hours remaining"
msgstr ""
@@ -4265,6 +4376,9 @@ msgstr ""
msgid "Timeago|%s months remaining"
msgstr ""
+msgid "Timeago|%s seconds ago"
+msgstr ""
+
msgid "Timeago|%s seconds remaining"
msgstr ""
@@ -4280,46 +4394,43 @@ msgstr ""
msgid "Timeago|%s years remaining"
msgstr ""
-msgid "Timeago|1 day remaining"
+msgid "Timeago|1 day ago"
msgstr ""
-msgid "Timeago|1 hour remaining"
-msgstr ""
-
-msgid "Timeago|1 minute remaining"
+msgid "Timeago|1 day remaining"
msgstr ""
-msgid "Timeago|1 month remaining"
+msgid "Timeago|1 hour ago"
msgstr ""
-msgid "Timeago|1 week remaining"
+msgid "Timeago|1 hour remaining"
msgstr ""
-msgid "Timeago|1 year remaining"
+msgid "Timeago|1 minute ago"
msgstr ""
-msgid "Timeago|Past due"
+msgid "Timeago|1 minute remaining"
msgstr ""
-msgid "Timeago|a day ago"
+msgid "Timeago|1 month ago"
msgstr ""
-msgid "Timeago|a month ago"
+msgid "Timeago|1 month remaining"
msgstr ""
-msgid "Timeago|a week ago"
+msgid "Timeago|1 week ago"
msgstr ""
-msgid "Timeago|a year ago"
+msgid "Timeago|1 week remaining"
msgstr ""
-msgid "Timeago|about %s hours ago"
+msgid "Timeago|1 year ago"
msgstr ""
-msgid "Timeago|about a minute ago"
+msgid "Timeago|1 year remaining"
msgstr ""
-msgid "Timeago|about an hour ago"
+msgid "Timeago|Past due"
msgstr ""
msgid "Timeago|in %s days"
@@ -4361,7 +4472,7 @@ msgstr ""
msgid "Timeago|in 1 year"
msgstr ""
-msgid "Timeago|less than a minute ago"
+msgid "Timeago|just now"
msgstr ""
msgid "Timeago|right now"
@@ -4467,6 +4578,15 @@ msgstr ""
msgid "Unstar"
msgstr ""
+msgid "Unsubscribe"
+msgstr ""
+
+msgid "Unsubscribe at group level"
+msgstr ""
+
+msgid "Unsubscribe at project level"
+msgstr ""
+
msgid "Unverified"
msgstr ""
@@ -4530,9 +4650,15 @@ msgstr ""
msgid "View group labels"
msgstr ""
+msgid "View jobs"
+msgstr ""
+
msgid "View labels"
msgstr ""
+msgid "View log"
+msgstr ""
+
msgid "View open merge request"
msgstr ""
@@ -4743,6 +4869,9 @@ msgstr ""
msgid "You can also star a label to make it a priority label."
msgstr ""
+msgid "You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}"
+msgstr ""
+
msgid "You can easily install a Runner on a Kubernetes cluster. %{link_to_help_page}"
msgstr ""
@@ -4761,12 +4890,21 @@ msgstr ""
msgid "You cannot write to this read-only GitLab instance."
msgstr ""
+msgid "You do not have any assigned merge requests"
+msgstr ""
+
msgid "You have no permissions"
msgstr ""
+msgid "You have not created any merge requests"
+msgstr ""
+
msgid "You have reached your project limit"
msgstr ""
+msgid "You must accept our Terms of Service and privacy policy in order to register an account"
+msgstr ""
+
msgid "You must have maintainer access to force delete a lock"
msgstr ""
@@ -5096,3 +5234,8 @@ msgstr ""
msgid "with %{additions} additions, %{deletions} deletions."
msgstr ""
+
+msgid "within %d minute "
+msgid_plural "within %d minutes "
+msgstr[0] ""
+msgstr[1] ""
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index 346944fd5b0..898f3863008 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe RegistrationsController do
+ include TermsHelper
+
describe '#create' do
let(:user_params) { { user: { name: 'new_user', username: 'new_username', email: 'new@user.com', password: 'Any_password' } } }
@@ -67,6 +69,25 @@ describe RegistrationsController do
expect(flash[:notice]).to include 'Welcome! You have signed up successfully.'
end
end
+
+ context 'when terms are enforced' do
+ before do
+ enforce_terms
+ end
+
+ it 'redirects back with a notice when the checkbox was not checked' do
+ post :create, user_params
+
+ expect(flash[:alert]).to match /you must accept our terms/i
+ end
+
+ it 'creates the user with agreement when terms are accepted' do
+ post :create, user_params.merge(terms_opt_in: '1')
+
+ expect(subject.current_user).to be_present
+ expect(subject.current_user.terms_accepted?).to be(true)
+ end
+ end
end
describe '#destroy' do
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index dc025d82937..e7aca94db66 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -94,7 +94,7 @@ feature 'Admin updates settings' do
accept_terms(admin)
page.within('.as-terms') do
- check 'Require all users to accept Terms of Service when they access GitLab.'
+ check 'Require all users to accept Terms of Service and Privacy Policy when they access GitLab.'
fill_in 'Terms of Service Agreement', with: 'Be nice!'
click_button 'Save changes'
end
diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb
index b5bd5c505f2..b51ca5d130b 100644
--- a/spec/features/users/signup_spec.rb
+++ b/spec/features/users/signup_spec.rb
@@ -140,7 +140,7 @@ describe 'Signup' do
enforce_terms
end
- it 'asks the user to accept terms before going to the dashboard' do
+ it 'requires the user to check the checkbox' do
visit root_path
fill_in 'new_user_name', with: new_user.name
@@ -148,11 +148,24 @@ describe 'Signup' do
fill_in 'new_user_email', with: new_user.email
fill_in 'new_user_email_confirmation', with: new_user.email
fill_in 'new_user_password', with: new_user.password
- click_button "Register"
- expect_to_be_on_terms_page
+ click_button 'Register'
+
+ expect(current_path).to eq new_user_session_path
+ expect(page).to have_content(/you must accept our terms of service/i)
+ end
+
+ it 'asks the user to accept terms before going to the dashboard' do
+ visit root_path
+
+ fill_in 'new_user_name', with: new_user.name
+ fill_in 'new_user_username', with: new_user.username
+ fill_in 'new_user_email', with: new_user.email
+ fill_in 'new_user_email_confirmation', with: new_user.email
+ fill_in 'new_user_password', with: new_user.password
+ check :terms_opt_in
- click_button 'Accept terms'
+ click_button "Register"
expect(current_path).to eq dashboard_projects_path
end
diff --git a/spec/features/users/terms_spec.rb b/spec/features/users/terms_spec.rb
index af407c52917..5b2e7605c4d 100644
--- a/spec/features/users/terms_spec.rb
+++ b/spec/features/users/terms_spec.rb
@@ -3,12 +3,10 @@ require 'spec_helper'
describe 'Users > Terms' do
include TermsHelper
- let(:user) { create(:user) }
let!(:term) { create(:term, terms: 'By accepting, you promise to be nice!') }
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
- sign_in(user)
end
it 'shows the terms' do
@@ -17,102 +15,119 @@ describe 'Users > Terms' do
expect(page).to have_content('By accepting, you promise to be nice!')
end
- context 'declining the terms' do
- it 'returns the user to the app' do
- visit terms_path
+ it 'does not show buttons to accept, decline or sign out', :aggregate_failures do
+ visit terms_path
+
+ expect(page).not_to have_css('.footer-block')
+ expect(page).not_to have_content('Accept terms')
+ expect(page).not_to have_content('Decline and sign out')
+ expect(page).not_to have_content('Continue')
+ end
- click_button 'Decline and sign out'
+ context 'when signed in' do
+ let(:user) { create(:user) }
- expect(page).not_to have_content(term.terms)
- expect(user.reload.terms_accepted?).to be(false)
+ before do
+ sign_in(user)
end
- end
- context 'accepting the terms' do
- it 'returns the user to the app' do
- visit terms_path
+ context 'declining the terms' do
+ it 'returns the user to the app' do
+ visit terms_path
- click_button 'Accept terms'
+ click_button 'Decline and sign out'
- expect(page).not_to have_content(term.terms)
- expect(user.reload.terms_accepted?).to be(true)
+ expect(page).not_to have_content(term.terms)
+ expect(user.reload.terms_accepted?).to be(false)
+ end
end
- end
- context 'when the user has already accepted the terms' do
- before do
- accept_terms(user)
+ context 'accepting the terms' do
+ it 'returns the user to the app' do
+ visit terms_path
+
+ click_button 'Accept terms'
+
+ expect(page).not_to have_content(term.terms)
+ expect(user.reload.terms_accepted?).to be(true)
+ end
end
- it 'allows the user to continue to the app' do
- visit terms_path
+ context 'when the user has already accepted the terms' do
+ before do
+ accept_terms(user)
+ end
+
+ it 'allows the user to continue to the app' do
+ visit terms_path
- expect(page).to have_content "You have already accepted the Terms of Service as #{user.to_reference}"
+ expect(page).to have_content "You have already accepted the Terms of Service as #{user.to_reference}"
- click_link 'Continue'
+ click_link 'Continue'
- expect(current_path).to eq(root_path)
+ expect(current_path).to eq(root_path)
+ end
end
- end
- context 'terms were enforced while session is active', :js do
- let(:project) { create(:project) }
+ context 'terms were enforced while session is active', :js do
+ let(:project) { create(:project) }
- before do
- project.add_developer(user)
- end
+ before do
+ project.add_developer(user)
+ end
- it 'redirects to terms and back to where the user was going' do
- visit project_path(project)
+ it 'redirects to terms and back to where the user was going' do
+ visit project_path(project)
- enforce_terms
+ enforce_terms
- within('.nav-sidebar') do
- click_link 'Issues'
- end
+ within('.nav-sidebar') do
+ click_link 'Issues'
+ end
- expect_to_be_on_terms_page
+ expect_to_be_on_terms_page
- click_button('Accept terms')
+ click_button('Accept terms')
- expect(current_path).to eq(project_issues_path(project))
- end
+ expect(current_path).to eq(project_issues_path(project))
+ end
- # Disabled until https://gitlab.com/gitlab-org/gitlab-ce/issues/37162 is solved properly
- xit 'redirects back to the page the user was trying to save' do
- visit new_project_issue_path(project)
+ # Disabled until https://gitlab.com/gitlab-org/gitlab-ce/issues/37162 is solved properly
+ xit 'redirects back to the page the user was trying to save' do
+ visit new_project_issue_path(project)
- fill_in :issue_title, with: 'Hello world, a new issue'
- fill_in :issue_description, with: "We don't want to lose what the user typed"
+ fill_in :issue_title, with: 'Hello world, a new issue'
+ fill_in :issue_description, with: "We don't want to lose what the user typed"
- enforce_terms
+ enforce_terms
- click_button 'Submit issue'
+ click_button 'Submit issue'
- expect(current_path).to eq(terms_path)
+ expect(current_path).to eq(terms_path)
- click_button('Accept terms')
+ click_button('Accept terms')
- expect(current_path).to eq(new_project_issue_path(project))
- expect(find_field('issue_title').value).to eq('Hello world, a new issue')
- expect(find_field('issue_description').value).to eq("We don't want to lose what the user typed")
+ expect(current_path).to eq(new_project_issue_path(project))
+ expect(find_field('issue_title').value).to eq('Hello world, a new issue')
+ expect(find_field('issue_description').value).to eq("We don't want to lose what the user typed")
+ end
end
- end
- context 'when the terms are enforced' do
- before do
- enforce_terms
- end
+ context 'when the terms are enforced' do
+ before do
+ enforce_terms
+ end
- context 'signing out', :js do
- it 'allows the user to sign out without a response' do
- visit terms_path
+ context 'signing out', :js do
+ it 'allows the user to sign out without a response' do
+ visit terms_path
- find('.header-user-dropdown-toggle').click
- click_link('Sign out')
+ find('.header-user-dropdown-toggle').click
+ click_link('Sign out')
- expect(page).to have_content('Sign in')
- expect(page).to have_content('Register')
+ expect(page).to have_content('Sign in')
+ expect(page).to have_content('Register')
+ end
end
end
end
diff --git a/spec/fixtures/api/schemas/public_api/v4/milestones.json b/spec/fixtures/api/schemas/public_api/v4/milestones.json
index c3c42b6ee60..448e97d6c85 100644
--- a/spec/fixtures/api/schemas/public_api/v4/milestones.json
+++ b/spec/fixtures/api/schemas/public_api/v4/milestones.json
@@ -13,7 +13,8 @@
"created_at": { "type": "date" },
"updated_at": { "type": "date" },
"start_date": { "type": "date" },
- "due_date": { "type": "date" }
+ "due_date": { "type": "date" },
+ "web_url": { "type": "string" }
},
"required": [
"id", "iid", "title", "description", "state",
diff --git a/spec/lib/banzai/filter/milestone_reference_filter_spec.rb b/spec/lib/banzai/filter/milestone_reference_filter_spec.rb
index f8fa9b2d13d..91d4a60ba95 100644
--- a/spec/lib/banzai/filter/milestone_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/milestone_reference_filter_spec.rb
@@ -3,7 +3,8 @@ require 'spec_helper'
describe Banzai::Filter::MilestoneReferenceFilter do
include FilterSpecHelper
- let(:group) { create(:group, :public) }
+ let(:parent_group) { create(:group, :public) }
+ let(:group) { create(:group, :public, parent: parent_group) }
let(:project) { create(:project, :public, group: group) }
it 'requires project context' do
@@ -340,6 +341,13 @@ describe Banzai::Filter::MilestoneReferenceFilter do
expect(doc.css('a')).to be_empty
end
+
+ it 'supports parent group references', :nested_groups do
+ milestone.update!(group: parent_group)
+
+ doc = reference_filter("See #{reference}")
+ expect(doc.css('a').first.text).to eq(milestone.name)
+ end
end
context 'group context' do
diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb
index b81749cf428..9f495a5d50b 100644
--- a/spec/lib/gitlab/url_builder_spec.rb
+++ b/spec/lib/gitlab/url_builder_spec.rb
@@ -22,6 +22,31 @@ describe Gitlab::UrlBuilder do
end
end
+ context 'when passing a Milestone' do
+ let(:group) { create(:group) }
+ let(:project) { create(:project, :public, namespace: group) }
+
+ context 'belonging to a project' do
+ it 'returns a proper URL' do
+ milestone = create(:milestone, project: project)
+
+ url = described_class.build(milestone)
+
+ expect(url).to eq "#{Settings.gitlab['url']}/#{milestone.project.full_path}/milestones/#{milestone.iid}"
+ end
+ end
+
+ context 'belonging to a group' do
+ it 'returns a proper URL' do
+ milestone = create(:milestone, group: group)
+
+ url = described_class.build(milestone)
+
+ expect(url).to eq "#{Settings.gitlab['url']}/groups/#{milestone.group.full_path}/-/milestones/#{milestone.iid}"
+ end
+ end
+ end
+
context 'when passing a MergeRequest' do
it 'returns a proper URL' do
merge_request = build_stubbed(:merge_request, iid: 42)
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 05637eb0729..c7678fe1474 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -1123,58 +1123,63 @@ describe API::Users do
describe "GET /user" do
let(:personal_access_token) { create(:personal_access_token, user: user).token }
- context 'with regular user' do
- context 'with personal access token' do
- it 'returns 403 without private token when sudo is defined' do
- get api("/user?private_token=#{personal_access_token}&sudo=123")
+ shared_examples 'get user info' do |version|
+ context 'with regular user' do
+ context 'with personal access token' do
+ it 'returns 403 without private token when sudo is defined' do
+ get api("/user?private_token=#{personal_access_token}&sudo=123", version: version)
- expect(response).to have_gitlab_http_status(403)
+ expect(response).to have_gitlab_http_status(403)
+ end
end
- end
- it 'returns current user without private token when sudo not defined' do
- get api("/user", user)
+ it 'returns current user without private token when sudo not defined' do
+ get api("/user", user, version: version)
- expect(response).to have_gitlab_http_status(200)
- expect(response).to match_response_schema('public_api/v4/user/public')
- expect(json_response['id']).to eq(user.id)
- end
+ expect(response).to have_gitlab_http_status(200)
+ expect(response).to match_response_schema('public_api/v4/user/public')
+ expect(json_response['id']).to eq(user.id)
+ end
- context "scopes" do
- let(:path) { "/user" }
- let(:api_call) { method(:api) }
+ context "scopes" do
+ let(:path) { "/user" }
+ let(:api_call) { method(:api) }
- include_examples 'allows the "read_user" scope'
+ include_examples 'allows the "read_user" scope', version
+ end
end
- end
- context 'with admin' do
- let(:admin_personal_access_token) { create(:personal_access_token, user: admin).token }
+ context 'with admin' do
+ let(:admin_personal_access_token) { create(:personal_access_token, user: admin).token }
- context 'with personal access token' do
- it 'returns 403 without private token when sudo defined' do
- get api("/user?private_token=#{admin_personal_access_token}&sudo=#{user.id}")
+ context 'with personal access token' do
+ it 'returns 403 without private token when sudo defined' do
+ get api("/user?private_token=#{admin_personal_access_token}&sudo=#{user.id}", version: version)
- expect(response).to have_gitlab_http_status(403)
- end
+ expect(response).to have_gitlab_http_status(403)
+ end
- it 'returns initial current user without private token but with is_admin when sudo not defined' do
- get api("/user?private_token=#{admin_personal_access_token}")
+ it 'returns initial current user without private token but with is_admin when sudo not defined' do
+ get api("/user?private_token=#{admin_personal_access_token}", version: version)
- expect(response).to have_gitlab_http_status(200)
- expect(response).to match_response_schema('public_api/v4/user/admin')
- expect(json_response['id']).to eq(admin.id)
+ expect(response).to have_gitlab_http_status(200)
+ expect(response).to match_response_schema('public_api/v4/user/admin')
+ expect(json_response['id']).to eq(admin.id)
+ end
end
end
- end
- context 'with unauthenticated user' do
- it "returns 401 error if user is unauthenticated" do
- get api("/user")
+ context 'with unauthenticated user' do
+ it "returns 401 error if user is unauthenticated" do
+ get api("/user", version: version)
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(401)
+ end
end
end
+
+ it_behaves_like 'get user info', 'v3'
+ it_behaves_like 'get user info', 'v4'
end
describe "GET /user/keys" do
diff --git a/spec/support/api/scopes/read_user_shared_examples.rb b/spec/support/api/scopes/read_user_shared_examples.rb
index 06ae8792c61..d7cef137989 100644
--- a/spec/support/api/scopes/read_user_shared_examples.rb
+++ b/spec/support/api/scopes/read_user_shared_examples.rb
@@ -1,10 +1,12 @@
-shared_examples_for 'allows the "read_user" scope' do
+shared_examples_for 'allows the "read_user" scope' do |api_version|
+ let(:version) { api_version || 'v4' }
+
context 'for personal access tokens' do
context 'when the requesting token has the "api" scope' do
let(:token) { create(:personal_access_token, scopes: ['api'], user: user) }
it 'returns a "200" response' do
- get api_call.call(path, user, personal_access_token: token)
+ get api_call.call(path, user, personal_access_token: token, version: version)
expect(response).to have_gitlab_http_status(200)
end
@@ -14,7 +16,7 @@ shared_examples_for 'allows the "read_user" scope' do
let(:token) { create(:personal_access_token, scopes: ['read_user'], user: user) }
it 'returns a "200" response' do
- get api_call.call(path, user, personal_access_token: token)
+ get api_call.call(path, user, personal_access_token: token, version: version)
expect(response).to have_gitlab_http_status(200)
end
@@ -28,7 +30,7 @@ shared_examples_for 'allows the "read_user" scope' do
end
it 'returns a "403" response' do
- get api_call.call(path, user, personal_access_token: token)
+ get api_call.call(path, user, personal_access_token: token, version: version)
expect(response).to have_gitlab_http_status(403)
end