summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--Gemfile.rails5.lock4
-rw-r--r--app/assets/javascripts/issue_show/components/edited.vue2
-rw-r--r--app/assets/javascripts/notes/components/note_edited_text.vue2
-rw-r--r--app/assets/javascripts/sidebar/components/assignees/assignees.vue2
-rw-r--r--app/assets/javascripts/sidebar/components/participants/participants.vue2
-rw-r--r--app/assets/javascripts/users_select.js4
-rw-r--r--app/assets/stylesheets/framework/common.scss2
-rw-r--r--app/assets/stylesheets/framework/lists.scss4
-rw-r--r--app/assets/stylesheets/pages/detail_page.scss2
-rw-r--r--app/assets/stylesheets/pages/issuable.scss8
-rw-r--r--app/assets/stylesheets/pages/issues.scss2
-rw-r--r--app/assets/stylesheets/pages/notes.scss2
-rw-r--r--app/controllers/projects/wikis_controller.rb6
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/models/project_wiki.rb2
-rw-r--r--app/views/shared/notes/_notes_with_form.html.haml2
-rw-r--r--changelogs/unreleased/replace-snake-case-css-classes.yml5
-rw-r--r--changelogs/unreleased/sh-use-wiki-limit-parameter-gitaly.yml5
-rw-r--r--doc/administration/raketasks/check.md39
-rw-r--r--doc/api/users.md4
-rw-r--r--doc/ci/docker/using_docker_build.md10
-rw-r--r--generator_templates/active_record/migration/create_table_migration.rb2
-rw-r--r--generator_templates/active_record/migration/migration.rb2
-rw-r--r--generator_templates/rails/post_deployment_migration/migration.rb2
-rw-r--r--lib/gitlab/git/wiki.rb8
-rw-r--r--lib/gitlab/gitaly_client/wiki_service.rb4
-rw-r--r--lib/support/nginx/registry-ssl2
-rw-r--r--spec/controllers/projects/wikis_controller_spec.rb37
-rw-r--r--spec/features/issues/update_issues_spec.rb4
-rw-r--r--spec/features/merge_requests/user_mass_updates_spec.rb4
-rw-r--r--spec/javascripts/issue_show/components/app_spec.js4
-rw-r--r--spec/javascripts/issue_show/components/edited_spec.js6
-rw-r--r--spec/javascripts/sidebar/assignees_spec.js8
-rw-r--r--spec/lib/gitlab/git/wiki_spec.rb25
-rw-r--r--spec/lib/gitlab/gitaly_client/wiki_service_spec.rb22
37 files changed, 195 insertions, 54 deletions
diff --git a/Gemfile b/Gemfile
index 47815f230d3..74e9625d57b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -422,7 +422,7 @@ group :ed25519 do
end
# Gitaly GRPC client
-gem 'gitaly-proto', '~> 0.106.0', require: 'gitaly'
+gem 'gitaly-proto', '~> 0.109.0', require: 'gitaly'
gem 'grpc', '~> 1.11.0'
# Locked until https://github.com/google/protobuf/issues/4210 is closed
diff --git a/Gemfile.lock b/Gemfile.lock
index 22626c0071b..251e3c22397 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -284,7 +284,7 @@ GEM
gettext_i18n_rails (>= 0.7.1)
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
- gitaly-proto (0.106.0)
+ gitaly-proto (0.109.0)
google-protobuf (~> 3.1)
grpc (~> 1.10)
github-linguist (5.3.3)
@@ -1042,7 +1042,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
- gitaly-proto (~> 0.106.0)
+ gitaly-proto (~> 0.109.0)
github-linguist (~> 5.3.3)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-gollum-lib (~> 4.2)
diff --git a/Gemfile.rails5.lock b/Gemfile.rails5.lock
index 5a0aaf05608..8c14316a67a 100644
--- a/Gemfile.rails5.lock
+++ b/Gemfile.rails5.lock
@@ -287,7 +287,7 @@ GEM
gettext_i18n_rails (>= 0.7.1)
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
- gitaly-proto (0.106.0)
+ gitaly-proto (0.109.0)
google-protobuf (~> 3.1)
grpc (~> 1.10)
github-linguist (5.3.3)
@@ -1052,7 +1052,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
- gitaly-proto (~> 0.106.0)
+ gitaly-proto (~> 0.109.0)
github-linguist (~> 5.3.3)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-gollum-lib (~> 4.2)
diff --git a/app/assets/javascripts/issue_show/components/edited.vue b/app/assets/javascripts/issue_show/components/edited.vue
index 5ff5b1630b1..05cd976f196 100644
--- a/app/assets/javascripts/issue_show/components/edited.vue
+++ b/app/assets/javascripts/issue_show/components/edited.vue
@@ -46,7 +46,7 @@
by
<a
:href="updatedByPath"
- class="author_link"
+ class="author-link"
>
<span>{{ updatedByName }}</span>
</a>
diff --git a/app/assets/javascripts/notes/components/note_edited_text.vue b/app/assets/javascripts/notes/components/note_edited_text.vue
index 391bb2ae179..d848335022f 100644
--- a/app/assets/javascripts/notes/components/note_edited_text.vue
+++ b/app/assets/javascripts/notes/components/note_edited_text.vue
@@ -42,7 +42,7 @@ export default {
by
<a
:href="editedBy.path"
- class="js-vue-author author_link">
+ class="js-vue-author author-link">
{{ editedBy.name }}
</a>
</template>
diff --git a/app/assets/javascripts/sidebar/components/assignees/assignees.vue b/app/assets/javascripts/sidebar/components/assignees/assignees.vue
index d22a1e1ac66..dd155c133ce 100644
--- a/app/assets/javascripts/sidebar/components/assignees/assignees.vue
+++ b/app/assets/javascripts/sidebar/components/assignees/assignees.vue
@@ -187,7 +187,7 @@ export default {
<template v-else-if="hasOneUser">
<a
:href="assigneeUrl(firstUser)"
- class="author_link bold"
+ class="author-link bold"
>
<img
:alt="assigneeAlt(firstUser)"
diff --git a/app/assets/javascripts/sidebar/components/participants/participants.vue b/app/assets/javascripts/sidebar/components/participants/participants.vue
index 33dd6c981b6..56d57f6aac8 100644
--- a/app/assets/javascripts/sidebar/components/participants/participants.vue
+++ b/app/assets/javascripts/sidebar/components/participants/participants.vue
@@ -120,7 +120,7 @@
>
<a
:href="participant.web_url"
- class="author_link"
+ class="author-link"
>
<user-avatar-image
:lazy="true"
diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js
index e3d7645040d..e19bbbacf4d 100644
--- a/app/assets/javascripts/users_select.js
+++ b/app/assets/javascripts/users_select.js
@@ -206,8 +206,8 @@ function UsersSelect(currentUser, els, options = {}) {
return $collapsedSidebar.html(collapsedAssigneeTemplate(user));
});
};
- collapsedAssigneeTemplate = _.template('<% if( avatar ) { %> <a class="author_link" href="/<%- username %>"> <img width="24" class="avatar avatar-inline s24" alt="" src="<%- avatar %>"> </a> <% } else { %> <i class="fa fa-user"></i> <% } %>');
- assigneeTemplate = _.template('<% if (username) { %> <a class="author_link bold" href="/<%- username %>"> <% if( avatar ) { %> <img width="32" class="avatar avatar-inline s32" alt="" src="<%- avatar %>"> <% } %> <span class="author"><%- name %></span> <span class="username"> @<%- username %> </span> </a> <% } else { %> <span class="no-value assign-yourself"> No assignee - <a href="#" class="js-assign-yourself"> assign yourself </a> </span> <% } %>');
+ collapsedAssigneeTemplate = _.template('<% if( avatar ) { %> <a class="author-link" href="/<%- username %>"> <img width="24" class="avatar avatar-inline s24" alt="" src="<%- avatar %>"> </a> <% } else { %> <i class="fa fa-user"></i> <% } %>');
+ assigneeTemplate = _.template('<% if (username) { %> <a class="author-link bold" href="/<%- username %>"> <% if( avatar ) { %> <img width="32" class="avatar avatar-inline s32" alt="" src="<%- avatar %>"> <% } %> <span class="author"><%- name %></span> <span class="username"> @<%- username %> </span> </a> <% } else { %> <span class="no-value assign-yourself"> No assignee - <a href="#" class="js-assign-yourself"> assign yourself </a> </span> <% } %>');
return $dropdown.glDropdown({
showMenuAbove: showMenuAbove,
data: function(term, callback) {
diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss
index 218e37602dd..637587de597 100644
--- a/app/assets/stylesheets/framework/common.scss
+++ b/app/assets/stylesheets/framework/common.scss
@@ -113,8 +113,6 @@ hr {
.item-title { font-weight: $gl-font-weight-bold; }
-/** FLASH message **/
-.author_link,
.author-link {
color: $gl-link-color;
}
diff --git a/app/assets/stylesheets/framework/lists.scss b/app/assets/stylesheets/framework/lists.scss
index d54490c87c6..4b67eab05b3 100644
--- a/app/assets/stylesheets/framework/lists.scss
+++ b/app/assets/stylesheets/framework/lists.scss
@@ -259,7 +259,7 @@ ul.controls {
margin-right: 0;
}
- .author_link {
+ .author-link {
.avatar-inline {
margin-left: 0;
margin-right: 0;
@@ -270,7 +270,7 @@ ul.controls {
.issuable-pipeline-broken a,
.issuable-pipeline-status a,
- .author_link {
+ .author-link {
display: flex;
}
}
diff --git a/app/assets/stylesheets/pages/detail_page.scss b/app/assets/stylesheets/pages/detail_page.scss
index 2e007c52592..37ed5ae674a 100644
--- a/app/assets/stylesheets/pages/detail_page.scss
+++ b/app/assets/stylesheets/pages/detail_page.scss
@@ -10,7 +10,7 @@
}
.issue_created_ago,
- .author_link {
+ .author-link {
white-space: nowrap;
}
diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss
index 06c0ce63f8f..797b106de23 100644
--- a/app/assets/stylesheets/pages/issuable.scss
+++ b/app/assets/stylesheets/pages/issuable.scss
@@ -197,7 +197,7 @@
}
&.assignee {
- .author_link {
+ .author-link {
display: block;
padding-left: 42px;
position: relative;
@@ -486,7 +486,7 @@
padding-bottom: 0;
margin-bottom: 10px;
- .author_link {
+ .author-link {
padding-left: 0;
.avatar {
@@ -595,7 +595,7 @@
margin: 16px 0 0;
font-size: 85%;
- .author_link {
+ .author-link {
color: $gray-darkest;
}
}
@@ -620,7 +620,7 @@
padding-right: 0;
}
- .author_link {
+ .author-link {
display: block;
}
diff --git a/app/assets/stylesheets/pages/issues.scss b/app/assets/stylesheets/pages/issues.scss
index 19fb99bfa93..212e5979273 100644
--- a/app/assets/stylesheets/pages/issues.scss
+++ b/app/assets/stylesheets/pages/issues.scss
@@ -12,7 +12,7 @@
}
.issuable-meta {
- .author_link {
+ .author-link {
display: inline-block;
}
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index 25cfda3ec5c..7fc2936c5e6 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -403,7 +403,7 @@ ul.notes {
}
}
- .author_link {
+ .author-link {
color: $gl-text-color;
}
}
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index 9dc0c31be49..b7c656246ef 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -112,7 +112,7 @@ class Projects::WikisController < Projects::ApplicationController
private
def load_project_wiki
- @project_wiki = ProjectWiki.new(@project, current_user)
+ @project_wiki = load_wiki
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki.wiki
@@ -128,6 +128,10 @@ class Projects::WikisController < Projects::ApplicationController
false
end
+ def load_wiki
+ ProjectWiki.new(@project, current_user)
+ end
+
def wiki_params
params.require(:wiki).permit(:title, :content, :format, :message, :last_commit_sha)
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 221f1aa9dd8..aaf9dff43ee 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -63,10 +63,10 @@ module ProjectsHelper
author_html = author_html.html_safe
if opts[:name]
- link_to(author_html, user_path(author), class: "author_link #{"#{opts[:extra_class]}" if opts[:extra_class]} #{"#{opts[:mobile_classes]}" if opts[:mobile_classes]}").html_safe
+ link_to(author_html, user_path(author), class: "author-link #{"#{opts[:extra_class]}" if opts[:extra_class]} #{"#{opts[:mobile_classes]}" if opts[:mobile_classes]}").html_safe
else
title = opts[:title].sub(":name", sanitize(author.name))
- link_to(author_html, user_path(author), class: "author_link has-tooltip", title: title, data: { container: 'body' }).html_safe
+ link_to(author_html, user_path(author), class: "author-link has-tooltip", title: title, data: { container: 'body' }).html_safe
end
end
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 3aa56b3983f..f4b3421f04b 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -82,7 +82,7 @@ class ProjectWiki
# Returns an Array of Gitlab WikiPage instances or an
# empty Array if this Wiki has no pages.
- def pages(limit: nil)
+ def pages(limit: 0)
wiki.pages(limit: limit).map { |page| WikiPage.new(self, page, true) }
end
diff --git a/app/views/shared/notes/_notes_with_form.html.haml b/app/views/shared/notes/_notes_with_form.html.haml
index e0832fd9136..9dd1c24fdfa 100644
--- a/app/views/shared/notes/_notes_with_form.html.haml
+++ b/app/views/shared/notes/_notes_with_form.html.haml
@@ -13,7 +13,7 @@
.flash-container.timeline-content
.timeline-icon.d-none.d-sm-none.d-md-block
- %a.author_link{ href: user_path(current_user) }
+ %a.author-link{ href: user_path(current_user) }
= image_tag avatar_icon_for_user(current_user), alt: current_user.to_reference, class: 'avatar s40'
.timeline-content.timeline-content-form
= render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete
diff --git a/changelogs/unreleased/replace-snake-case-css-classes.yml b/changelogs/unreleased/replace-snake-case-css-classes.yml
new file mode 100644
index 00000000000..28ec5ee097f
--- /dev/null
+++ b/changelogs/unreleased/replace-snake-case-css-classes.yml
@@ -0,0 +1,5 @@
+---
+title: Replace author_link snake case in stylesheets, specs, and helpers
+merge_request: 20797
+author: George Tsiolis
+type: other
diff --git a/changelogs/unreleased/sh-use-wiki-limit-parameter-gitaly.yml b/changelogs/unreleased/sh-use-wiki-limit-parameter-gitaly.yml
new file mode 100644
index 00000000000..e8c2e11ad31
--- /dev/null
+++ b/changelogs/unreleased/sh-use-wiki-limit-parameter-gitaly.yml
@@ -0,0 +1,5 @@
+---
+title: Use limit parameter to retrieve Wikis from Gitaly
+merge_request: 20764
+author:
+type: performance
diff --git a/doc/administration/raketasks/check.md b/doc/administration/raketasks/check.md
index 2649bf61d74..0c145830f02 100644
--- a/doc/administration/raketasks/check.md
+++ b/doc/administration/raketasks/check.md
@@ -121,6 +121,45 @@ sudo gitlab-rake gitlab:lfs:check BATCH=100 ID_FROM=50 ID_TO=250
sudo gitlab-rake gitlab:uploads:check BATCH=100 ID_FROM=50 ID_TO=250
```
+Example output:
+
+```
+$ sudo gitlab-rake gitlab:uploads:check
+Checking integrity of Uploads
+- 1..1350: Failures: 0
+- 1351..2743: Failures: 0
+- 2745..4349: Failures: 2
+- 4357..5762: Failures: 1
+- 5764..7140: Failures: 2
+- 7142..8651: Failures: 0
+- 8653..10134: Failures: 0
+- 10135..11773: Failures: 0
+- 11777..13315: Failures: 0
+Done!
+```
+
+Example verbose output:
+
+```
+$ sudo gitlab-rake gitlab:uploads:check VERBOSE=1
+Checking integrity of Uploads
+- 1..1350: Failures: 0
+- 1351..2743: Failures: 0
+- 2745..4349: Failures: 2
+ - Upload: 3573: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/public/uploads/user-foo/project-bar/7a77cc52947bfe188adeff42f890bb77/image.png>
+ - Upload: 3580: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/public/uploads/user-foo/project-bar/2840ba1ba3b2ecfa3478a7b161375f8a/pug.png>
+- 4357..5762: Failures: 1
+ - Upload: 4636: #<Google::Apis::ServerError: Server error>
+- 5764..7140: Failures: 2
+ - Upload: 5812: #<NoMethodError: undefined method `hashed_storage?' for nil:NilClass>
+ - Upload: 5837: #<NoMethodError: undefined method `hashed_storage?' for nil:NilClass>
+- 7142..8651: Failures: 0
+- 8653..10134: Failures: 0
+- 10135..11773: Failures: 0
+- 11777..13315: Failures: 0
+Done!
+```
+
## LDAP Check
The LDAP check Rake task will test the bind_dn and password credentials
diff --git a/doc/api/users.md b/doc/api/users.md
index 1bcc7b7f346..07f9baf06d2 100644
--- a/doc/api/users.md
+++ b/doc/api/users.md
@@ -291,7 +291,7 @@ Parameters:
- `skip_confirmation` (optional) - Skip confirmation - true or false (default)
- `external` (optional) - Flags the user as external - true or false(default)
- `avatar` (optional) - Image file for user's avatar
-- `private_profile (optional) - User's profile is private - true or false
+- `private_profile` (optional) - User's profile is private - true or false
## User modification
@@ -322,7 +322,7 @@ Parameters:
- `skip_reconfirmation` (optional) - Skip reconfirmation - true or false (default)
- `external` (optional) - Flags the user as external - true or false(default)
- `avatar` (optional) - Image file for user's avatar
-- `private_profile (optional) - User's profile is private - true or false
+- `private_profile` (optional) - User's profile is private - true or false
On password update, user will be forced to change it upon next login.
Note, at the moment this method does only return a `404` error,
diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md
index fbac37e688e..63338ff632c 100644
--- a/doc/ci/docker/using_docker_build.md
+++ b/doc/ci/docker/using_docker_build.md
@@ -427,7 +427,7 @@ services:
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
- IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
+ IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
@@ -440,8 +440,10 @@ build:
```
Here, `$CI_REGISTRY_IMAGE` would be resolved to the address of the registry tied
-to this project, and `$CI_COMMIT_REF_NAME` would be resolved to the branch or
-tag name for this particular job. We also declare our own variable, `$IMAGE_TAG`,
+to this project. Since `$CI_COMMIT_REF_NAME` resolves to the branch or tag name,
+and your branch-name can contain forward slashes (e.g., feature/my-feature), it is
+safer to use `$CI_COMMIT_REF_SLUG` as the image tag. This is due to that image tags
+cannot contain forward slashes. We also declare our own variable, `$IMAGE_TAG`,
combining the two to save us some typing in the `script` section.
Here's a more elaborate example that splits up the tasks into 4 pipeline stages,
@@ -464,7 +466,7 @@ stages:
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
- CONTAINER_TEST_IMAGE: registry.example.com/my-group/my-project/my-image:$CI_COMMIT_REF_NAME
+ CONTAINER_TEST_IMAGE: registry.example.com/my-group/my-project/my-image:$CI_COMMIT_REF_SLUG
CONTAINER_RELEASE_IMAGE: registry.example.com/my-group/my-project/my-image:latest
before_script:
diff --git a/generator_templates/active_record/migration/create_table_migration.rb b/generator_templates/active_record/migration/create_table_migration.rb
index 59a9d37df0f..92e963911d0 100644
--- a/generator_templates/active_record/migration/create_table_migration.rb
+++ b/generator_templates/active_record/migration/create_table_migration.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
diff --git a/generator_templates/active_record/migration/migration.rb b/generator_templates/active_record/migration/migration.rb
index 08752b3af50..38edab82550 100644
--- a/generator_templates/active_record/migration/migration.rb
+++ b/generator_templates/active_record/migration/migration.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
diff --git a/generator_templates/rails/post_deployment_migration/migration.rb b/generator_templates/rails/post_deployment_migration/migration.rb
index f2dff84b618..353709f7c9c 100644
--- a/generator_templates/rails/post_deployment_migration/migration.rb
+++ b/generator_templates/rails/post_deployment_migration/migration.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
diff --git a/lib/gitlab/git/wiki.rb b/lib/gitlab/git/wiki.rb
index 8ee46b59830..9d992be66eb 100644
--- a/lib/gitlab/git/wiki.rb
+++ b/lib/gitlab/git/wiki.rb
@@ -44,9 +44,9 @@ module Gitlab
end
end
- def pages(limit: nil)
+ def pages(limit: 0)
@repository.wrapped_gitaly_errors do
- gitaly_get_all_pages
+ gitaly_get_all_pages(limit: limit)
end
end
@@ -158,8 +158,8 @@ module Gitlab
Gitlab::Git::WikiFile.new(wiki_file)
end
- def gitaly_get_all_pages
- gitaly_wiki_client.get_all_pages.map do |wiki_page, version|
+ def gitaly_get_all_pages(limit: 0)
+ gitaly_wiki_client.get_all_pages(limit: limit).map do |wiki_page, version|
Gitlab::Git::WikiPage.new(wiki_page, version)
end
end
diff --git a/lib/gitlab/gitaly_client/wiki_service.rb b/lib/gitlab/gitaly_client/wiki_service.rb
index 6cb049c1f68..75be7d1f5a0 100644
--- a/lib/gitlab/gitaly_client/wiki_service.rb
+++ b/lib/gitlab/gitaly_client/wiki_service.rb
@@ -85,8 +85,8 @@ module Gitlab
wiki_page_from_iterator(response)
end
- def get_all_pages
- request = Gitaly::WikiGetAllPagesRequest.new(repository: @gitaly_repo)
+ def get_all_pages(limit: 0)
+ request = Gitaly::WikiGetAllPagesRequest.new(repository: @gitaly_repo, limit: limit)
response = GitalyClient.call(@repository.storage, :wiki_service, :wiki_get_all_pages, request, timeout: GitalyClient.medium_timeout)
pages = []
diff --git a/lib/support/nginx/registry-ssl b/lib/support/nginx/registry-ssl
index 92511e26861..908d26a0da2 100644
--- a/lib/support/nginx/registry-ssl
+++ b/lib/support/nginx/registry-ssl
@@ -10,7 +10,7 @@ server {
listen *:80;
server_name registry.gitlab.example.com;
server_tokens off; ## Don't show the nginx version number, a security best practice
- return 301 https://$http_host:$request_uri;
+ return 301 https://$http_host$request_uri;
access_log /var/log/nginx/gitlab_registry_access.log gitlab_access;
error_log /var/log/nginx/gitlab_registry_error.log;
}
diff --git a/spec/controllers/projects/wikis_controller_spec.rb b/spec/controllers/projects/wikis_controller_spec.rb
index 92addf30307..fed6677935e 100644
--- a/spec/controllers/projects/wikis_controller_spec.rb
+++ b/spec/controllers/projects/wikis_controller_spec.rb
@@ -1,8 +1,35 @@
require 'spec_helper'
describe Projects::WikisController do
- let(:project) { create(:project_empty_repo, :public) }
+ let(:project) { create(:project, :public, :repository) }
let(:user) { create(:user) }
+ let(:wiki) { ProjectWiki.new(project, user) }
+
+ describe 'GET #show' do
+ let(:wiki_title) { 'page-title-test' }
+
+ render_views
+
+ before do
+ create_page(wiki_title, 'hello world')
+ end
+
+ it 'limits the retrieved pages for the sidebar' do
+ sign_in(user)
+
+ expect(controller).to receive(:load_wiki).and_return(wiki)
+
+ # empty? call
+ expect(wiki).to receive(:pages).with(limit: 1).and_call_original
+ # Sidebar entries
+ expect(wiki).to receive(:pages).with(limit: 15).and_call_original
+
+ get :show, namespace_id: project.namespace, project_id: project, id: wiki_title
+
+ expect(response).to have_http_status(:ok)
+ expect(response.body).to include(wiki_title)
+ end
+ end
describe 'POST #preview_markdown' do
it 'renders json in a correct format' do
@@ -13,4 +40,12 @@ describe Projects::WikisController do
expect(JSON.parse(response.body).keys).to match_array(%w(body references))
end
end
+
+ def create_page(name, content)
+ project.wiki.wiki.write_page(name, :markdown, content, commit_details(name))
+ end
+
+ def commit_details(name)
+ Gitlab::Git::Wiki::CommitDetails.new(user.id, user.username, user.name, user.email, "created page #{name}")
+ end
end
diff --git a/spec/features/issues/update_issues_spec.rb b/spec/features/issues/update_issues_spec.rb
index 845a7c5fc42..fd8629ae504 100644
--- a/spec/features/issues/update_issues_spec.rb
+++ b/spec/features/issues/update_issues_spec.rb
@@ -49,7 +49,7 @@ describe 'Multiple issue updating from issues#index', :js do
click_update_issues_button
page.within('.issue .controls') do
- expect(find('.author_link')["title"]).to have_content(user.name)
+ expect(find('.author-link')["title"]).to have_content(user.name)
end
end
@@ -63,7 +63,7 @@ describe 'Multiple issue updating from issues#index', :js do
click_link 'Unassigned'
click_update_issues_button
- expect(find('.issue:first-child .controls')).not_to have_css('.author_link')
+ expect(find('.issue:first-child .controls')).not_to have_css('.author-link')
end
end
diff --git a/spec/features/merge_requests/user_mass_updates_spec.rb b/spec/features/merge_requests/user_mass_updates_spec.rb
index bb327159cb0..cb6603d3f50 100644
--- a/spec/features/merge_requests/user_mass_updates_spec.rb
+++ b/spec/features/merge_requests/user_mass_updates_spec.rb
@@ -47,7 +47,7 @@ describe 'Merge requests > User mass updates', :js do
change_assignee(user.name)
page.within('.merge-request .controls') do
- expect(find('.author_link')["title"]).to have_content(user.name)
+ expect(find('.author-link')["title"]).to have_content(user.name)
end
end
end
@@ -62,7 +62,7 @@ describe 'Merge requests > User mass updates', :js do
it 'removes assignee from the merge request' do
change_assignee('Unassigned')
- expect(find('.merge-request .controls')).not_to have_css('.author_link')
+ expect(find('.merge-request .controls')).not_to have_css('.author-link')
end
end
end
diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js
index eb5e0bddb74..36328382448 100644
--- a/spec/javascripts/issue_show/components/app_spec.js
+++ b/spec/javascripts/issue_show/components/app_spec.js
@@ -76,7 +76,7 @@ describe('Issuable output', () => {
expect(vm.$el.querySelector('.wiki').innerHTML).toContain('<p>this is a description!</p>');
expect(vm.$el.querySelector('.js-task-list-field').value).toContain('this is a description');
expect(formatText(editedText.innerText)).toMatch(/Edited[\s\S]+?by Some User/);
- expect(editedText.querySelector('.author_link').href).toMatch(/\/some_user$/);
+ expect(editedText.querySelector('.author-link').href).toMatch(/\/some_user$/);
expect(editedText.querySelector('time')).toBeTruthy();
})
.then(() => {
@@ -90,7 +90,7 @@ describe('Issuable output', () => {
expect(vm.$el.querySelector('.js-task-list-field').value).toContain('42');
expect(vm.$el.querySelector('.edited-text')).toBeTruthy();
expect(formatText(vm.$el.querySelector('.edited-text').innerText)).toMatch(/Edited[\s\S]+?by Other User/);
- expect(editedText.querySelector('.author_link').href).toMatch(/\/other_user$/);
+ expect(editedText.querySelector('.author-link').href).toMatch(/\/other_user$/);
expect(editedText.querySelector('time')).toBeTruthy();
})
.then(done)
diff --git a/spec/javascripts/issue_show/components/edited_spec.js b/spec/javascripts/issue_show/components/edited_spec.js
index 2061def699b..7f09db837bb 100644
--- a/spec/javascripts/issue_show/components/edited_spec.js
+++ b/spec/javascripts/issue_show/components/edited_spec.js
@@ -18,7 +18,7 @@ describe('edited', () => {
}).$mount();
expect(formatText(editedComponent.$el.innerText)).toMatch(/Edited[\s\S]+?by Some User/);
- expect(editedComponent.$el.querySelector('.author_link').href).toMatch(/\/some_user$/);
+ expect(editedComponent.$el.querySelector('.author-link').href).toMatch(/\/some_user$/);
expect(editedComponent.$el.querySelector('time')).toBeTruthy();
});
@@ -31,7 +31,7 @@ describe('edited', () => {
}).$mount();
expect(formatText(editedComponent.$el.innerText)).toMatch(/Edited by Some User/);
- expect(editedComponent.$el.querySelector('.author_link').href).toMatch(/\/some_user$/);
+ expect(editedComponent.$el.querySelector('.author-link').href).toMatch(/\/some_user$/);
expect(editedComponent.$el.querySelector('time')).toBeFalsy();
});
@@ -43,7 +43,7 @@ describe('edited', () => {
}).$mount();
expect(formatText(editedComponent.$el.innerText)).not.toMatch(/by Some User/);
- expect(editedComponent.$el.querySelector('.author_link')).toBeFalsy();
+ expect(editedComponent.$el.querySelector('.author-link')).toBeFalsy();
expect(editedComponent.$el.querySelector('time')).toBeTruthy();
});
diff --git a/spec/javascripts/sidebar/assignees_spec.js b/spec/javascripts/sidebar/assignees_spec.js
index 4e4343812bd..843e7002180 100644
--- a/spec/javascripts/sidebar/assignees_spec.js
+++ b/spec/javascripts/sidebar/assignees_spec.js
@@ -102,13 +102,13 @@ describe('Assignee component', () => {
},
}).$mount();
- expect(component.$el.querySelector('.author_link')).not.toBeNull();
+ expect(component.$el.querySelector('.author-link')).not.toBeNull();
// The image
- expect(component.$el.querySelector('.author_link img').getAttribute('src')).toEqual(UsersMock.user.avatar);
+ expect(component.$el.querySelector('.author-link img').getAttribute('src')).toEqual(UsersMock.user.avatar);
// Author name
- expect(component.$el.querySelector('.author_link .author').innerText.trim()).toEqual(UsersMock.user.name);
+ expect(component.$el.querySelector('.author-link .author').innerText.trim()).toEqual(UsersMock.user.name);
// Username
- expect(component.$el.querySelector('.author_link .username').innerText.trim()).toEqual(`@${UsersMock.user.username}`);
+ expect(component.$el.querySelector('.author-link .username').innerText.trim()).toEqual(`@${UsersMock.user.username}`);
});
it('has the root url present in the assigneeUrl method', () => {
diff --git a/spec/lib/gitlab/git/wiki_spec.rb b/spec/lib/gitlab/git/wiki_spec.rb
index b63658e1b3b..c5666e4ec61 100644
--- a/spec/lib/gitlab/git/wiki_spec.rb
+++ b/spec/lib/gitlab/git/wiki_spec.rb
@@ -6,6 +6,31 @@ describe Gitlab::Git::Wiki do
let(:project_wiki) { ProjectWiki.new(project, user) }
subject { project_wiki.wiki }
+ describe '#pages' do
+ before do
+ create_page('page1', 'content')
+ create_page('page2', 'content2')
+ end
+
+ after do
+ destroy_page('page1')
+ destroy_page('page2')
+ end
+
+ it 'returns all the pages' do
+ expect(subject.pages.count).to eq(2)
+ expect(subject.pages.first.title).to eq 'page1'
+ expect(subject.pages.last.title).to eq 'page2'
+ end
+
+ it 'returns only one page' do
+ pages = subject.pages(limit: 1)
+
+ expect(pages.count).to eq(1)
+ expect(pages.first.title).to eq 'page1'
+ end
+ end
+
describe '#page' do
before do
create_page('page1', 'content')
diff --git a/spec/lib/gitlab/gitaly_client/wiki_service_spec.rb b/spec/lib/gitlab/gitaly_client/wiki_service_spec.rb
index 6ad9f5ef766..5f67fe6b952 100644
--- a/spec/lib/gitlab/gitaly_client/wiki_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/wiki_service_spec.rb
@@ -70,6 +70,15 @@ describe Gitlab::GitalyClient::WikiService do
subject
end
+ it 'sends a limit of 0 to wiki_get_all_pages' do
+ expect_any_instance_of(Gitaly::WikiService::Stub)
+ .to receive(:wiki_get_all_pages)
+ .with(gitaly_request_with_params(limit: 0), kind_of(Hash))
+ .and_return([].each)
+
+ subject
+ end
+
it 'concatenates the raw data and returns a pair of WikiPage and WikiPageVersion for each page' do
expect_any_instance_of(Gitaly::WikiService::Stub)
.to receive(:wiki_get_all_pages)
@@ -84,5 +93,18 @@ describe Gitlab::GitalyClient::WikiService do
expect(wiki_page_2.raw_data).to eq('cd')
expect(wiki_page_2_version.format).to eq('markdown')
end
+
+ context 'with limits' do
+ subject { client.get_all_pages(limit: 1) }
+
+ it 'sends a request with the limit' do
+ expect_any_instance_of(Gitaly::WikiService::Stub)
+ .to receive(:wiki_get_all_pages)
+ .with(gitaly_request_with_params(limit: 1), kind_of(Hash))
+ .and_return([].each)
+
+ subject
+ end
+ end
end
end