From e9ef274bb24218f49d6a7e12210df223150434f7 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Fri, 19 Jun 2015 09:01:35 +0200 Subject: Use whoami instead of $USER - Use whoami instead of relying on the existence of $USER enviroment variable which is not always present --- lib/support/init.d/gitlab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab index 946902e2f6d..a3455728a94 100755 --- a/lib/support/init.d/gitlab +++ b/lib/support/init.d/gitlab @@ -41,7 +41,7 @@ shell_path="/bin/bash" test -f /etc/default/gitlab && . /etc/default/gitlab # Switch to the app_user if it is not he/she who is running the script. -if [ "$USER" != "$app_user" ]; then +if [ `whoami` != "$app_user" ]; then eval su - "$app_user" -s $shell_path -c $(echo \")$0 "$@"$(echo \"); exit; fi -- cgit v1.2.1 From 5571b7356342d2197dcae773775389991f95a193 Mon Sep 17 00:00:00 2001 From: Darby Date: Wed, 24 Jun 2015 16:16:24 -0700 Subject: Changed the color of admin/application_settings buttons --- app/assets/stylesheets/pages/admin.scss | 13 +++++++++++++ app/views/admin/application_settings/_form.html.haml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/pages/admin.scss b/app/assets/stylesheets/pages/admin.scss index 144852e7874..12372719a35 100644 --- a/app/assets/stylesheets/pages/admin.scss +++ b/app/assets/stylesheets/pages/admin.scss @@ -61,3 +61,16 @@ @extend .broadcast-message; margin-bottom: 20px; } + +.btn-visibility { + .btn-primary { + color: black; + background-color: white; + border-color: black; + } + .btn-primary.active { + color: black; + background-color: #d3d3d3; + border-color: black; + } +} diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index 6bef33c6d7a..8ce0b3cd207 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -23,7 +23,7 @@ = f.label :restricted_visibility_levels, class: 'control-label col-sm-2' .col-sm-10 - data_attrs = { toggle: 'buttons' } - .btn-group{ data: data_attrs } + .btn-group.btn-visibility{ data: data_attrs } - restricted_level_checkboxes('restricted-visibility-help').each do |level| = level %span.help-block#restricted-visibility-help Selected levels cannot be used by non-admin users for projects or snippets -- cgit v1.2.1 From c611b6f6238ce6ce164f173df551552ffe83f596 Mon Sep 17 00:00:00 2001 From: Darby Date: Wed, 1 Jul 2015 15:49:31 -0700 Subject: Comment box/Placeholder text redo --- app/helpers/gitlab_markdown_helper.rb | 2 +- app/views/projects/_zen.html.haml | 2 +- app/views/projects/notes/_edit_form.html.haml | 4 ++-- app/views/projects/notes/_form.html.haml | 9 +++++++-- spec/helpers/gitlab_markdown_helper_spec.rb | 1 - 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index a801d3b10aa..f4c7a6494a9 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -118,7 +118,7 @@ module GitlabMarkdownHelper # Returns a random markdown tip for use as a textarea placeholder def random_markdown_tip - "Tip: #{MARKDOWN_TIPS.sample}" + "#{MARKDOWN_TIPS.sample}" end private diff --git a/app/views/projects/_zen.html.haml b/app/views/projects/_zen.html.haml index a4e41eeb363..6a41cdbc907 100644 --- a/app/views/projects/_zen.html.haml +++ b/app/views/projects/_zen.html.haml @@ -2,7 +2,7 @@ %input#zen-toggle-comment.zen-toggle-comment{ tabindex: '-1', type: 'checkbox' } .zen-backdrop - classes << ' js-gfm-input markdown-area' - = f.text_area attr, class: classes, placeholder: random_markdown_tip + = f.text_area attr, class: classes, placeholder: '' = link_to nil, class: 'zen-enter-link', tabindex: '-1' do %i.fa.fa-expand Edit in fullscreen diff --git a/app/views/projects/notes/_edit_form.html.haml b/app/views/projects/notes/_edit_form.html.haml index a663950f031..9c4c5dc0c7f 100644 --- a/app/views/projects/notes/_edit_form.html.haml +++ b/app/views/projects/notes/_edit_form.html.haml @@ -5,8 +5,8 @@ = render 'projects/zen', f: f, attr: :note, classes: 'note_text js-note-text js-task-list-field' .comment-hints.clearfix - .pull-left Comments are parsed with #{link_to 'GitLab Flavored Markdown', help_page_path('markdown', 'markdown'),{ target: '_blank', tabindex: -1 }} - .pull-right Attach files by dragging & dropping or #{link_to 'selecting them', '#', class: 'markdown-selector', tabindex: -1 }. + .pull-left #{link_to 'Markdown tip:', help_page_path('markdown', 'markdown'),{ target: '_blank', tabindex: -1 }} + .pull-right #{link_to 'Attach a file', '#', class: 'markdown-selector', tabindex: -1 } .note-form-actions .buttons diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 3fb044d736e..4c662336428 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -12,8 +12,13 @@ classes: 'note_text js-note-text' .comment-hints.clearfix - .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }} - .pull-right Attach files by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }. + .pull-left + = link_to "Markdown tip:", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 } + = random_markdown_tip + .pull-right + = link_to '#', class: 'markdown-selector', tabindex: -1 do + Attach a file + = icon('paperclip') .error-alert .note-form-actions diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 14c8c29d008..30a15b974bd 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -137,7 +137,6 @@ describe GitlabMarkdownHelper do describe 'random_markdown_tip' do it 'returns a random Markdown tip' do stub_const("#{described_class}::MARKDOWN_TIPS", ['Random tip']) - expect(random_markdown_tip).to eq 'Tip: Random tip' end end end -- cgit v1.2.1 From fef2e24804ffd5b9d9eef94f817fccf01675f54e Mon Sep 17 00:00:00 2001 From: karen Carias Date: Thu, 2 Jul 2015 12:09:06 -0700 Subject: new doc about creating groups --- doc/gitlab-basics/README.md | 2 ++ doc/gitlab-basics/command-line-commands.md | 2 +- doc/gitlab-basics/create-group.md | 43 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 doc/gitlab-basics/create-group.md diff --git a/doc/gitlab-basics/README.md b/doc/gitlab-basics/README.md index fd55c44a2c4..3e4400b544b 100644 --- a/doc/gitlab-basics/README.md +++ b/doc/gitlab-basics/README.md @@ -11,3 +11,5 @@ Step-by-step guides on the basics of working with Git and GitLab. * [Basic Git commands](basic-git-commands.md) * [Create a project](create-project.md) + +* [Create a group](create-group.md) diff --git a/doc/gitlab-basics/command-line-commands.md b/doc/gitlab-basics/command-line-commands.md index 30f78d1e6a5..a596bf20c74 100644 --- a/doc/gitlab-basics/command-line-commands.md +++ b/doc/gitlab-basics/command-line-commands.md @@ -2,7 +2,7 @@ ## Start working on your project -* In Git, when you copy a project you say you "clone" it. To work on a git project locally (from your own computer), you will need to clone it. To do this, start by signing in at GitLab.com.. To do it, go to your [GitLab.com](https://gitlab.com) account +* In Git, when you copy a project you say you "clone" it. To work on a git project locally (from your own computer), you will need to clone it. To do this, sign in to [GitLab.com](https://gitlab.com) * When you are on your Dashboard, click on the project that you'd like to clone, which you'll find at the right side of your screen diff --git a/doc/gitlab-basics/create-group.md b/doc/gitlab-basics/create-group.md new file mode 100644 index 00000000000..5fa596887bb --- /dev/null +++ b/doc/gitlab-basics/create-group.md @@ -0,0 +1,43 @@ +# How to create a group in GitLab + +## Create a group + +When you create a group in GitLab.com, you can add projects and users + +To create a new group, sign in to [GitLab.com](https://gitlab.com) + +* Click on "new project" on the right side of your screen + +![Create a project](basicsimages/new_project.png) + +* Click on "create a group" on the bottom left side of your screen + +![Create a group](basicsimages/create_group.png) + +1. Add a group path or group name (you can't add spaces, so you can use hyphens or underscores) + +1. Add details or a group description + +1. You can choose a group avatar if you'd like + +1. Click on "create group" + +![Group information](basicsimages/group_info.png) + +## Add a group to a project + +* Select a project on the right side of your screen + +![Select a project](basicsimages/select_project.png) + +* Click on "settings" on the left side of your screen + +![Settings](basicsimages/settings.png) + +* Click on "groups" on the left side of your screen + +![Groups](basicsimages/groups.png) + +* Find the group and click on "share" + +![Find a group](basicsimages/find_group.png) -- cgit v1.2.1 From c2ee6862c8538c967ba04fa72b702198f31f876c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 3 Jul 2015 16:50:21 +0200 Subject: API to set application settings for admin Signed-off-by: Dmitriy Zaporozhets --- lib/api/api.rb | 1 + lib/api/entities.rb | 22 ++++++++++++++++++++++ lib/api/settings.rb | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 lib/api/settings.rb diff --git a/lib/api/api.rb b/lib/api/api.rb index d2a35c78fc1..eebd44ea5b6 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -49,5 +49,6 @@ module API mount Namespaces mount Branches mount Labels + mount Settings end end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 14a8f929d76..31202fa8c1f 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -277,5 +277,27 @@ module API class BroadcastMessage < Grape::Entity expose :message, :starts_at, :ends_at, :color, :font end + + class ApplicationSetting < Grape::Entity + expose :id + expose :default_projects_limit + expose :signup_enabled + expose :signin_enabled + expose :gravatar_enabled + expose :sign_in_text + expose :created_at + expose :updated_at + expose :home_page_url + expose :default_branch_protection + expose :twitter_sharing_enabled + expose :restricted_visibility_levels + expose :max_attachment_size + expose :session_expire_delay + expose :default_project_visibility + expose :default_snippet_visibility + expose :restricted_signup_domains + expose :user_oauth_applications + expose :after_sign_out_path + end end end diff --git a/lib/api/settings.rb b/lib/api/settings.rb new file mode 100644 index 00000000000..28c7a05c629 --- /dev/null +++ b/lib/api/settings.rb @@ -0,0 +1,35 @@ +module API + class Settings < Grape::API + before { authenticate! } + before { authorize_admin_project } + + helpers do + def current_settings + @current_setting ||= ApplicationSetting.current + end + end + + # Get current applicaiton settings + # + # Example Request: + # GET /application/settings + get "application/settings" do + present current_settings, with: Entities::ApplicationSetting + end + + # Modify applicaiton settings + # + # Example Request: + # PUT /application/settings + put "application/settings" do + attributes = current_settings.attributes.keys - ["id"] + attrs = attributes_for_keys(attributes) + + if current_settings.update_attributes(attrs) + present current_settings, with: Entities::ApplicationSetting + else + render_validation_error!(current_settings) + end + end + end +end -- cgit v1.2.1 From b28714b6a9bf71fac64a0423091fb7eab244fd7f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 6 Jul 2015 15:53:08 +0200 Subject: Add docs and empty specs for applicaiton settings API Signed-off-by: Dmitriy Zaporozhets --- doc/api/README.md | 1 + doc/api/settings.md | 88 ++++++++++++++++++++++++++++++++++++++ lib/api/settings.rb | 3 +- spec/requests/api/settings_spec.rb | 17 ++++++++ 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 doc/api/settings.md create mode 100644 spec/requests/api/settings_spec.rb diff --git a/doc/api/README.md b/doc/api/README.md index ca58c184543..b474e0ea389 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -20,6 +20,7 @@ - [System Hooks](system_hooks.md) - [Groups](groups.md) - [Namespaces](namespaces.md) +- [Settings](settings.md) ## Clients diff --git a/doc/api/settings.md b/doc/api/settings.md new file mode 100644 index 00000000000..d1b93a09c02 --- /dev/null +++ b/doc/api/settings.md @@ -0,0 +1,88 @@ +# Application settings + +This API allows you to read and modify GitLab instance application settings. + + +## Get current application settings: + +``` +GET /application/settings +``` + +```json +{ + "id": 1, + "default_projects_limit": 10, + "signup_enabled": true, + "signin_enabled": true, + "gravatar_enabled": true, + "sign_in_text": "", + "created_at": "2015-06-12T15:51:55.432Z", + "updated_at": "2015-06-30T13:22:42.210Z", + "home_page_url": "", + "default_branch_protection": 2, + "twitter_sharing_enabled": true, + "restricted_visibility_levels": [], + "max_attachment_size": 10, + "session_expire_delay": 10080, + "default_project_visibility": 0, + "default_snippet_visibility": 0, + "restricted_signup_domains": [], + "user_oauth_applications": true, + "after_sign_out_path": "" +} +``` + +## Change application settings: + + + +``` +PUT /application/settings +``` + +Parameters: + +- `default_projects_limit` - project limit per user +- `signup_enabled` - enable registration +- `signin_enabled` - enable login via GitLab account +- `gravatar_enabled` - enable gravatar +- `sign_in_text` - text on login page +- `home_page_url` - redirect to this URL when not logged in +- `default_branch_protection` - determine if developers can push to master +- `twitter_sharing_enabled` - allow users to share project creation in twitter +- `restricted_visibility_levels` - restrict certain visibility levels +- `max_attachment_size` - limit attachment size +- `session_expire_delay` - session lifetime +- `default_project_visibility` - what visibility level new project receives +- `default_snippet_visibility` - what visibility level new snippet receives +- `restricted_signup_domains` - force people to use only corporate emails for signup +- `user_oauth_applications` - allow users to create oauth applicaitons +- `after_sign_out_path` - where redirect user after logout + +All parameters are optional. You can send only one that you want to change. + + +```json +{ + "id": 1, + "default_projects_limit": 10, + "signup_enabled": true, + "signin_enabled": true, + "gravatar_enabled": true, + "sign_in_text": "", + "created_at": "2015-06-12T15:51:55.432Z", + "updated_at": "2015-06-30T13:22:42.210Z", + "home_page_url": "", + "default_branch_protection": 2, + "twitter_sharing_enabled": true, + "restricted_visibility_levels": [], + "max_attachment_size": 10, + "session_expire_delay": 10080, + "default_project_visibility": 0, + "default_snippet_visibility": 0, + "restricted_signup_domains": [], + "user_oauth_applications": true, + "after_sign_out_path": "" +} +``` diff --git a/lib/api/settings.rb b/lib/api/settings.rb index 28c7a05c629..4aa81bf8bab 100644 --- a/lib/api/settings.rb +++ b/lib/api/settings.rb @@ -1,7 +1,6 @@ module API class Settings < Grape::API - before { authenticate! } - before { authorize_admin_project } + before { authenticated_as_admin! } helpers do def current_settings diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb new file mode 100644 index 00000000000..2ab31c6a10a --- /dev/null +++ b/spec/requests/api/settings_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe API::API, 'Settings', api: true do + include ApiHelpers + + let(:user) { create(:user) } + let(:admin) { create(:admin) } + + + describe "GET /applicaiton/settings" do + # TODO: Implement + end + + describe "PUT /applicaiton/settings" do + # TODO: Implement + end +end -- cgit v1.2.1 From 111ebe54712aca16f3ad0f3d859c1c036ccb9f09 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 6 Jul 2015 15:38:43 +0300 Subject: Fork visibility level fix --- CHANGELOG | 1 + app/helpers/projects_helper.rb | 10 ++++++ app/helpers/visibility_level_helper.rb | 6 ++++ app/views/projects/edit.html.haml | 2 +- app/views/shared/_visibility_radios.html.haml | 1 + lib/gitlab/visibility_level.rb | 4 +++ spec/helpers/projects_helper_spec.rb | 44 +++++++++++++++++++++++++++ spec/helpers/visibility_level_helper_spec.rb | 39 ++++++++++++++++++++++++ 8 files changed, 106 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index d538bb42992..c48a69bff5f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,7 @@ v 7.13.0 (unreleased) - Correctly show anonymous authorized applications under Profile > Applications. - Query Optimization in MySQL. - Allow users to be blocked and unblocked via the API + - A fork can’t have a visibility level that is greater than the original project. v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ec65e473919..d18f3e91614 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -139,6 +139,16 @@ module ProjectsHelper end end + def can_change_visibility_level?(project, current_user) + return false unless can?(current_user, :change_visibility_level, project) + + if project.forked? + project.forked_from_project.visibility_level > Gitlab::VisibilityLevel::PRIVATE + else + true + end + end + private def get_project_nav_tabs(project, current_user) diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index 00d4c7f1051..b52cd23aba2 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -86,4 +86,10 @@ module VisibilityLevelHelper def default_snippet_visibility current_application_settings.default_snippet_visibility end + + def skip_level?(form_model, level) + form_model.is_a?(Project) && + form_model.forked? && + !Gitlab::VisibilityLevel.allowed_fork_levels(form_model.forked_from_project.visibility_level).include?(level) + end end diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 3fecd25c324..99078e43937 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -29,7 +29,7 @@ .col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'select2 select-wide'}) - = render 'shared/visibility_level', f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can?(current_user, :change_visibility_level, @project), form_model: @project + = render 'shared/visibility_level', f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can_change_visibility_level?(@project, current_user), form_model: @project .form-group = f.label :tag_list, "Tags", class: 'control-label' diff --git a/app/views/shared/_visibility_radios.html.haml b/app/views/shared/_visibility_radios.html.haml index 02416125a72..ebe2eb0433d 100644 --- a/app/views/shared/_visibility_radios.html.haml +++ b/app/views/shared/_visibility_radios.html.haml @@ -1,4 +1,5 @@ - Gitlab::VisibilityLevel.values.each do |level| + - next if skip_level?(form_model, level) .radio - restricted = restricted_visibility_levels.include?(level) = form.label "#{model_method}_#{level}" do diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb index 582fc759efd..335dc44be19 100644 --- a/lib/gitlab/visibility_level.rb +++ b/lib/gitlab/visibility_level.rb @@ -47,6 +47,10 @@ module Gitlab def valid_level?(level) options.has_value?(level) end + + def allowed_fork_levels(origin_level) + [PRIVATE, INTERNAL, PUBLIC].select{ |level| level <= origin_level } + end end def private? diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 0f78725e3d9..beb9b4e438e 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -8,4 +8,48 @@ describe ProjectsHelper do expect(project_status_css_class("finished")).to eq("success") end end + + describe "can_change_visibility_level?" do + let(:project) { create(:project) } + + let(:fork_project) do + fork_project = create(:forked_project_with_submodules) + fork_project.build_forked_project_link(forked_to_project_id: fork_project.id, forked_from_project_id: project.id) + fork_project.save + + fork_project + end + + let(:user) { create(:user) } + + it "returns false if there are no approipriate permissions" do + allow(helper).to receive(:can?) { false } + + expect(helper.can_change_visibility_level?(project, user)).to be_falsey + end + + it "returns true if there are permissions and it is not fork" do + allow(helper).to receive(:can?) { true } + + expect(helper.can_change_visibility_level?(project, user)).to be_truthy + end + + context "forks" do + it "returns false if there are permissions and origin project is PRIVATE" do + allow(helper).to receive(:can?) { true } + + project.update visibility_level: Gitlab::VisibilityLevel::PRIVATE + + expect(helper.can_change_visibility_level?(fork_project, user)).to be_falsey + end + + it "returns true if there are permissions and origin project is INTERNAL" do + allow(helper).to receive(:can?) { true } + + project.update visibility_level: Gitlab::VisibilityLevel::INTERNAL + + expect(helper.can_change_visibility_level?(fork_project, user)).to be_truthy + end + end + end end diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb index 3840e64981f..c4f7693329c 100644 --- a/spec/helpers/visibility_level_helper_spec.rb +++ b/spec/helpers/visibility_level_helper_spec.rb @@ -72,4 +72,43 @@ describe VisibilityLevelHelper do end end end + + describe "skip_level?" do + describe "forks" do + let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } + let(:fork_project) { create(:forked_project_with_submodules) } + + before do + fork_project.build_forked_project_link(forked_to_project_id: fork_project.id, forked_from_project_id: project.id) + fork_project.save + end + + it "skips levels" do + expect(skip_level?(fork_project, Gitlab::VisibilityLevel::PUBLIC)).to be_truthy + expect(skip_level?(fork_project, Gitlab::VisibilityLevel::INTERNAL)).to be_falsey + expect(skip_level?(fork_project, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + describe "non-forked project" do + let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } + + it "skips levels" do + expect(skip_level?(project, Gitlab::VisibilityLevel::PUBLIC)).to be_falsey + expect(skip_level?(project, Gitlab::VisibilityLevel::INTERNAL)).to be_falsey + expect(skip_level?(project, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + describe "Snippet" do + let(:snippet) { create(:snippet, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } + + it "skips levels" do + expect(skip_level?(snippet, Gitlab::VisibilityLevel::PUBLIC)).to be_falsey + expect(skip_level?(snippet, Gitlab::VisibilityLevel::INTERNAL)).to be_falsey + expect(skip_level?(snippet, Gitlab::VisibilityLevel::PRIVATE)).to be_falsey + end + end + + end end -- cgit v1.2.1 From 2b5007245adfd31e31fd2917902494853ecbc931 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Fri, 26 Jun 2015 15:19:58 +0200 Subject: Added data volumes to Dockerfile --- docker/single/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker/single/Dockerfile b/docker/single/Dockerfile index a6cbf131237..7e783eaa297 100644 --- a/docker/single/Dockerfile +++ b/docker/single/Dockerfile @@ -23,8 +23,11 @@ RUN mkdir -p /opt/gitlab/sv/sshd/supervise \ && ln -s /opt/gitlab/sv/sshd /opt/gitlab/service \ && mkdir -p /var/run/sshd -# Expose web & ssh -EXPOSE 80 22 +# Expose https & http & ssh +EXPOSE 443 80 22 + +# Define data volumes +VOLUME ["/etc/gitlab", "/var/opt/gitlab", "/var/log/gitlab"] # Copy assets COPY assets/wrapper /usr/local/bin/ -- cgit v1.2.1 From 954c1df256ac867635b31e82a032704e963a10ee Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 29 Jun 2015 17:56:34 +0200 Subject: Update Docker documentation to use single container --- docker/Dockerfile | 45 +++++++++++ docker/README.md | 166 +++++++++++++++++++++-------------------- docker/app/Dockerfile | 32 -------- docker/app/assets/wrapper | 17 ----- docker/assets/wrapper | 16 ++++ docker/data/Dockerfile | 8 -- docker/data/assets/gitlab.rb | 37 --------- docker/fig.yml | 2 + docker/marathon.json | 14 ++++ docker/single/Dockerfile | 37 --------- docker/single/assets/gitlab.rb | 37 --------- docker/single/assets/wrapper | 16 ---- docker/single/marathon.json | 14 ---- docker/troubleshooting.md | 43 +++++++---- 14 files changed, 189 insertions(+), 295 deletions(-) create mode 100644 docker/Dockerfile delete mode 100644 docker/app/Dockerfile delete mode 100755 docker/app/assets/wrapper create mode 100755 docker/assets/wrapper delete mode 100644 docker/data/Dockerfile delete mode 100644 docker/data/assets/gitlab.rb create mode 100644 docker/fig.yml create mode 100644 docker/marathon.json delete mode 100644 docker/single/Dockerfile delete mode 100644 docker/single/assets/gitlab.rb delete mode 100755 docker/single/assets/wrapper delete mode 100644 docker/single/marathon.json diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000000..86f6c896a6d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,45 @@ +FROM ubuntu:14.04 +MAINTAINER Sytse Sijbrandij + +# Install required packages +RUN apt-get update -q \ + && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ + ca-certificates \ + openssh-server \ + wget \ + apt-transport-https \ + vim \ + nano + +# Download & Install GitLab +# If you run GitLab Enterprise Edition point it to a location where you have downloaded it. +RUN echo "deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/gitlab_gitlab-ce.list +RUN wget -q -O - https://packages.gitlab.com/gpg.key | apt-key add - +RUN apt-get update && apt-get install -yq --no-install-recommends gitlab-ce + +# Manage SSHD through runit +RUN mkdir -p /opt/gitlab/sv/sshd/supervise \ + && mkfifo /opt/gitlab/sv/sshd/supervise/ok \ + && printf "#!/bin/sh\nexec 2>&1\numask 077\nexec /usr/sbin/sshd -D" > /opt/gitlab/sv/sshd/run \ + && chmod a+x /opt/gitlab/sv/sshd/run \ + && ln -s /opt/gitlab/sv/sshd /opt/gitlab/service \ + && mkdir -p /var/run/sshd + +# Prepare default configuration +RUN ( \ + echo "" && \ + echo "# Docker options" && \ + echo "# Prevent Postgres from trying to allocate 25% of total memory" && \ + echo "postgresql['shared_buffers'] = '1MB'" ) >> /etc/gitlab/gitlab.rb + +# Expose web & ssh +EXPOSE 443 80 22 + +# Define data volumes +VOLUME ["/etc/gitlab", "/var/opt/gitlab", "/var/log/gitlab"] + +# Copy assets +COPY assets/wrapper /usr/local/bin/ + +# Wrapper to handle signal, trigger runit and reconfigure GitLab +CMD ["/usr/local/bin/wrapper"] diff --git a/docker/README.md b/docker/README.md index 9507aa6a63c..dd86cf6fa69 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,150 +11,154 @@ After starting a container you can go to [http://localhost:8080/](http://localho It might take a while before the docker container is responding to queries. -You can check the status with something like `sudo docker logs -f 7c10172d7705`. +You can check the status with something like `sudo docker logs -f gitlab`. You can login to the web interface with username `root` and password `password`. Next time, you can just use docker start and stop to run the container. -## How to build the docker images +## Run the image -This guide will also let you know how to build docker images yourself. -Please run all the commands from the GitLab repo root directory. -People using boot2docker should run all the commands without sudo. +Run the image: +```bash +sudo docker run --detach \ + --publish 80443:443 --publish 8080:80 --publish 2222:22 \ + --name gitlab \ + --restart always \ + --volume /srv/gitlab/config:/etc/gitlab \ + --volume /srv/gitlab/logs:/var/log/gitlab \ + --volume /srv/gitlab/data:/var/opt/gitlab \ + gitlab/gitlab-ce:latest +``` -## Choosing between the single and the app and data images +This will start GitLab CE container and expose ports needed to access SSH, HTTP and HTTPS. +All GitLab data will be stored as subdirectories of `/srv/gitlab/`. +The container will automatically `restart` after system reboot. -Normally docker uses a single image for one applications. -But GitLab stores repositories and uploads in the filesystem. -This means that upgrades of a single image are hard. -That is why we recommend using separate app and data images. -We'll first describe how to use a single image. -After that we'll describe how to use the app and data images. +After this you can login to the web interface as explained above in 'After starting a container'. -## Single image +## Build and publish the image -Get a published image from Dockerhub: +This guide will also let you know how to build docker image yourself. +Please run all the commands from the GitLab repo root directory. +People using boot2docker should run all the commands without sudo. ```bash -sudo docker pull sytse/gitlab-ce:7.10.1 +sudo docker build --tag gitlab/gitlab-ce:latest ``` -Run the image: +## Where is the data stored? -```bash -sudo docker run --detach --publish 8080:80 --publish 2222:22 sytse/gitlab-ce:7.10.1 -``` +The GitLab container uses host mounted volumes to store persistent data: +- `/srv/gitlab/data` mounted as `/var/opt/gitlab` in the container is used for storing *application data* +- `/srv/gitlab/logs` mounted as `/var/log/gitlab` in the container is used for storing *logs* +- `/srv/gitlab/config` mounted as `/etc/gitlab` in the container is used for storing *configuration* -After this you can login to the web interface as explained above in 'After starting a container'. +You can fine tune these directories to meet your requirements. + +### Configure GitLab -Build the image: +This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`. +To access GitLab configuration, you can start an bash in a new the context of running container, you will be able to browse all directories and use your favorite text editor: ```bash -sudo docker build --tag sytse/gitlab-ce:7.10.1 docker/single/ +sudo docker exec -it gitlab /bin/bash ``` -Publish the image to Dockerhub: - +You can also edit just `/etc/gitlab/gitlab.rb`: ```bash -sudo docker push sytse/gitlab-ce +sudo docker exec -it gitlab vi /etc/gitlab/gitlab.rb ``` -Diagnosing commands: +**You should set the `external_url` to point to a valid URL.** + +**To receive e-mails from GitLab you have to configure the [SMTP settings](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md), +because Docker image doesn't have a SMTP server.** + +**Note** that GitLab will reconfigure itself **at each container start.** You will need to restart the container to reconfigure your GitLab: ```bash -sudo docker run -i -t sytse/gitlab-ce:7.10.1 -sudo docker run -ti -e TERM=linux --name gitlab-ce-troubleshoot --publish 8080:80 --publish 2222:22 sytse/gitlab-ce:7.10.1 bash /usr/local/bin/wrapper +sudo docker restart gitlab ``` -## App and data images +For more options for configuring the container please check [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration). -### Get published images from Dockerhub +## Diagnose potential problems +Read container logs: ```bash -sudo docker pull sytse/gitlab-data -sudo docker pull sytse/gitlab-app:7.10.1 +sudo docker logs gitlab ``` -### Run the images - +Enter running container: ```bash -sudo docker run --name gitlab-data sytse/gitlab-data /bin/true -sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data sytse/gitlab-app:7.10.1 +sudo docker exec -it gitlab /bin/bash ``` -After this you can login to the web interface as explained above in 'After starting a container'. +From within container you can administrer GitLab container as you would normally administer Omnibus installation: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md. -### Build images - -Build your own based on the Omnibus packages with the following commands. +### Upgrade GitLab to newer version +To upgrade GitLab to new version you have to do: +1. pull new image, ```bash -sudo docker build --tag gitlab-data docker/data/ -sudo docker build --tag gitlab-app:7.10.1 docker/app/ +sudo docker stop gitlab ``` -After this run the images: - +1. stop running container, ```bash -sudo docker run --name gitlab-data gitlab-data /bin/true -sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data gitlab-app:7.10.1 +sudo docker rm gitlab ``` -We assume using a data volume container, this will simplify migrations and backups. -This empty container will exist to persist as volumes the 3 directories used by GitLab, so remember not to delete it. - -The directories on data container are: - -- `/var/opt/gitlab` for application data -- `/var/log/gitlab` for logs -- `/etc/gitlab` for configuration - -### Configure GitLab - -This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`. - -To access GitLab configuration, you can start an interactive command line in a new container using the shared data volume container, you will be able to browse the 3 directories and use your favorite text editor: +1. remove existing container, +```bash +sudo docker pull gitlab/gitlab-ce:latest +``` +1. create the container once again with previously specified options. ```bash -sudo docker run -ti -e TERM=linux --rm --volumes-from gitlab-data ubuntu -vi /etc/gitlab/gitlab.rb +sudo docker run --detach \ + --publish 80443:443 --publish 8080:80 --publish 2222:22 \ + --name gitlab \ + --restart always \ + --volume /srv/gitlab/config:/etc/gitlab \ + --volume /srv/gitlab/logs:/var/log/gitlab \ + --volume /srv/gitlab/data:/var/opt/gitlab \ + gitlab/gitlab-ce:latest ``` -**Note** that GitLab will reconfigure itself **at each container start.** You will need to restart the container to reconfigure your GitLab. +On the first run GitLab will reconfigure and update itself. -You can find all available options in [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration). +### Run GitLab CE on public IP address -### Upgrade GitLab with app and data images +You can make Docker to use your IP address and forward all traffic to the GitLab CE container. +You can do that by modifying the `--publish` ((Binding container ports to the host)[https://docs.docker.com/articles/networking/#binding-ports]): -To upgrade GitLab to new versions, stop running container, create new docker image and container from that image. +> --publish=[] : Publish a container᾿s port or a range of ports to the host format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort -It Assumes that you're upgrading from 7.8.1 to 7.10.1 and you're in the updated GitLab repo root directory: +To expose GitLab CE on IP 1.1.1.1: ```bash -sudo docker stop gitlab-app -sudo docker rm gitlab-app -sudo docker build --tag gitlab-app:7.10.1 docker/app/ -sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data gitlab-app:7.10.1 +sudo docker run --detach \ + --publish 1.1.1.1:443:443 --publish 1.1.1.1:80:80 --publish 1.1.1.1:22:22 \ + --name gitlab \ + --restart always \ + --volume /srv/gitlab/config:/etc/gitlab \ + --volume /srv/gitlab/logs:/var/log/gitlab \ + --volume /srv/gitlab/data:/var/opt/gitlab \ + gitlab/gitlab-ce:latest ``` -On the first run GitLab will reconfigure and update itself. If everything runs OK don't forget to cleanup the app image: - -```bash -sudo docker rmi gitlab-app:7.8.1 -``` +You can then access GitLab instance at http://1.1.1.1/ and https://1.1.1.1/. ### Publish images to Dockerhub - Ensure the containers are running - Login to Dockerhub with `sudo docker login` -- Run the following (replace '7.10.1' with the version you're using and 'Sytse Sijbrandij' with your name): ```bash -sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab-app sytse/gitlab-app:7.10.1 -sudo docker push sytse/gitlab-app:7.10.1 -sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab-data sytse/gitlab-data -sudo docker push sytse/gitlab-data +sudo docker login +sudo docker push gitlab/gitlab-ce:latest ``` ## Troubleshooting diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile deleted file mode 100644 index fe3f7f0bcd2..00000000000 --- a/docker/app/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM ubuntu:14.04 - -# Install required packages -RUN apt-get update -q \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qy --no-install-recommends \ - ca-certificates \ - openssh-server \ - wget \ - apt-transport-https - -# Download & Install GitLab -# If you run GitLab Enterprise Edition point it to a location where you have downloaded it. -RUN echo "deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/gitlab_gitlab-ce.list -RUN wget -q -O - https://packages.gitlab.com/gpg.key | apt-key add - -RUN apt-get update && apt-get install -yq --no-install-recommends gitlab-ce - -# Manage SSHD through runit -RUN mkdir -p /opt/gitlab/sv/sshd/supervise \ - && mkfifo /opt/gitlab/sv/sshd/supervise/ok \ - && printf "#!/bin/sh\nexec 2>&1\numask 077\nexec /usr/sbin/sshd -D" > /opt/gitlab/sv/sshd/run \ - && chmod a+x /opt/gitlab/sv/sshd/run \ - && ln -s /opt/gitlab/sv/sshd /opt/gitlab/service \ - && mkdir -p /var/run/sshd - -# Expose web & ssh -EXPOSE 80 22 - -# Copy assets -COPY assets/wrapper /usr/local/bin/ - -# Wrapper to handle signal, trigger runit and reconfigure GitLab -CMD ["/usr/local/bin/wrapper"] \ No newline at end of file diff --git a/docker/app/assets/wrapper b/docker/app/assets/wrapper deleted file mode 100755 index 9e6e7a05903..00000000000 --- a/docker/app/assets/wrapper +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -function sigterm_handler() { - echo "SIGTERM signal received, try to gracefully shutdown all services..." - gitlab-ctl stop -} - -trap "sigterm_handler; exit" TERM - -function entrypoint() { - # Default is to run runit and reconfigure GitLab - gitlab-ctl reconfigure & - /opt/gitlab/embedded/bin/runsvdir-start & - wait -} - -entrypoint diff --git a/docker/assets/wrapper b/docker/assets/wrapper new file mode 100755 index 00000000000..966b2cab4a1 --- /dev/null +++ b/docker/assets/wrapper @@ -0,0 +1,16 @@ +#!/bin/bash + +function sigterm_handler() { + echo "SIGTERM signal received, try to gracefully shutdown all services..." + gitlab-ctl stop +} + +trap "sigterm_handler; exit" TERM + +function entrypoint() { + /opt/gitlab/embedded/bin/runsvdir-start & + gitlab-ctl reconfigure # will also start everything + gitlab-ctl tail # tail all logs +} + +entrypoint diff --git a/docker/data/Dockerfile b/docker/data/Dockerfile deleted file mode 100644 index ea0175c4aa2..00000000000 --- a/docker/data/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM busybox - -# Declare volumes -VOLUME ["/var/opt/gitlab", "/var/log/gitlab", "/etc/gitlab"] -# Copy assets -COPY assets/gitlab.rb /etc/gitlab/ - -CMD /bin/sh diff --git a/docker/data/assets/gitlab.rb b/docker/data/assets/gitlab.rb deleted file mode 100644 index 7fddf309c01..00000000000 --- a/docker/data/assets/gitlab.rb +++ /dev/null @@ -1,37 +0,0 @@ -# External URL should be your Docker instance. -# By default, this example is the "standard" boot2docker IP. -# Always use port 80 here to force the internal nginx to bind port 80, -# even if you intend to use another port in Docker. -external_url "http://192.168.59.103/" - -# Prevent Postgres from trying to allocate 25% of total memory -postgresql['shared_buffers'] = '1MB' - -# Configure GitLab to redirect PostgreSQL logs to the data volume -postgresql['log_directory'] = '/var/log/gitlab/postgresql' - -# Some configuration of GitLab -# You can find more at https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration -gitlab_rails['gitlab_email_from'] = 'gitlab@example.com' -gitlab_rails['gitlab_support_email'] = 'support@example.com' -gitlab_rails['time_zone'] = 'Europe/Paris' - -# SMTP settings -# You must use an external server, the Docker container does not install an SMTP server -gitlab_rails['smtp_enable'] = true -gitlab_rails['smtp_address'] = "smtp.example.com" -gitlab_rails['smtp_port'] = 587 -gitlab_rails['smtp_user_name'] = "user" -gitlab_rails['smtp_password'] = "password" -gitlab_rails['smtp_domain'] = "example.com" -gitlab_rails['smtp_authentication'] = "plain" -gitlab_rails['smtp_enable_starttls_auto'] = true - -# Enable LDAP authentication -# gitlab_rails['ldap_enabled'] = true -# gitlab_rails['ldap_host'] = 'ldap.example.com' -# gitlab_rails['ldap_port'] = 389 -# gitlab_rails['ldap_method'] = 'plain' # 'ssl' or 'plain' -# gitlab_rails['ldap_allow_username_or_email_login'] = false -# gitlab_rails['ldap_uid'] = 'uid' -# gitlab_rails['ldap_base'] = 'ou=users,dc=example,dc=com' diff --git a/docker/fig.yml b/docker/fig.yml new file mode 100644 index 00000000000..989551cbfe2 --- /dev/null +++ b/docker/fig.yml @@ -0,0 +1,2 @@ +app: + build: . diff --git a/docker/marathon.json b/docker/marathon.json new file mode 100644 index 00000000000..d23c2b84e0e --- /dev/null +++ b/docker/marathon.json @@ -0,0 +1,14 @@ +{ + "id": "/gitlab", + "ports": [0,0], + "cpus": 2, + "mem": 2048.0, + "disk": 10240.0, + "container": { + "type": "DOCKER", + "docker": { + "network": "HOST", + "image": "sytse/gitlab-ce:7.10.1" + } + } +} \ No newline at end of file diff --git a/docker/single/Dockerfile b/docker/single/Dockerfile deleted file mode 100644 index 7e783eaa297..00000000000 --- a/docker/single/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM ubuntu:14.04 -MAINTAINER Sytse Sijbrandij - -# Install required packages -RUN apt-get update -q \ - && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ - ca-certificates \ - openssh-server \ - wget \ - apt-transport-https - -# Download & Install GitLab -# If you run GitLab Enterprise Edition point it to a location where you have downloaded it. -RUN echo "deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/gitlab_gitlab-ce.list -RUN wget -q -O - https://packages.gitlab.com/gpg.key | apt-key add - -RUN apt-get update && apt-get install -yq --no-install-recommends gitlab-ce - -# Manage SSHD through runit -RUN mkdir -p /opt/gitlab/sv/sshd/supervise \ - && mkfifo /opt/gitlab/sv/sshd/supervise/ok \ - && printf "#!/bin/sh\nexec 2>&1\numask 077\nexec /usr/sbin/sshd -D" > /opt/gitlab/sv/sshd/run \ - && chmod a+x /opt/gitlab/sv/sshd/run \ - && ln -s /opt/gitlab/sv/sshd /opt/gitlab/service \ - && mkdir -p /var/run/sshd - -# Expose https & http & ssh -EXPOSE 443 80 22 - -# Define data volumes -VOLUME ["/etc/gitlab", "/var/opt/gitlab", "/var/log/gitlab"] - -# Copy assets -COPY assets/wrapper /usr/local/bin/ -COPY assets/gitlab.rb /etc/gitlab/ - -# Wrapper to handle signal, trigger runit and reconfigure GitLab -CMD ["/usr/local/bin/wrapper"] diff --git a/docker/single/assets/gitlab.rb b/docker/single/assets/gitlab.rb deleted file mode 100644 index ef84e7832d6..00000000000 --- a/docker/single/assets/gitlab.rb +++ /dev/null @@ -1,37 +0,0 @@ -# External URL should be your Docker instance. -# By default, GitLab will use the Docker container hostname. -# Always use port 80 here to force the internal nginx to bind port 80, -# even if you intend to use another port in Docker. -# external_url "http://192.168.59.103/" - -# Prevent Postgres from trying to allocate 25% of total memory -postgresql['shared_buffers'] = '1MB' - -# Configure GitLab to redirect PostgreSQL logs to the data volume -postgresql['log_directory'] = '/var/log/gitlab/postgresql' - -# Some configuration of GitLab -# You can find more at https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration -gitlab_rails['gitlab_email_from'] = 'gitlab@example.com' -gitlab_rails['gitlab_support_email'] = 'support@example.com' -gitlab_rails['time_zone'] = 'Europe/Paris' - -# SMTP settings -# You must use an external server, the Docker container does not install an SMTP server -gitlab_rails['smtp_enable'] = true -gitlab_rails['smtp_address'] = "smtp.example.com" -gitlab_rails['smtp_port'] = 587 -gitlab_rails['smtp_user_name'] = "user" -gitlab_rails['smtp_password'] = "password" -gitlab_rails['smtp_domain'] = "example.com" -gitlab_rails['smtp_authentication'] = "plain" -gitlab_rails['smtp_enable_starttls_auto'] = true - -# Enable LDAP authentication -# gitlab_rails['ldap_enabled'] = true -# gitlab_rails['ldap_host'] = 'ldap.example.com' -# gitlab_rails['ldap_port'] = 389 -# gitlab_rails['ldap_method'] = 'plain' # 'ssl' or 'plain' -# gitlab_rails['ldap_allow_username_or_email_login'] = false -# gitlab_rails['ldap_uid'] = 'uid' -# gitlab_rails['ldap_base'] = 'ou=users,dc=example,dc=com' diff --git a/docker/single/assets/wrapper b/docker/single/assets/wrapper deleted file mode 100755 index 966b2cab4a1..00000000000 --- a/docker/single/assets/wrapper +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -function sigterm_handler() { - echo "SIGTERM signal received, try to gracefully shutdown all services..." - gitlab-ctl stop -} - -trap "sigterm_handler; exit" TERM - -function entrypoint() { - /opt/gitlab/embedded/bin/runsvdir-start & - gitlab-ctl reconfigure # will also start everything - gitlab-ctl tail # tail all logs -} - -entrypoint diff --git a/docker/single/marathon.json b/docker/single/marathon.json deleted file mode 100644 index d23c2b84e0e..00000000000 --- a/docker/single/marathon.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "/gitlab", - "ports": [0,0], - "cpus": 2, - "mem": 2048.0, - "disk": 10240.0, - "container": { - "type": "DOCKER", - "docker": { - "network": "HOST", - "image": "sytse/gitlab-ce:7.10.1" - } - } -} \ No newline at end of file diff --git a/docker/troubleshooting.md b/docker/troubleshooting.md index 5827f2185db..63482547daa 100644 --- a/docker/troubleshooting.md +++ b/docker/troubleshooting.md @@ -9,24 +9,19 @@ postgresql['log_directory'] = '/var/log/gitlab/postgresql' # Commands ```bash -sudo docker build --tag gitlab_image docker/ +sudo docker build --tag gitlab/gitlab-ce:latest docker/ -sudo docker rm -f gitlab_app -sudo docker rm -f gitlab_data +sudo docker rm -f gitlab -sudo docker run --name gitlab_data gitlab_image /bin/true +sudo docker exec -it gitlab vim /etc/gitlab/gitlab.rb -sudo docker run -ti --rm --volumes-from gitlab_data ubuntu apt-get update && sudo apt-get install -y vim && sudo vim /etc/gitlab/gitlab.rb +sudo docker exec gitlab tail -f /var/log/gitlab/reconfigure.log -sudo docker run --detach --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_image +sudo docker exec gitlab tail -f /var/log/gitlab/postgresql/current -sudo docker run -t --rm --volumes-from gitlab_data ubuntu tail -f /var/log/gitlab/reconfigure.log +sudo docker exec gitlab cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers -sudo docker run -t --rm --volumes-from gitlab_data ubuntu tail -f /var/log/gitlab/postgresql/current - -sudo docker run -t --rm --volumes-from gitlab_data ubuntu cat /var/opt/gitlab/postgresql/data/postgresql.conf | grep shared_buffers - -sudo docker run -t --rm --volumes-from gitlab_data ubuntu cat /etc/gitlab/gitlab.rb +sudo docker exec gitlab cat /etc/gitlab/gitlab.rb ``` # Interactively @@ -37,7 +32,16 @@ sudo docker run -t --rm --volumes-from gitlab_data ubuntu cat /etc/gitlab/gitlab # - we run interactively (-t -i) # - we define TERM=linux because it allows to use arrow keys in vi (!!!) # - we choose another startup command (bash) -sudo docker run -ti -e TERM=linux --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_image bash +sudo docker run --ti \ + -e TERM=linux + --publish 80443:443 --publish 8080:80 --publish 2222:22 \ + --name gitlab \ + --restart always \ + --volume /srv/gitlab/config:/etc/gitlab \ + --volume /srv/gitlab/logs:/var/log/gitlab \ + --volume /srv/gitlab/data:/var/opt/gitlab \ + gitlab/gitlab-ce:latest \ + bash # Configure GitLab to redirect PostgreSQL logs echo "postgresql['log_directory'] = '/var/log/gitlab/postgresql'" >> /etc/gitlab/gitlab.rb @@ -64,10 +68,17 @@ free -m # Cleanup -Remove ALL docker containers and images (also non GitLab ones): +Remove ALL docker containers and images (also non GitLab ones). +**Be careful, because the `-v` also removes volumes attached to the images.** -``` -docker rm $(docker ps -a -q) +```bash +# Remove all containers with attached volumes +docker rm -v $(docker ps -a -q) + +# Remove all images docker rmi $(docker images -q) + +# Remove GitLab persistent data +rm -rf /srv/gitlab ``` -- cgit v1.2.1 From d999e414b98e5ed5c634cb6f964de8ef7595c69f Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 6 Jul 2015 16:32:59 +0200 Subject: Final touches --- docker/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docker/README.md b/docker/README.md index dd86cf6fa69..b3dd18c2cdf 100644 --- a/docker/README.md +++ b/docker/README.md @@ -31,22 +31,12 @@ sudo docker run --detach \ gitlab/gitlab-ce:latest ``` -This will start GitLab CE container and expose ports needed to access SSH, HTTP and HTTPS. +This will download and start GitLab CE container and publish ports needed to access SSH, HTTP and HTTPS. All GitLab data will be stored as subdirectories of `/srv/gitlab/`. The container will automatically `restart` after system reboot. After this you can login to the web interface as explained above in 'After starting a container'. -## Build and publish the image - -This guide will also let you know how to build docker image yourself. -Please run all the commands from the GitLab repo root directory. -People using boot2docker should run all the commands without sudo. - -```bash -sudo docker build --tag gitlab/gitlab-ce:latest -``` - ## Where is the data stored? The GitLab container uses host mounted volumes to store persistent data: @@ -151,7 +141,17 @@ sudo docker run --detach \ You can then access GitLab instance at http://1.1.1.1/ and https://1.1.1.1/. -### Publish images to Dockerhub +### Build the image + +This guide will also let you know how to build docker image yourself. +Please run the command from the GitLab repo root directory. +People using boot2docker should run all the commands without sudo. + +```bash +sudo docker build --tag gitlab/gitlab-ce:latest docker/ +``` + +### Publish the image to Dockerhub - Ensure the containers are running - Login to Dockerhub with `sudo docker login` -- cgit v1.2.1 From 2963e7fd1c64af8482eaa82579ccdef5af1ef55a Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt Date: Thu, 2 Jul 2015 20:12:24 +0200 Subject: Add ref switching support for graphs It is now possible to view contributor and commit statistics for refs beyond the default branch. Additionally, conditions in RefsController#switch have been refactored in order that a `case` block is used now. --- CHANGELOG | 1 + app/controllers/projects/graphs_controller.rb | 7 +++++-- app/controllers/projects/refs_controller.rb | 26 +++++++++++++++----------- app/views/projects/graphs/commits.html.haml | 4 +++- app/views/projects/graphs/show.html.haml | 6 ++++-- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2d41a65d2df..bafc7390f4a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.13.0 (unreleased) - Fix redirection to home page URL for unauthorized users (Daniel Gerhardt) + - Add branch switching support for graphs (Daniel Gerhardt) - Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt) - Remove link leading to a 404 error in Deploy Keys page (Stan Hu) - Add support for unlocking users in admin settings (Stan Hu) diff --git a/app/controllers/projects/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb index a060ea6f998..0b6f7f5c91e 100644 --- a/app/controllers/projects/graphs_controller.rb +++ b/app/controllers/projects/graphs_controller.rb @@ -1,6 +1,9 @@ class Projects::GraphsController < Projects::ApplicationController + include ExtractsPath + # Authorize before_action :require_non_empty_project + before_action :assign_ref_vars before_action :authorize_download_code! def show @@ -13,7 +16,7 @@ class Projects::GraphsController < Projects::ApplicationController end def commits - @commits = @project.repository.commits(nil, nil, 2000, 0, true) + @commits = @project.repository.commits(@ref, nil, 2000, 0, true) @commits_graph = Gitlab::Graphs::Commits.new(@commits) @commits_per_week_days = @commits_graph.commits_per_week_days @commits_per_time = @commits_graph.commits_per_time @@ -23,7 +26,7 @@ class Projects::GraphsController < Projects::ApplicationController private def fetch_graph - @commits = @project.repository.commits(nil, nil, 6000, 0, true) + @commits = @project.repository.commits(@ref, nil, 6000, 0, true) @log = [] @commits.each do |commit| diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index 01ca1537c0e..d83561cf32a 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -8,17 +8,21 @@ class Projects::RefsController < Projects::ApplicationController def switch respond_to do |format| format.html do - new_path = if params[:destination] == "tree" - namespace_project_tree_path(@project.namespace, @project, - (@id)) - elsif params[:destination] == "blob" - namespace_project_blob_path(@project.namespace, @project, - (@id)) - elsif params[:destination] == "graph" - namespace_project_network_path(@project.namespace, @project, @id, @options) - else - namespace_project_commits_path(@project.namespace, @project, @id) - end + new_path = + case params[:destination] + when "tree" + namespace_project_tree_path(@project.namespace, @project, @id) + when "blob" + namespace_project_blob_path(@project.namespace, @project, @id) + when "graph" + namespace_project_network_path(@project.namespace, @project, @id, @options) + when "graphs" + namespace_project_graph_path(@project.namespace, @project, @id) + when "graphs_commits" + commits_namespace_project_graph_path(@project.namespace, @project, @id) + else + namespace_project_commits_path(@project.namespace, @project, @id) + end redirect_to new_path end diff --git a/app/views/projects/graphs/commits.html.haml b/app/views/projects/graphs/commits.html.haml index 254a76e108b..141acbdcf72 100644 --- a/app/views/projects/graphs/commits.html.haml +++ b/app/views/projects/graphs/commits.html.haml @@ -1,9 +1,11 @@ - page_title "Commit statistics" +.tree-ref-holder + = render 'shared/ref_switcher', destination: 'graphs_commits' = render 'head' %p.lead Commit statistics for - %strong #{@repository.root_ref} + %strong #{@ref} #{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')} .row diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml index 3a8dc89f84c..ecdd0eaf52f 100644 --- a/app/views/projects/graphs/show.html.haml +++ b/app/views/projects/graphs/show.html.haml @@ -1,5 +1,8 @@ - page_title "Contributor statistics" +.tree-ref-holder + = render 'shared/ref_switcher', destination: 'graphs' = render 'head' + .loading-graph .center %h3.page-title @@ -11,7 +14,7 @@ .header.clearfix %h3#date_header.page-title %p.light - Commits to #{@project.default_branch}, excluding merge commits. Limited by 6,000 commits + Commits to #{@ref}, excluding merge commits. Limited by 6,000 commits %input#brush_change{:type => "hidden"} .graphs #contributors-master @@ -35,4 +38,3 @@ $(".stat-graph").fadeIn(); $(".loading-graph").hide(); dataType: "json" - -- cgit v1.2.1 From 603ceea21a0144ff1900106efa0c17e759eeceef Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 6 Jul 2015 16:47:19 +0200 Subject: Add tests and improve logic Signed-off-by: Dmitriy Zaporozhets --- lib/api/settings.rb | 3 ++- spec/requests/api/settings_spec.rb | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/api/settings.rb b/lib/api/settings.rb index 4aa81bf8bab..c885fcd7ea3 100644 --- a/lib/api/settings.rb +++ b/lib/api/settings.rb @@ -4,7 +4,8 @@ module API helpers do def current_settings - @current_setting ||= ApplicationSetting.current + @current_setting ||= + (ApplicationSetting.current || ApplicationSetting.create_from_defaults) end end diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb index 2ab31c6a10a..c815a8e1d73 100644 --- a/spec/requests/api/settings_spec.rb +++ b/spec/requests/api/settings_spec.rb @@ -7,11 +7,23 @@ describe API::API, 'Settings', api: true do let(:admin) { create(:admin) } - describe "GET /applicaiton/settings" do - # TODO: Implement + describe "GET /application/settings" do + it "should return application settings" do + get api("/application/settings", admin) + expect(response.status).to eq(200) + expect(json_response).to be_an Hash + expect(json_response['default_projects_limit']).to eq(42) + expect(json_response['signin_enabled']).to be_truthy + end end - describe "PUT /applicaiton/settings" do - # TODO: Implement + describe "PUT /application/settings" do + it "should update application settings" do + put api("/application/settings", admin), + default_projects_limit: 3, signin_enabled: false + expect(response.status).to eq(200) + expect(json_response['default_projects_limit']).to eq(3) + expect(json_response['signin_enabled']).to be_falsey + end end end -- cgit v1.2.1 From e906008eb82ce04534fd72fd6013ed7ef79fda1e Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 6 Jul 2015 16:57:46 +0200 Subject: Fix port 80443 => 8443 --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index b3dd18c2cdf..507d88e0e71 100644 --- a/docker/README.md +++ b/docker/README.md @@ -22,7 +22,7 @@ Next time, you can just use docker start and stop to run the container. Run the image: ```bash sudo docker run --detach \ - --publish 80443:443 --publish 8080:80 --publish 2222:22 \ + --publish 8443:443 --publish 8080:80 --publish 2222:22 \ --name gitlab \ --restart always \ --volume /srv/gitlab/config:/etc/gitlab \ -- cgit v1.2.1 From 69c659ebd3387ec331a30d6bf53d989803f7276f Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 23 Jun 2015 15:45:24 +0200 Subject: Compress database backup --- CHANGELOG | 2 ++ doc/update/mysql_to_postgresql.md | 5 ++++- lib/backup/database.rb | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index d538bb42992..4bb9714ac7c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -51,6 +51,8 @@ v 7.12.1 - Fix closed merge request scope at milestone page (Dmitriy Zaporozhets) - Revert merge request states renaming - Fix hooks for web based events with external issue references (Daniel Gerhardt) + - Improve performance for issue and merge request pages + - Compress database dumps to reduce backup size v 7.12.0 - Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 2c43cf59c1f..8ef3e0d55cc 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -57,12 +57,15 @@ sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter. sudo -u git -H mkdir db sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql +# Compress database backup +sudo -u git -H gzip db/database.sql + # Replace the MySQL dump in TIMESTAMP_gitlab_backup.tar. # Warning: if you forget to replace TIMESTAMP below, tar will create a new file # 'TIMESTAMP_gitlab_backup.tar' without giving an error. -sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql +sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql.gz # Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab # installation. Remember to recreate the indexes after the import. diff --git a/lib/backup/database.rb b/lib/backup/database.rb index 9ab6aca276d..f677f8def2b 100644 --- a/lib/backup/database.rb +++ b/lib/backup/database.rb @@ -22,9 +22,19 @@ module Backup end report_success(success) abort 'Backup failed' unless success + + $progress.print 'Compressing database ... ' + success = system('gzip', db_file_name) + report_success(success) + abort 'Backup failed: compress error' unless success end def restore + $progress.print 'Decompressing database ... ' + success = system('gzip', '-d', db_file_name_gz) + report_success(success) + abort 'Restore failed: decompress error' unless success + success = case config["adapter"] when /^mysql/ then $progress.print "Restoring MySQL database #{config['database']} ... " @@ -48,6 +58,10 @@ module Backup File.join(db_dir, 'database.sql') end + def db_file_name_gz + File.join(db_dir, 'database.sql.gz') + end + def mysql_args args = { 'host' => '--host', -- cgit v1.2.1 From 4254f09eaa851d867f440420d719313dd2f13f82 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 16 Jun 2015 00:00:55 -0700 Subject: Return 40x error codes if branch could not be deleted in UI --- CHANGELOG | 1 + app/controllers/projects/branches_controller.rb | 4 ++-- spec/controllers/branches_controller_spec.rb | 26 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 49b93b977bb..6f607e2da06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,7 @@ v 7.13.0 (unreleased) - Update maintenance documentation to explain no need to recompile asssets for omnibus installations (Stan Hu) - Support commenting on diffs in side-by-side mode (Stan Hu) - Fix JavaScript error when clicking on the comment button on a diff line that has a comment already (Stan Hu) + - Return 40x error codes if branch could not be deleted in UI (Stan Hu) - Remove project visibility icons from dashboard projects list - Rename "Design" profile settings page to "Preferences". - Allow users to customize their default Dashboard page. diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 696011b94b9..117ae3aaa3d 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -32,7 +32,7 @@ class Projects::BranchesController < Projects::ApplicationController end def destroy - DeleteBranchService.new(project, current_user).execute(params[:id]) + status = DeleteBranchService.new(project, current_user).execute(params[:id]) @branch_name = params[:id] respond_to do |format| @@ -40,7 +40,7 @@ class Projects::BranchesController < Projects::ApplicationController redirect_to namespace_project_branches_path(@project.namespace, @project) end - format.js + format.js { render status: status[:return_code] } end end end diff --git a/spec/controllers/branches_controller_spec.rb b/spec/controllers/branches_controller_spec.rb index db3b64babcd..bd4c946b64b 100644 --- a/spec/controllers/branches_controller_spec.rb +++ b/spec/controllers/branches_controller_spec.rb @@ -55,4 +55,30 @@ describe Projects::BranchesController do it { is_expected.to render_template('new') } end end + + describe "POST destroy" do + render_views + + before do + post :destroy, + format: :js, + id: branch, + namespace_id: project.namespace.to_param, + project_id: project.to_param + end + + context "valid branch name, valid source" do + let(:branch) { "feature" } + + it { expect(response.status).to eq(200) } + it { expect(subject).to render_template('destroy') } + end + + context "invalid branch name, valid ref" do + let(:branch) { "no-branch" } + + it { expect(response.status).to eq(404) } + it { expect(subject).to render_template('destroy') } + end + end end -- cgit v1.2.1 From 5ee8ae4894fd39c404ae035c623217143ef42849 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Mon, 6 Jul 2015 22:03:36 +0200 Subject: Detail too many warning to explain that merge will still work. --- app/views/projects/diffs/_warning.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/diffs/_warning.html.haml b/app/views/projects/diffs/_warning.html.haml index bd0b7376ba7..da3d4be84ba 100644 --- a/app/views/projects/diffs/_warning.html.haml +++ b/app/views/projects/diffs/_warning.html.haml @@ -1,6 +1,6 @@ .alert.alert-warning %h4 - Too many changes. + Too many changes to show. .pull-right - unless diff_hard_limit_enabled? = link_to "Reload with full diff", url_for(params.merge(force_show_diff: true)), class: "btn btn-sm btn-warning" -- cgit v1.2.1 From 9e53ad5e2075640440b90fa5ee7e9951bbd28dac Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 24 Jun 2015 17:13:21 -0400 Subject: Bump select2-rails version --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index f2cd20ada73..3593e54f0d7 100644 --- a/Gemfile +++ b/Gemfile @@ -203,7 +203,7 @@ gem 'jquery-ui-rails' gem 'nprogress-rails' gem 'raphael-rails', '~> 2.1.2' gem 'request_store' -gem 'select2-rails' +gem 'select2-rails', '~> 3.5.9' gem 'virtus' group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 7641d908131..a4eb22e5b80 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -598,7 +598,7 @@ GEM seed-fu (2.3.5) activerecord (>= 3.1, < 4.3) activesupport (>= 3.1, < 4.3) - select2-rails (3.5.2) + select2-rails (3.5.9.3) thor (~> 0.14) settingslogic (2.0.9) sexp_processor (4.4.5) @@ -842,7 +842,7 @@ DEPENDENCIES sass-rails (~> 4.0.5) sdoc seed-fu - select2-rails + select2-rails (~> 3.5.9) settingslogic shoulda-matchers (~> 2.8.0) sidekiq (~> 3.3) -- cgit v1.2.1 From ea565653a06125689cf30326bacfae812e1f2800 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Mon, 6 Jul 2015 19:50:36 -0400 Subject: Bump capybara to 2.4.0 --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 3593e54f0d7..cde8d631ab5 100644 --- a/Gemfile +++ b/Gemfile @@ -250,7 +250,7 @@ group :development, :test do # Generate Fake data gem 'ffaker', '~> 2.0.0' - gem 'capybara', '~> 2.3.0' + gem 'capybara', '~> 2.4.0' gem 'capybara-screenshot', '~> 1.0.0' gem 'poltergeist', '~> 1.6.0' diff --git a/Gemfile.lock b/Gemfile.lock index a4eb22e5b80..8114063cee0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,7 +82,7 @@ GEM columnize (~> 0.8) debugger-linecache (~> 1.2) cal-heatmap-rails (0.0.1) - capybara (2.3.0) + capybara (2.4.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -753,7 +753,7 @@ DEPENDENCIES browser (~> 0.8.0) byebug cal-heatmap-rails (~> 0.0.1) - capybara (~> 2.3.0) + capybara (~> 2.4.0) capybara-screenshot (~> 1.0.0) carrierwave charlock_holmes @@ -878,4 +878,4 @@ DEPENDENCIES wikicloth (= 0.8.1) BUNDLED WITH - 1.10.4 + 1.10.5 -- cgit v1.2.1 From 3ee3cb24d44e8a9a1284fbd0944b9fcfb938c494 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 24 Jun 2015 18:07:29 -0400 Subject: Allow user to filter by Issues/Merge Requests without a Milestone --- app/finders/issuable_finder.rb | 9 +++-- app/helpers/milestones_helper.rb | 2 ++ app/models/no_milestone.rb | 13 ++++++++ app/views/shared/issuable/_filter.html.haml | 8 +++-- spec/features/issues/filter_by_milestone_spec.rb | 38 ++++++++++++++++++++++ .../merge_requests/filter_by_milestone_spec.rb | 38 ++++++++++++++++++++++ 6 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 app/models/no_milestone.rb create mode 100644 spec/features/issues/filter_by_milestone_spec.rb create mode 100644 spec/features/merge_requests/filter_by_milestone_spec.rb diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 2eccc0ee31f..872c63d82bd 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -76,7 +76,7 @@ class IssuableFinder return @milestones if defined?(@milestones) @milestones = - if milestones? && params[:milestone_title] != NONE + if milestones? && params[:milestone_title] != NoMilestone.title Milestone.where(title: params[:milestone_title]) else nil @@ -183,7 +183,12 @@ class IssuableFinder def by_milestone(items) if milestones? - items = items.where(milestone_id: milestones.try(:pluck, :id)) + # `milestone_title` will still be present when "No Milestone" is selected + if params[:milestone_title] != NoMilestone.title + items = items.where(milestone_id: milestones.try(:pluck, :id)) + else + items = items.where(milestone_id: NoMilestone.id) + end end items diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index 93e33ebefd8..3dedc405365 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -29,6 +29,8 @@ module MilestonesHelper end.active grouped_milestones = Milestones::GroupService.new(milestones).execute + grouped_milestones.unshift(NoMilestone) + options_from_collection_for_select(grouped_milestones, 'title', 'title', params[:milestone_title]) end end diff --git a/app/models/no_milestone.rb b/app/models/no_milestone.rb new file mode 100644 index 00000000000..0c7418b5e29 --- /dev/null +++ b/app/models/no_milestone.rb @@ -0,0 +1,13 @@ +# NoMilestone +# +# Represents a "No Milestone" state used for filtering Issues and Merge Requests +# that have no milestone assigned. +class NoMilestone + def self.id + nil + end + + def self.title + 'No Milestone' + end +end diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml index a829782fc4f..0e8da8de723 100644 --- a/app/views/shared/issuable/_filter.html.haml +++ b/app/views/shared/issuable/_filter.html.haml @@ -43,11 +43,15 @@ placeholder: 'Author', class: 'trigger-submit', any_user: true, first_user: true) .filter-item.inline.milestone-filter - = select_tag('milestone_title', projects_milestones_options, class: "select2 trigger-submit", prompt: 'Milestone') + = select_tag('milestone_title', projects_milestones_options, + class: 'select2 trigger-submit', include_blank: true, + data: {placeholder: 'Milestone'}) - if @project .filter-item.inline.labels-filter - = select_tag('label_name', project_labels_options(@project), class: "select2 trigger-submit", prompt: 'Label') + = select_tag('label_name', project_labels_options(@project), + class: 'select2 trigger-submit', include_blank: true, + data: {placeholder: 'Label'}) .pull-right = render 'shared/sort_dropdown' diff --git a/spec/features/issues/filter_by_milestone_spec.rb b/spec/features/issues/filter_by_milestone_spec.rb new file mode 100644 index 00000000000..ad8adf4d372 --- /dev/null +++ b/spec/features/issues/filter_by_milestone_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +feature 'Issue filtering by Milestone' do + include Select2Helper + + let(:project) { create(:empty_project) } + + before do + login_as(:admin) + end + + scenario 'User filters by Issues without a Milestone', js: true do + create(:issue, project: project) + + visit_issues + filter_by_milestone(NoMilestone.title) + + expect(page).to have_css('.issue-title', count: 1) + end + + scenario 'User filters by Issues with a specific Milestone', js: true do + milestone = create(:milestone, project: project) + create(:issue, project: project, milestone: milestone) + + visit_issues + filter_by_milestone(milestone.title) + + expect(page).to have_css('.issue-title', count: 1) + end + + def visit_issues + visit namespace_project_issues_path(project.namespace, project) + end + + def filter_by_milestone(title) + select2(title, from: '#milestone_title') + end +end diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb new file mode 100644 index 00000000000..56a9603f139 --- /dev/null +++ b/spec/features/merge_requests/filter_by_milestone_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +feature 'Merge Request filtering by Milestone' do + include Select2Helper + + let(:project) { create(:project) } + + before do + login_as(:admin) + end + + scenario 'User filters by Merge Requests without a Milestone', js: true do + create(:merge_request, :simple, source_project: project) + + visit_merge_requests + filter_by_milestone(NoMilestone.title) + + expect(page).to have_css('.merge-request-title', count: 1) + end + + scenario 'User filters by Merge Requests with a specific Milestone', js: true do + milestone = create(:milestone, project: project) + create(:merge_request, :simple, source_project: project, milestone: milestone) + + visit_merge_requests + filter_by_milestone(milestone.title) + + expect(page).to have_css('.merge-request-title', count: 1) + end + + def visit_merge_requests + visit namespace_project_merge_requests_path(project.namespace, project) + end + + def filter_by_milestone(title) + select2(title, from: '#milestone_title') + end +end -- cgit v1.2.1 From cfd813402deb631bdc4db9af68c6366ff1179f4a Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 24 Jun 2015 21:47:20 -0400 Subject: Remove duplicate feature spec for filtering issues by no milestone --- spec/features/issues_spec.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 808a6eeb958..32fd4065bb4 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -92,22 +92,6 @@ describe 'Issues', feature: true do let(:issue) { @issue } - it 'should allow filtering by issues with no specified milestone' do - visit namespace_project_issues_path(project.namespace, project, milestone_title: IssuableFinder::NONE) - - expect(page).not_to have_content 'foobar' - expect(page).to have_content 'barbaz' - expect(page).to have_content 'gitlab' - end - - it 'should allow filtering by a specified milestone' do - visit namespace_project_issues_path(project.namespace, project, milestone_title: issue.milestone.title) - - expect(page).to have_content 'foobar' - expect(page).not_to have_content 'barbaz' - expect(page).not_to have_content 'gitlab' - end - it 'should allow filtering by issues with no specified assignee' do visit namespace_project_issues_path(project.namespace, project, assignee_id: IssuableFinder::NONE) -- cgit v1.2.1 From d00cb00d6b62c561da79b3fc0eab579364b3e91c Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sun, 28 Jun 2015 16:12:32 -0400 Subject: Rename NoMilestone to Milestone::None Also refactors IssuableFinder to avoid redundant title check. --- app/finders/issuable_finder.rb | 11 +++-------- app/helpers/milestones_helper.rb | 2 +- app/models/milestone.rb | 4 ++++ app/models/no_milestone.rb | 13 ------------- spec/features/issues/filter_by_milestone_spec.rb | 2 +- spec/features/merge_requests/filter_by_milestone_spec.rb | 2 +- 6 files changed, 10 insertions(+), 24 deletions(-) delete mode 100644 app/models/no_milestone.rb diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 872c63d82bd..ab89aa2c53a 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -10,7 +10,7 @@ # state: 'open' or 'closed' or 'all' # group_id: integer # project_id: integer -# milestone_id: integer +# milestone_title: string # assignee_id: integer # search: string # label_name: string @@ -76,7 +76,7 @@ class IssuableFinder return @milestones if defined?(@milestones) @milestones = - if milestones? && params[:milestone_title] != NoMilestone.title + if milestones? && params[:milestone_title] != Milestone::None.title Milestone.where(title: params[:milestone_title]) else nil @@ -183,12 +183,7 @@ class IssuableFinder def by_milestone(items) if milestones? - # `milestone_title` will still be present when "No Milestone" is selected - if params[:milestone_title] != NoMilestone.title - items = items.where(milestone_id: milestones.try(:pluck, :id)) - else - items = items.where(milestone_id: NoMilestone.id) - end + items = items.where(milestone_id: milestones.try(:pluck, :id)) end items diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index 3dedc405365..132a893e532 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -29,7 +29,7 @@ module MilestonesHelper end.active grouped_milestones = Milestones::GroupService.new(milestones).execute - grouped_milestones.unshift(NoMilestone) + grouped_milestones.unshift(Milestone::None) options_from_collection_for_select(grouped_milestones, 'title', 'title', params[:milestone_title]) end diff --git a/app/models/milestone.rb b/app/models/milestone.rb index e0c5fec97b7..d28f3c8d3f9 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -14,6 +14,10 @@ # class Milestone < ActiveRecord::Base + # Represents a "No Milestone" state used for filtering Issues and Merge + # Requests that have no milestone assigned. + None = Struct.new(:title).new('No Milestone') + include InternalId include Sortable diff --git a/app/models/no_milestone.rb b/app/models/no_milestone.rb deleted file mode 100644 index 0c7418b5e29..00000000000 --- a/app/models/no_milestone.rb +++ /dev/null @@ -1,13 +0,0 @@ -# NoMilestone -# -# Represents a "No Milestone" state used for filtering Issues and Merge Requests -# that have no milestone assigned. -class NoMilestone - def self.id - nil - end - - def self.title - 'No Milestone' - end -end diff --git a/spec/features/issues/filter_by_milestone_spec.rb b/spec/features/issues/filter_by_milestone_spec.rb index ad8adf4d372..284e38a1a09 100644 --- a/spec/features/issues/filter_by_milestone_spec.rb +++ b/spec/features/issues/filter_by_milestone_spec.rb @@ -13,7 +13,7 @@ feature 'Issue filtering by Milestone' do create(:issue, project: project) visit_issues - filter_by_milestone(NoMilestone.title) + filter_by_milestone(Milestone::None.title) expect(page).to have_css('.issue-title', count: 1) end diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb index 56a9603f139..308d8101bdd 100644 --- a/spec/features/merge_requests/filter_by_milestone_spec.rb +++ b/spec/features/merge_requests/filter_by_milestone_spec.rb @@ -13,7 +13,7 @@ feature 'Merge Request filtering by Milestone' do create(:merge_request, :simple, source_project: project) visit_merge_requests - filter_by_milestone(NoMilestone.title) + filter_by_milestone(Milestone::None.title) expect(page).to have_css('.merge-request-title', count: 1) end -- cgit v1.2.1 From 4b4351a18c5cc31cc1365b24b8c00360730cd100 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sun, 28 Jun 2015 16:19:52 -0400 Subject: Add `feature` tag to feature specs Not to be confused with the RSpec `type: :feature` tag, this tag is used by the `spec:feature` Rake task for filtering/grouping specs. --- spec/features/groups_spec.rb | 2 +- spec/features/issues/filter_by_milestone_spec.rb | 4 ++-- spec/features/login_spec.rb | 2 +- spec/features/markdown_spec.rb | 2 +- spec/features/merge_requests/filter_by_milestone_spec.rb | 2 +- spec/features/notes_on_merge_requests_spec.rb | 2 +- spec/features/password_reset_spec.rb | 2 +- spec/features/profiles/preferences_spec.rb | 2 +- spec/features/projects_spec.rb | 2 +- spec/features/users_spec.rb | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index edc1c63a0aa..891df65216d 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Group' do +feature 'Group', feature: true do describe 'description' do let(:group) { create(:group) } let(:path) { group_path(group) } diff --git a/spec/features/issues/filter_by_milestone_spec.rb b/spec/features/issues/filter_by_milestone_spec.rb index 284e38a1a09..575ce23bb67 100644 --- a/spec/features/issues/filter_by_milestone_spec.rb +++ b/spec/features/issues/filter_by_milestone_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -feature 'Issue filtering by Milestone' do +feature 'Issue filtering by Milestone', feature: true do include Select2Helper - let(:project) { create(:empty_project) } + let(:project) { create(:project) } before do login_as(:admin) diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb index 046a9f6191d..cef432e512b 100644 --- a/spec/features/login_spec.rb +++ b/spec/features/login_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Login' do +feature 'Login', feature: true do describe 'with two-factor authentication' do context 'with valid username/password' do let(:user) { create(:user, :two_factor) } diff --git a/spec/features/markdown_spec.rb b/spec/features/markdown_spec.rb index 902968cebcb..b8199aa5e61 100644 --- a/spec/features/markdown_spec.rb +++ b/spec/features/markdown_spec.rb @@ -32,7 +32,7 @@ require 'erb' # # See the MarkdownFeature class for setup details. -describe 'GitLab Markdown' do +describe 'GitLab Markdown', feature: true do include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper include Capybara::Node::Matchers diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb index 308d8101bdd..79b226bcd86 100644 --- a/spec/features/merge_requests/filter_by_milestone_spec.rb +++ b/spec/features/merge_requests/filter_by_milestone_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Merge Request filtering by Milestone' do +feature 'Merge Request filtering by Milestone', feature: true do include Select2Helper let(:project) { create(:project) } diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index ad37b589b84..d7cb3b2e86e 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Comments' do +describe 'Comments', feature: true do include RepoHelpers describe 'On a merge request', js: true, feature: true do diff --git a/spec/features/password_reset_spec.rb b/spec/features/password_reset_spec.rb index a34efce09ef..2b6311e4fd7 100644 --- a/spec/features/password_reset_spec.rb +++ b/spec/features/password_reset_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Password reset' do +feature 'Password reset', feature: true do def forgot_password click_on 'Forgot your password?' fill_in 'Email', with: user.email diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb index 03e78c533db..9bc6145dda4 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/preferences_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Profile > Preferences' do +describe 'Profile > Preferences', feature: true do let(:user) { create(:user) } before do diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index f8eea70ec4a..c8d44efdc8b 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Project' do +feature 'Project', feature: true do describe 'description' do let(:project) { create(:project) } let(:path) { namespace_project_path(project.namespace, project) } diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index a4c3dfe9205..efcb8a31abe 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Users' do +feature 'Users', feature: true do scenario 'GET /users/sign_in creates a new user account' do visit new_user_session_path fill_in 'user_name', with: 'Name Surname' -- cgit v1.2.1 From cf7c57aaf53036483da35868da84596dcdae2aaf Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 1 Jul 2015 17:21:51 -0400 Subject: Use stub_application_setting in a few more specs These specs also failed when run by themselves before this change, so we've likely got some kind of cross-test contamination going on. --- spec/features/profile_spec.rb | 6 ++---- spec/requests/api/projects_spec.rb | 4 +--- spec/services/create_snippet_service_spec.rb | 6 +----- spec/services/git_push_service_spec.rb | 8 ++------ spec/services/projects/create_service_spec.rb | 4 +--- spec/services/projects/update_service_spec.rb | 4 +--- spec/services/update_snippet_service_spec.rb | 6 +----- spec/support/stub_configuration.rb | 26 ++++++++++++++++++++++++++ 8 files changed, 35 insertions(+), 29 deletions(-) diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index 9fe2e610555..c80253fead8 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -9,8 +9,7 @@ describe 'Profile account page', feature: true do describe 'when signup is enabled' do before do - allow_any_instance_of(ApplicationSetting). - to receive(:signup_enabled?).and_return(true) + stub_application_setting(signup_enabled: true) visit profile_account_path end @@ -24,8 +23,7 @@ describe 'Profile account page', feature: true do describe 'when signup is disabled' do before do - allow_any_instance_of(ApplicationSetting). - to receive(:signup_enabled?).and_return(false) + stub_application_setting(signup_enabled: false) visit profile_account_path end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index e9ff832603f..4178bb2e836 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -220,9 +220,7 @@ describe API::API, api: true do context 'when a visibility level is restricted' do before do @project = attributes_for(:project, { public: true }) - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return([20]) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) end it 'should not allow a non-admin to use a restricted visibility level' do diff --git a/spec/services/create_snippet_service_spec.rb b/spec/services/create_snippet_service_spec.rb index 08689c15ca8..8edabe9450b 100644 --- a/spec/services/create_snippet_service_spec.rb +++ b/spec/services/create_snippet_service_spec.rb @@ -14,11 +14,7 @@ describe CreateSnippetService do context 'When public visibility is restricted' do before do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return( - [Gitlab::VisibilityLevel::PUBLIC] - ) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC) end diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index 3373b97bfd4..62cef9db534 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -124,9 +124,7 @@ describe GitPushService do end it "when pushing a branch for the first time with default branch protection disabled" do - allow(ApplicationSetting.current_application_settings). - to receive(:default_branch_protection). - and_return(Gitlab::Access::PROTECTION_NONE) + stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_NONE) expect(project).to receive(:execute_hooks) expect(project.default_branch).to eq("master") @@ -135,9 +133,7 @@ describe GitPushService do end it "when pushing a branch for the first time with default branch protection set to 'developers can push'" do - allow(ApplicationSetting.current_application_settings). - to receive(:default_branch_protection). - and_return(Gitlab::Access::PROTECTION_DEV_CAN_PUSH) + stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_DEV_CAN_PUSH) expect(project).to receive(:execute_hooks) expect(project.default_branch).to eq("master") diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 337dae592dd..97b206c9854 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -58,9 +58,7 @@ describe Projects::CreateService do context 'restricted visibility level' do before do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return([20]) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) @opts.merge!( visibility_level: Gitlab::VisibilityLevel.options['Public'] diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index 0dd6980a44f..b347fa15f87 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -47,9 +47,7 @@ describe Projects::UpdateService do context 'respect configured visibility restrictions setting' do before(:each) do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return([20]) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) end context 'should be private when updated to private' do diff --git a/spec/services/update_snippet_service_spec.rb b/spec/services/update_snippet_service_spec.rb index 841ef9bfed1..d7c516e3934 100644 --- a/spec/services/update_snippet_service_spec.rb +++ b/spec/services/update_snippet_service_spec.rb @@ -14,11 +14,7 @@ describe UpdateSnippetService do context 'When public visibility is restricted' do before do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return( - [Gitlab::VisibilityLevel::PUBLIC] - ) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) @snippet = create_snippet(@project, @user, @opts) @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC) diff --git a/spec/support/stub_configuration.rb b/spec/support/stub_configuration.rb index ad86abdbb41..e4004ec8f79 100644 --- a/spec/support/stub_configuration.rb +++ b/spec/support/stub_configuration.rb @@ -1,5 +1,10 @@ module StubConfiguration def stub_application_setting(messages) + add_predicates(messages) + + # Stubbing both of these because we're not yet consistent with how we access + # current application settings + allow_any_instance_of(ApplicationSetting).to receive_messages(messages) allow(Gitlab::CurrentSettings.current_application_settings). to receive_messages(messages) end @@ -11,4 +16,25 @@ module StubConfiguration def stub_gravatar_setting(messages) allow(Gitlab.config.gravatar).to receive_messages(messages) end + + private + + # Modifies stubbed messages to also stub possible predicate versions + # + # Examples: + # + # add_predicates(foo: true) + # # => {foo: true, foo?: true} + # + # add_predicates(signup_enabled?: false) + # # => {signup_enabled? false} + def add_predicates(messages) + # Only modify keys that aren't already predicates + keys = messages.keys.map(&:to_s).reject { |k| k.end_with?('?') } + + keys.each do |key| + predicate = key + '?' + messages[predicate.to_sym] = messages[key.to_sym] + end + end end -- cgit v1.2.1 From f876ef6e4db9c5ece17d3bd5c7c8a4e31d9374b3 Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Mon, 6 Jul 2015 23:15:03 -0700 Subject: use relative link to SSH setup page --- doc/gitlab-basics/create-your-ssh-keys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/gitlab-basics/create-your-ssh-keys.md b/doc/gitlab-basics/create-your-ssh-keys.md index e1acc2bd65b..cb699588cac 100644 --- a/doc/gitlab-basics/create-your-ssh-keys.md +++ b/doc/gitlab-basics/create-your-ssh-keys.md @@ -28,7 +28,7 @@ You need to connect your computer to your GitLab account through SSH Keys. They ## To generate an SSH Key on your commandline -* Go to your [commandline](start-using-git.md) and follow the [instructions](https://gitlab.com/help/ssh/README) to generate it +* Go to your [commandline](start-using-git.md) and follow the [instructions](../ssh/README.md) to generate it * Copy the SSH Key that your commandline created and paste it on the "Key" box on the GitLab page. The title will be added automatically -- cgit v1.2.1 From 7a3b47ff473986c9aea730f6cf3ef99ff0c1d450 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 7 Jul 2015 12:57:43 +0200 Subject: Fix port issue --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 507d88e0e71..7b27e980473 100644 --- a/docker/README.md +++ b/docker/README.md @@ -108,7 +108,7 @@ sudo docker pull gitlab/gitlab-ce:latest 1. create the container once again with previously specified options. ```bash sudo docker run --detach \ - --publish 80443:443 --publish 8080:80 --publish 2222:22 \ + --publish 8443:443 --publish 8080:80 --publish 2222:22 \ --name gitlab \ --restart always \ --volume /srv/gitlab/config:/etc/gitlab \ -- cgit v1.2.1 From ea7b31002e24f7e3ae473f1419efd1f65fc28b43 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 7 Jul 2015 13:06:41 +0200 Subject: Add note about HTTPS --- docker/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/README.md b/docker/README.md index 7b27e980473..eb74bea9950 100644 --- a/docker/README.md +++ b/docker/README.md @@ -62,6 +62,8 @@ sudo docker exec -it gitlab vi /etc/gitlab/gitlab.rb **You should set the `external_url` to point to a valid URL.** +**You may also be interesting in [Enabling HTTPS](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#enable-https).** + **To receive e-mails from GitLab you have to configure the [SMTP settings](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md), because Docker image doesn't have a SMTP server.** -- cgit v1.2.1 From d8c9d948178e15a9eb426a60aa803e2f628d5350 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Tue, 7 Jul 2015 12:00:48 +0000 Subject: Add link to multiple app servers. --- doc/install/requirements.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 7a3216dd2d2..a57b1da3319 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -57,6 +57,7 @@ If you have enough RAM memory and a recent CPU the speed of GitLab is mainly lim - 16 cores supports up to 10,000 users - 32 cores supports up to 20,000 users - 64 cores supports up to 40,000 users +- More users? Run it on [multiple application servers](https://about.gitlab.com/high-availability/) ### Memory @@ -71,6 +72,7 @@ With less memory GitLab will give strange errors during the reconfigure run and - 16GB RAM supports up to 10,000 users - 32GB RAM supports up to 20,000 users - 64GB RAM supports up to 40,000 users +- More users? Run it on [multiple application servers](https://about.gitlab.com/high-availability/) Notice: The 25 workers of Sidekiq will show up as separate processes in your process overview (such as top or htop) but they share the same RAM allocation since Sidekiq is a multithreaded application. -- cgit v1.2.1 From b8c9c69e5ae7ffd382c06007f136aede9631f886 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 7 Jul 2015 14:03:18 +0200 Subject: Markdown fix --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index eb74bea9950..9cd48bf87d4 100644 --- a/docker/README.md +++ b/docker/README.md @@ -124,7 +124,7 @@ On the first run GitLab will reconfigure and update itself. ### Run GitLab CE on public IP address You can make Docker to use your IP address and forward all traffic to the GitLab CE container. -You can do that by modifying the `--publish` ((Binding container ports to the host)[https://docs.docker.com/articles/networking/#binding-ports]): +You can do that by modifying the `--publish` ([Binding container ports to the host](https://docs.docker.com/articles/networking/#binding-ports)): > --publish=[] : Publish a container᾿s port or a range of ports to the host format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort -- cgit v1.2.1 From 954eedf3689775a9b4d2ed3fb33985f82ba17f0d Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 7 Jul 2015 05:48:32 -0700 Subject: Change "Irc Uri" -> "IRC URI" --- app/models/project_services/irker_service.rb | 2 +- doc/project_services/irker.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb index a4d0914dbe7..d24aa317cf3 100644 --- a/app/models/project_services/irker_service.rb +++ b/app/models/project_services/irker_service.rb @@ -63,7 +63,7 @@ class IrkerService < Service help: 'Irker daemon hostname (defaults to localhost)' }, { type: 'text', name: 'server_port', placeholder: 6659, help: 'Irker daemon port (defaults to 6659)' }, - { type: 'text', name: 'default_irc_uri', + { type: 'text', name: 'default_irc_uri', title: 'Default IRC URI', help: 'A default IRC URI to prepend before each recipient (optional)', placeholder: 'irc://irc.network.net:6697/' }, { type: 'textarea', name: 'recipients', diff --git a/doc/project_services/irker.md b/doc/project_services/irker.md index 1dbca20baf9..25c0c3ad2a6 100644 --- a/doc/project_services/irker.md +++ b/doc/project_services/irker.md @@ -34,7 +34,7 @@ need to follow the firsts steps of the next section. in the `Server host` field on the Web page 1. Enter the server port of `irkerd` (e.g. defaults to 6659) in the `Server port` field on the Web page. -1. Optional: if `Default irc uri` is set, it has to be in the format +1. Optional: if `Default IRC URI` is set, it has to be in the format `irc[s]://domain.name` and will be prepend to each and every channel provided by the user which is not a full URI. 1. Specify the recipients (e.g. #channel1, user1, etc.) -- cgit v1.2.1 From 5e7f7f8d31cce732533e36b7be756b824b748f74 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 15:22:56 +0200 Subject: Redesign project home page Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/pages/projects.scss | 72 +++++++++++++----------------- app/views/projects/_home_panel.html.haml | 63 ++++++++++++-------------- app/views/projects/empty.html.haml | 26 +++++------ app/views/projects/show.html.haml | 42 ++++++++++++++--- app/views/shared/_clone_panel.html.haml | 2 +- 5 files changed, 110 insertions(+), 95 deletions(-) diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index e19b2eafa43..b363b4206ed 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -15,48 +15,31 @@ } .project-home-panel { - margin-top: 10px; - margin-bottom: 15px; - position: relative; - padding-left: 65px; - min-height: 50px; + text-align: center; + margin-bottom: 20px; .project-identicon-holder { - position: absolute; - left: 0; - top: -14px; + margin-bottom: 15px; - .avatar { - width: 50px; - height: 50px; + .avatar, .identicon { + margin: 0 auto; + float: none; } .identicon { - font-size: 26px; - line-height: 50px; + @include border-radius(50%); } } - .project-home-row { - @extend .clearfix; - margin-bottom: 15px; - - &.project-home-row-top { - margin-bottom: 15px; + .lead { + p { + display: inline; } + } - .project-home-desc { - color: $gray; - float: left; - font-size: 16px; - line-height: 1.3; - margin-right: 250px; - - // Render Markdown-generated HTML inline for this block - p { - display: inline; - } - } + .git-clone-holder { + max-width: 600px; + margin: 0 auto; } .visibility-level-label { @@ -67,22 +50,19 @@ } .project-repo-buttons { - margin-top: -3px; - position: absolute; - right: 0; - width: 265px; - text-align: right; - + margin-top: 25px; + margin-bottom: 25px; .btn { + @extend .btn-info; font-weight: bold; font-size: 14px; line-height: 16px; + padding: 8px 12px; .count { - padding-left: 10px; - border-left: 1px solid #ccc; + padding-left: 7px; display: inline-block; - margin-left: 10px; + margin-left: 7px; } } } @@ -307,3 +287,15 @@ table.table.protected-branches-list tr.no-border { float: left; margin-right: 10px; } + +.project-stats { + text-align: center; + + ul.nav-pills { display:inline-block; } + li { display:inline; } + a { float:left; } +} + +pre.light-well { + border-color: #f1f1f1; +} diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 076afb11a9d..e22758f8a45 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -1,37 +1,32 @@ - empty_repo = @project.empty_repo? .project-home-panel.clearfix{:class => ("empty-project" if empty_repo)} .project-identicon-holder - = project_icon(@project, alt: '', class: 'avatar project-avatar') - .project-home-row.project-home-row-top - .project-home-desc - - if @project.description.present? - = markdown(@project.description, pipeline: :description) - - if can?(current_user, :admin_project, @project) - – - = link_to 'Edit', edit_namespace_project_path - - elsif !empty_repo && @repository.readme - - readme = @repository.readme - – - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do - = readme.name - .project-repo-buttons - .inline.star.js-toggler-container{class: @show_star ? 'on' : ''} - - if current_user - = link_to_toggle_star('Star this project.', false) - = link_to_toggle_star('Unstar this project.', true) - - else - = link_to new_user_session_path, class: 'btn star-btn has_tooltip', title: 'You must sign in to star a project' do - %span - = icon('star') - Star - %span.count - = @project.star_count - - unless empty_repo - - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace - .inline.fork-buttons.prepend-left-10 - - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 - = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn btn-sm btn-default' do - = link_to_toggle_fork - - else - = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do - = link_to_toggle_fork + = project_icon(@project, alt: '', class: 'project-avatar avatar s90') + .lead + - if @project.description.present? + = markdown(@project.description, pipeline: :description) + + + .project-repo-buttons + .inline.star.js-toggler-container{class: @show_star ? 'on' : ''} + - if current_user + = link_to_toggle_star('Star this project.', false) + = link_to_toggle_star('Unstar this project.', true) + - else + = link_to new_user_session_path, class: 'btn star-btn has_tooltip', title: 'You must sign in to star a project' do + %span + = icon('star') + Star + %span.count + = @project.star_count + - unless empty_repo + - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace + .inline.fork-buttons.prepend-left-10 + - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 + = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn btn-sm btn-default' do + = link_to_toggle_fork + - else + = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do + = link_to_toggle_fork + + = render "shared/clone_panel" diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index 8080a904978..f103fba404e 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -4,30 +4,28 @@ = render "home_panel" -.center.well - %h3 +.center.light-well + %h3.page-title The repository for this project is empty - %h4 + %p You can - = link_to namespace_project_new_blob_path(@project.namespace, @project, 'master'), class: 'btn btn-new btn-lg' do + = link_to namespace_project_new_blob_path(@project.namespace, @project, 'master'), class: 'btn btn-new' do add a file  or do a push via the command line. -.well - = render "shared/clone_panel" -%h4 - %strong Command line instructions +%h3.page-title + Command line instructions %div.git-empty %fieldset - %legend Git global setup - %pre.dark + %h5 Git global setup + %pre.light-well :preserve git config --global user.name "#{git_user_name}" git config --global user.email "#{git_user_email}" %fieldset - %legend Create a new repository - %pre.dark + %h5 Create a new repository + %pre.light-well :preserve git clone #{ content_tag(:span, default_url_to_repo, class: 'clone')} cd #{@project.path} @@ -37,8 +35,8 @@ git push -u origin master %fieldset - %legend Existing folder or Git repository - %pre.dark + %h5 Existing folder or Git repository + %pre.light-well :preserve cd existing_folder git init diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 2259dea0865..d7b1704f036 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -7,10 +7,40 @@ = render 'shared/no_password' = render "home_panel" -= render 'shared/show_aside' +.project-stats + %ul.nav.nav-pills + %li + = link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do + = pluralize(number_with_delimiter(@repository.commit_count), 'commit') + %li + = link_to namespace_project_branches_path(@project.namespace, @project) do + = pluralize(number_with_delimiter(@repository.branch_names.count), 'branch') + %li + = link_to namespace_project_tags_path(@project.namespace, @project) do + = pluralize(number_with_delimiter(@repository.tag_names.count), 'tag') + - if @repository.changelog + %li + = link_to changelog_url(@project) do + Changelog + - if @repository.license + %li + = link_to license_url(@project) do + License + - if @repository.contribution_guide + %li + = link_to contribution_guide_url(@project) do + Contribution guide -.row - %section.col-md-8 - = render 'section' - %aside.col-md-4.project-side - = render 'aside' +%hr +%section + - if readme = @repository.readme + %article.readme-holder#README + .clearfix + %small.pull-right + = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do + %i.fa.fa-file + = readme.name + .wiki + = render_readme(readme) + - else + %h4 Add README to this repository diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml index 6de2aed29ed..07672359dba 100644 --- a/app/views/shared/_clone_panel.html.haml +++ b/app/views/shared/_clone_panel.html.haml @@ -20,7 +20,7 @@ :"data-container" => "body"} = gitlab_config.protocol.upcase = text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control input-sm", readonly: true - - if project.kind_of?(Project) && project.empty_repo? + - if project.kind_of?(Project) .input-group-addon .visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(project.visibility_level)} project" } = visibility_level_icon(project.visibility_level) -- cgit v1.2.1 From 90ab5a59bb28053c9da768679b8036caa7885e95 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 7 Jul 2015 15:34:06 +0200 Subject: Use native Postgres database cleaning during backup restore We were using hacks to drop tables etc during a Postgres backup restore. With this change, we let pg_dump insert the DROP TABLE statements it needs at the start of the SQL dump. --- CHANGELOG | 1 + lib/backup/database.rb | 7 ++----- lib/tasks/gitlab/db/drop_all_postgres_sequences.rake | 10 ---------- lib/tasks/gitlab/db/drop_all_tables.rake | 10 ---------- 4 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 lib/tasks/gitlab/db/drop_all_postgres_sequences.rake delete mode 100644 lib/tasks/gitlab/db/drop_all_tables.rake diff --git a/CHANGELOG b/CHANGELOG index d538bb42992..170cb81bcce 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,7 @@ v 7.13.0 (unreleased) - Correctly show anonymous authorized applications under Profile > Applications. - Query Optimization in MySQL. - Allow users to be blocked and unblocked via the API + - Use native Postgres database cleaning during backup restore v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. diff --git a/lib/backup/database.rb b/lib/backup/database.rb index 9ab6aca276d..7aa54dd55ae 100644 --- a/lib/backup/database.rb +++ b/lib/backup/database.rb @@ -18,7 +18,8 @@ module Backup when "postgresql" then $progress.print "Dumping PostgreSQL database #{config['database']} ... " pg_env - system('pg_dump', config['database'], out: db_file_name) + # Pass '--clean' to include 'DROP TABLE' statements in the DB dump. + system('pg_dump', '--clean', config['database'], out: db_file_name) end report_success(success) abort 'Backup failed' unless success @@ -31,10 +32,6 @@ module Backup system('mysql', *mysql_args, config['database'], in: db_file_name) when "postgresql" then $progress.print "Restoring PostgreSQL database #{config['database']} ... " - # Drop all tables because PostgreSQL DB dumps do not contain DROP TABLE - # statements like MySQL. - Rake::Task["gitlab:db:drop_all_tables"].invoke - Rake::Task["gitlab:db:drop_all_postgres_sequences"].invoke pg_env system('psql', config['database'], '-f', db_file_name) end diff --git a/lib/tasks/gitlab/db/drop_all_postgres_sequences.rake b/lib/tasks/gitlab/db/drop_all_postgres_sequences.rake deleted file mode 100644 index e9cf0a9b5e8..00000000000 --- a/lib/tasks/gitlab/db/drop_all_postgres_sequences.rake +++ /dev/null @@ -1,10 +0,0 @@ -namespace :gitlab do - namespace :db do - task drop_all_postgres_sequences: :environment do - connection = ActiveRecord::Base.connection - connection.execute("SELECT c.relname FROM pg_class c WHERE c.relkind = 'S';").each do |sequence| - connection.execute("DROP SEQUENCE #{sequence['relname']}") - end - end - end -end diff --git a/lib/tasks/gitlab/db/drop_all_tables.rake b/lib/tasks/gitlab/db/drop_all_tables.rake deleted file mode 100644 index a66030ab93a..00000000000 --- a/lib/tasks/gitlab/db/drop_all_tables.rake +++ /dev/null @@ -1,10 +0,0 @@ -namespace :gitlab do - namespace :db do - task drop_all_tables: :environment do - connection = ActiveRecord::Base.connection - connection.tables.each do |table| - connection.drop_table(table) - end - end - end -end -- cgit v1.2.1 From bf0b3fcb8994b0b901c20c74f3063f8fbf7797ec Mon Sep 17 00:00:00 2001 From: karen Carias Date: Tue, 7 Jul 2015 06:58:42 -0700 Subject: fixed document with improved instructions --- .../basicsimages/click-on-new-group.png | Bin 0 -> 2063 bytes doc/gitlab-basics/basicsimages/select-group.png | Bin 0 -> 6075 bytes doc/gitlab-basics/create-group.md | 26 +++++++++------------ 3 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 doc/gitlab-basics/basicsimages/click-on-new-group.png create mode 100644 doc/gitlab-basics/basicsimages/select-group.png diff --git a/doc/gitlab-basics/basicsimages/click-on-new-group.png b/doc/gitlab-basics/basicsimages/click-on-new-group.png new file mode 100644 index 00000000000..94b6d5756d3 Binary files /dev/null and b/doc/gitlab-basics/basicsimages/click-on-new-group.png differ diff --git a/doc/gitlab-basics/basicsimages/select-group.png b/doc/gitlab-basics/basicsimages/select-group.png new file mode 100644 index 00000000000..d02c2255ff2 Binary files /dev/null and b/doc/gitlab-basics/basicsimages/select-group.png differ diff --git a/doc/gitlab-basics/create-group.md b/doc/gitlab-basics/create-group.md index 5fa596887bb..7732fb716eb 100644 --- a/doc/gitlab-basics/create-group.md +++ b/doc/gitlab-basics/create-group.md @@ -6,13 +6,13 @@ When you create a group in GitLab.com, you can add projects and users To create a new group, sign in to [GitLab.com](https://gitlab.com) -* Click on "new project" on the right side of your screen +When you are on your Dashboard, click on "Groups" on the left side of your screen -![Create a project](basicsimages/new_project.png) +![Go to groups](basicsimages/select-group.png) -* Click on "create a group" on the bottom left side of your screen +Click on "New group" on the top right side of your screen -![Create a group](basicsimages/create_group.png) +![New group](basicsimages/click-on-new-group.png) 1. Add a group path or group name (you can't add spaces, so you can use hyphens or underscores) @@ -24,20 +24,16 @@ To create a new group, sign in to [GitLab.com](https://gitlab.com) ![Group information](basicsimages/group_info.png) -## Add a group to a project - -* Select a project on the right side of your screen +## Add a project to a group -![Select a project](basicsimages/select_project.png) +There are 2 ways of adding a group to a new project -* Click on "settings" on the left side of your screen +1. Go into a group -![Settings](basicsimages/settings.png) +Click on "New project" on the right side of your screen and [create your project](create-project.md) -* Click on "groups" on the left side of your screen +![New project](basicsimages/new_project.png) -![Groups](basicsimages/groups.png) +2. If you'd like to select a group for a new project, when you [create your project](create-project.md), click on "create a group" on the bottom right side of your screen -* Find the group and click on "share" - -![Find a group](basicsimages/find_group.png) +![Create a group](basicsimages/create_group.png) -- cgit v1.2.1 From d192f921c17561c82943bc803875ba6bf11fd8ce Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 16:01:12 +0200 Subject: Move project activity to separate tab. Add more features to project home page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/dispatcher.js.coffee | 3 +- app/controllers/projects_controller.rb | 19 +++-- app/helpers/gitlab_routing_helper.rb | 4 ++ app/helpers/projects_helper.rb | 2 +- app/views/layouts/nav/_project.html.haml | 7 +- app/views/projects/_aside.html.haml | 106 ---------------------------- app/views/projects/_home_panel.html.haml | 9 ++- app/views/projects/_section.html.haml | 36 ---------- app/views/projects/activity.html.haml | 13 ++++ app/views/projects/show.html.haml | 24 ++++++- config/routes.rb | 1 + db/schema.rb | 14 +++- 12 files changed, 80 insertions(+), 158 deletions(-) delete mode 100644 app/views/projects/_aside.html.haml delete mode 100644 app/views/projects/_section.html.haml create mode 100644 app/views/projects/activity.html.haml diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index a8ec0abc264..aa6b50ca0f9 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -62,8 +62,9 @@ class Dispatcher shortcut_handler = new ShortcutsNavigation() when 'projects:commits:show' shortcut_handler = new ShortcutsNavigation() - when 'projects:show' + when 'projects:activity' new Activities() + when 'projects:show' shortcut_handler = new ShortcutsNavigation() when 'groups:show' new Activities() diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index be5968cd7b0..6db65cf47ef 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -6,7 +6,7 @@ class ProjectsController < ApplicationController # Authorize before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] - before_action :event_filter, only: :show + before_action :event_filter, only: [:show, :activity] layout :determine_layout @@ -59,6 +59,16 @@ class ProjectsController < ApplicationController end end + def activity + respond_to do |format| + format.html + format.json do + load_events + pager_json('events/_events', @events.count) + end + end + end + def show if @project.import_in_progress? redirect_to namespace_project_import_path(@project.namespace, @project) @@ -81,11 +91,6 @@ class ProjectsController < ApplicationController end end - format.json do - load_events - pager_json('events/_events', @events.count) - end - format.atom do load_events render layout: false @@ -151,7 +156,7 @@ class ProjectsController < ApplicationController end def markdown_preview - text = params[:text] + text = params[:text] ext = Gitlab::ReferenceExtractor.new(@project, current_user) ext.analyze(text) diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb index 9d072f81092..d0fae255a04 100644 --- a/app/helpers/gitlab_routing_helper.rb +++ b/app/helpers/gitlab_routing_helper.rb @@ -17,6 +17,10 @@ module GitlabRoutingHelper namespace_project_path(project.namespace, project, *args) end + def activity_project_path(project, *args) + activity_namespace_project_path(project.namespace, project, *args) + end + def edit_project_path(project, *args) edit_namespace_project_path(project.namespace, project, *args) end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ec65e473919..ae65985ce75 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -85,7 +85,7 @@ module ProjectsHelper end def link_to_toggle_star(title, starred) - cls = 'star-btn btn btn-sm btn-default' + cls = 'star-btn btn' toggle_text = if starred diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 6de97302dc1..cbd5de4cba2 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -1,9 +1,14 @@ %ul.nav.nav-sidebar = nav_link(path: 'projects#show', html_options: {class: 'home'}) do = link_to project_path(@project), title: 'Project', class: 'shortcuts-project', data: {placement: 'right'} do - = icon('dashboard fw') + = icon('home fw') %span Project + = nav_link(path: 'projects#activity', html_options: {class: 'activity'}) do + = link_to activity_project_path(@project), title: 'Project', data: {placement: 'right'} do + = icon('dashboard fw') + %span + Activity - if project_nav_tab? :files = nav_link(controller: %w(tree blob blame edit_tree new_tree)) do = link_to namespace_project_tree_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Files', class: 'shortcuts-tree', data: {placement: 'right'} do diff --git a/app/views/projects/_aside.html.haml b/app/views/projects/_aside.html.haml deleted file mode 100644 index 72aea8814f5..00000000000 --- a/app/views/projects/_aside.html.haml +++ /dev/null @@ -1,106 +0,0 @@ -.clearfix - - unless @project.empty_repo? - .panel.panel-default - .panel-heading - = visibility_level_icon(@project.visibility_level) - = "#{visibility_level_label(@project.visibility_level).capitalize} project" - - .panel-body - - if @repository.changelog || @repository.license || @repository.contribution_guide - %ul.nav.nav-pills - - if @repository.changelog - %li.hidden-xs - = link_to changelog_url(@project) do - Changelog - - if @repository.license - %li - = link_to license_url(@project) do - License - - if @repository.contribution_guide - %li - = link_to contribution_guide_url(@project) do - Contribution guide - - .actions - - if can? current_user, :create_issue, @project - = link_to url_for_new_issue(@project, only_path: true), title: "New Issue", class: 'btn btn-sm append-right-10' do - New Issue - - - if can? current_user, :create_merge_request, @project - = link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-sm", title: "New Merge Request" do - New Merge Request - - - if forked_from_project = @project.forked_from_project - .panel-footer - = icon("code-fork fw") - Forked from - .pull-right - = link_to forked_from_project.namespace.try(:name), project_path(forked_from_project) - - - - @project.ci_services.each do |ci_service| - - if ci_service.active? && ci_service.respond_to?(:builds_path) - .panel-footer - = icon("check fw") - = ci_service.title - .pull-right - - if ci_service.respond_to?(:status_img_path) - = link_to ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' do - = image_tag ci_service.status_img_path, alt: "build status", class: 'ci-status-image' - - else - = link_to 'view builds', ci_service.builds_path, :'data-no-turbolink' => 'data-no-turbolink' - - - - unless @project.empty_repo? - .panel.panel-default - .panel-heading - = icon("folder-o fw") - Repository - .panel-body - %ul.nav.nav-pills - %li - = link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do - = pluralize(number_with_delimiter(@repository.commit_count), 'commit') - %li - = link_to namespace_project_branches_path(@project.namespace, @project) do - = pluralize(number_with_delimiter(@repository.branch_names.count), 'branch') - %li - = link_to namespace_project_tags_path(@project.namespace, @project) do - = pluralize(number_with_delimiter(@repository.tag_names.count), 'tag') - - .actions - = link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-sm append-right-10' do - %i.fa.fa-exchange - Compare code - - - if can?(current_user, :download_code, @project) - = render 'projects/repositories/download_archive', split_button: true, btn_class: 'btn-group-sm' - - if version = @repository.version - .panel-footer - = icon("clock-o fw") - Version - .pull-right - = link_to version_url(@project) do - = @repository.blob_by_oid(version.id).data - - = render "shared/clone_panel" - - - if @project.archived? - %br - .alert.alert-warning - %h4 - = icon("exclamation-triangle fw") - Archived project! - %p Repository is read-only - - - if current_user - - access = user_max_access_in_project(current_user, @project) - - if access - .light-well.light.prepend-top-20 - %small - You have #{access} access to this project. - - if @project.project_member_by_id(current_user) - %br - = link_to leave_namespace_project_project_members_path(@project.namespace, @project), - data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project' do - Leave this project diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index e22758f8a45..d100a1586e4 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -23,10 +23,15 @@ - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace .inline.fork-buttons.prepend-left-10 - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 - = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn btn-sm btn-default' do + = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn' do = link_to_toggle_fork - else - = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn btn-sm btn-default' do + = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn' do = link_to_toggle_fork + - elsif forked_from_project = @project.forked_from_project + = link_to project_path(forked_from_project), class: 'btn' do + = icon("code-fork fw") + Forked from + = forked_from_project.namespace.try(:name) = render "shared/clone_panel" diff --git a/app/views/projects/_section.html.haml b/app/views/projects/_section.html.haml deleted file mode 100644 index d7b06197f67..00000000000 --- a/app/views/projects/_section.html.haml +++ /dev/null @@ -1,36 +0,0 @@ -%ul.nav.nav-tabs - %li.active - = link_to '#tab-activity', 'data-toggle' => 'tab' do - = icon("tachometer") - Activity - - if @repository.readme - %li - = link_to '#tab-readme', 'data-toggle' => 'tab' do - = icon("file-text-o") - Readme -.tab-content - .tab-pane.active#tab-activity - .hidden-xs - = render "events/event_last_push", event: @last_push - - - if current_user - %ul.nav.nav-pills.event_filter.pull-right - %li - = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do - %i.fa.fa-rss - - = render 'shared/event_filter' - %hr - .content_list - = spinner - - - if readme = @repository.readme - .tab-pane#tab-readme - %article.readme-holder#README - .clearfix - %small.pull-right - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do - %i.fa.fa-file - = readme.name - .wiki - = render_readme(readme) diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml new file mode 100644 index 00000000000..25bd93cae87 --- /dev/null +++ b/app/views/projects/activity.html.haml @@ -0,0 +1,13 @@ +.hidden-xs + = render "events/event_last_push", event: @last_push + + - if current_user + %ul.nav.nav-pills.event_filter.pull-right + %li + = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do + %i.fa.fa-rss + + = render 'shared/event_filter' + %hr +.content_list += spinner diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index d7b1704f036..ceaf6c8cab3 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -7,6 +7,7 @@ = render 'shared/no_password' = render "home_panel" + .project-stats %ul.nav.nav-pills %li @@ -31,6 +32,12 @@ = link_to contribution_guide_url(@project) do Contribution guide +- if @project.archived? + .text-warning.center.prepend-top-20 + %p + = icon("exclamation-triangle fw") + Archived project! Repository is read-only + %hr %section - if readme = @repository.readme @@ -43,4 +50,19 @@ .wiki = render_readme(readme) - else - %h4 Add README to this repository + %h4 + Please + = link_to "add README", namespace_project_new_blob_path(@project.namespace, @project, tree_join(@repository.root_ref), file_name: 'README.md') + file to this repository + + +- if current_user + - access = user_max_access_in_project(current_user, @project) + - if access + %hr + %p.light + You have #{access} access to this project. + - if @project.project_member_by_id(current_user) + = link_to leave_namespace_project_project_members_path(@project.namespace, @project), + data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project', class: 'cred' do + Leave this project diff --git a/config/routes.rb b/config/routes.rb index 8617839a256..fd04d7b2f54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -314,6 +314,7 @@ Gitlab::Application.routes.draw do post :toggle_star post :markdown_preview get :autocomplete_sources + get :activity end scope module: :projects do diff --git a/db/schema.rb b/db/schema.rb index 8736d1e0df5..05d024c8c88 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150620233230) do +ActiveRecord::Schema.define(version: 20150625153454) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -28,11 +28,11 @@ ActiveRecord::Schema.define(version: 20150620233230) do t.integer "default_branch_protection", default: 2 t.boolean "twitter_sharing_enabled", default: true t.text "restricted_visibility_levels" + t.boolean "version_check_enabled", default: true t.integer "max_attachment_size", default: 10, null: false t.integer "default_project_visibility" t.integer "default_snippet_visibility" t.text "restricted_signup_domains" - t.boolean "version_check_enabled", default: true t.boolean "user_oauth_applications", default: true t.string "after_sign_out_path" t.integer "session_expire_delay", default: 10080, null: false @@ -344,6 +344,14 @@ ActiveRecord::Schema.define(version: 20150620233230) do add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree + create_table "participants", force: true do |t| + t.integer "target_id", null: false + t.string "target_type", null: false + t.integer "user_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "project_import_data", force: true do |t| t.integer "project_id" t.text "data" @@ -510,12 +518,12 @@ ActiveRecord::Schema.define(version: 20150620233230) do t.string "bitbucket_access_token" t.string "bitbucket_access_token_secret" t.string "location" - t.string "public_email", default: "", null: false t.string "encrypted_otp_secret" t.string "encrypted_otp_secret_iv" t.string "encrypted_otp_secret_salt" t.boolean "otp_required_for_login", default: false, null: false t.text "otp_backup_codes" + t.string "public_email", default: "", null: false t.integer "dashboard", default: 0 end -- cgit v1.2.1 From afe5069551f47a2894a7877a0ec7e9a0a4b490f9 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Tue, 7 Jul 2015 07:06:02 -0700 Subject: fixed image --- doc/gitlab-basics/basicsimages/select-group2.png | Bin 0 -> 5049 bytes doc/gitlab-basics/create-group.md | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 doc/gitlab-basics/basicsimages/select-group2.png diff --git a/doc/gitlab-basics/basicsimages/select-group2.png b/doc/gitlab-basics/basicsimages/select-group2.png new file mode 100644 index 00000000000..fd40bce499b Binary files /dev/null and b/doc/gitlab-basics/basicsimages/select-group2.png differ diff --git a/doc/gitlab-basics/create-group.md b/doc/gitlab-basics/create-group.md index 7732fb716eb..f6368f32c88 100644 --- a/doc/gitlab-basics/create-group.md +++ b/doc/gitlab-basics/create-group.md @@ -8,7 +8,7 @@ To create a new group, sign in to [GitLab.com](https://gitlab.com) When you are on your Dashboard, click on "Groups" on the left side of your screen -![Go to groups](basicsimages/select-group.png) +![Go to groups](basicsimages/select-group2.png) Click on "New group" on the top right side of your screen @@ -24,7 +24,7 @@ Click on "New group" on the top right side of your screen ![Group information](basicsimages/group_info.png) -## Add a project to a group +## Add a group to a project There are 2 ways of adding a group to a new project -- cgit v1.2.1 From 943217a1221ca30d80225e2958821de3429da319 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Tue, 7 Jul 2015 07:09:37 -0700 Subject: fixed typo --- doc/gitlab-basics/create-group.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/gitlab-basics/create-group.md b/doc/gitlab-basics/create-group.md index f6368f32c88..9d61f2ab927 100644 --- a/doc/gitlab-basics/create-group.md +++ b/doc/gitlab-basics/create-group.md @@ -28,12 +28,12 @@ Click on "New group" on the top right side of your screen There are 2 ways of adding a group to a new project -1. Go into a group +* Go into a group -Click on "New project" on the right side of your screen and [create your project](create-project.md) +Click on "New project" on the right side of your screen and [create a project](create-project.md) ![New project](basicsimages/new_project.png) -2. If you'd like to select a group for a new project, when you [create your project](create-project.md), click on "create a group" on the bottom right side of your screen +* If you'd like to select a group for a new project, when you [create a project](create-project.md), click on "create a group" on the bottom right side of your screen ![Create a group](basicsimages/create_group.png) -- cgit v1.2.1 From bc3cd44ba71c2843330428ea41b221b6905378ab Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 16:53:25 +0200 Subject: Add download button to project page Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/_home_panel.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index d100a1586e4..7e2860128f8 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -33,5 +33,9 @@ = icon("code-fork fw") Forked from = forked_from_project.namespace.try(:name) + - if can? current_user, :download_code, @project + .inline.prepend-left-10 + = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do + %i.fa.fa-download = render "shared/clone_panel" -- cgit v1.2.1 From 5be6cbac6fd50f6e97c483f78de667ce5628a3ce Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Jul 2015 16:54:52 +0200 Subject: Add spacing around buttons on project page Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/_home_panel.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 7e2860128f8..6335d76ab81 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -29,10 +29,11 @@ = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn' do = link_to_toggle_fork - elsif forked_from_project = @project.forked_from_project - = link_to project_path(forked_from_project), class: 'btn' do - = icon("code-fork fw") - Forked from - = forked_from_project.namespace.try(:name) + .inline.prepend-left-10 + = link_to project_path(forked_from_project), class: 'btn' do + = icon("code-fork fw") + Forked from + = forked_from_project.namespace.try(:name) - if can? current_user, :download_code, @project .inline.prepend-left-10 = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do -- cgit v1.2.1 From ddb1836f93d334b0c839f7b7465c5e06d9eedba3 Mon Sep 17 00:00:00 2001 From: Patricio Cano Date: Tue, 7 Jul 2015 11:08:29 -0500 Subject: Added info about common UI problems if IE Compatibility View mode is enabled. --- doc/install/requirements.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 7a3216dd2d2..45a90d5e157 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -106,4 +106,8 @@ On a very active server (10,000 active users) the Sidekiq process can use 1GB+ o - Firefox (Latest released version and [latest ESR version](https://www.mozilla.org/en-US/firefox/organizations/)) - Safari 7+ (known problem: required fields in html5 do not work) - Opera (Latest released version) -- IE 10+ \ No newline at end of file +- IE 10+ + +### Common UI problems with IE + +If you experience UI issues with Internet Explorer, please make sure that you have the `Compatibility View` mode disabled. \ No newline at end of file -- cgit v1.2.1 From 540656f9ecb9c519f1ca61b71c05698d15c76995 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Tue, 7 Jul 2015 18:20:43 +0200 Subject: Specify that swap will be slow. --- doc/install/requirements.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 7a3216dd2d2..2b72c410b18 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -64,15 +64,16 @@ You need at least 2GB of addressable memory (RAM + swap) to install and use GitL With less memory GitLab will give strange errors during the reconfigure run and 500 errors during usage. - 512MB RAM + 1.5GB of swap is the absolute minimum but we strongly **advise against** this amount of memory. See the unicorn worker section below for more advise. -- 1GB RAM + 1GB swap supports up to 100 users -- **2GB RAM** is the **recommended** memory size and supports up to 500 users -- 4GB RAM supports up to 2,000 users -- 8GB RAM supports up to 5,000 users -- 16GB RAM supports up to 10,000 users -- 32GB RAM supports up to 20,000 users -- 64GB RAM supports up to 40,000 users - -Notice: The 25 workers of Sidekiq will show up as separate processes in your process overview (such as top or htop) but they share the same RAM allocation since Sidekiq is a multithreaded application. +- 1GB RAM + 1GB swap supports up to 100 users but it will be slow +- **2GB RAM** is the **recommended** memory size and supports up to 100 users +- 4GB RAM supports up to 1,000 users +- 8GB RAM supports up to 2,000 users +- 16GB RAM supports up to 4,000 users +- 32GB RAM supports up to 8,000 users +- 64GB RAM supports up to 16,000 users +- 128GB RAM supports up to 32,000 users + +Notice: The 25 workers of Sidekiq will show up as separate processes in your process overview (such as top or htop) but they share the same RAM allocation since Sidekiq is a multithreaded application. Please see the section below about Unicorn workers. ## Unicorn Workers -- cgit v1.2.1 From 9bb52499943bba56a27030de1318c72c9cf13c5f Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Tue, 7 Jul 2015 11:31:47 -0700 Subject: dont -> don't Update "You dont have any authorized applications" to "You don't have any authorized applications" --- app/views/profiles/applications.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/profiles/applications.html.haml b/app/views/profiles/applications.html.haml index d2fad31eca2..3a3e6e1b1c4 100644 --- a/app/views/profiles/applications.html.haml +++ b/app/views/profiles/applications.html.haml @@ -66,4 +66,4 @@ %td= token.scopes %td= render 'doorkeeper/authorized_applications/delete_form', token: token - else - %p.light You dont have any authorized applications + %p.light You don't have any authorized applications -- cgit v1.2.1 From cddbbc819c434117c7a83ee49c03247adcf3d557 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Tue, 7 Jul 2015 12:49:58 -0700 Subject: fixed text --- doc/gitlab-basics/create-group.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/doc/gitlab-basics/create-group.md b/doc/gitlab-basics/create-group.md index 9d61f2ab927..8e168395ff7 100644 --- a/doc/gitlab-basics/create-group.md +++ b/doc/gitlab-basics/create-group.md @@ -2,18 +2,24 @@ ## Create a group -When you create a group in GitLab.com, you can add projects and users +Your projects in [GitLab.com](https://gitlab.com) can be organized in 2 different ways: +under your own namespace for single projects, such as ´your-name/project-1'; or under groups. +If you organize your projects under a group, it works like a folder. You can manage your group members' permissions and access to the projects. -To create a new group, sign in to [GitLab.com](https://gitlab.com) +To create a group, follow the instructions below: -When you are on your Dashboard, click on "Groups" on the left side of your screen +Sign in to [GitLab.com](https://gitlab.com). + +When you are on your Dashboard, click on "Groups" on the left menu of your screen: ![Go to groups](basicsimages/select-group2.png) -Click on "New group" on the top right side of your screen +Click on "New group" on the top right side of your screen: ![New group](basicsimages/click-on-new-group.png) +Fill out the information required: + 1. Add a group path or group name (you can't add spaces, so you can use hyphens or underscores) 1. Add details or a group description @@ -24,16 +30,14 @@ Click on "New group" on the top right side of your screen ![Group information](basicsimages/group_info.png) -## Add a group to a project - -There are 2 ways of adding a group to a new project +## Add a project to a group -* Go into a group +There are 2 different ways to add a new project to a group: -Click on "New project" on the right side of your screen and [create a project](create-project.md) +* Select a group and then click on "New project" on the right side of your screen. Then you can [create a project](create-project.md) ![New project](basicsimages/new_project.png) -* If you'd like to select a group for a new project, when you [create a project](create-project.md), click on "create a group" on the bottom right side of your screen +* When you are [creating a project](create-project.md), click on "create a group" on the bottom right side of your screen ![Create a group](basicsimages/create_group.png) -- cgit v1.2.1 From ecf26b894787b0b7d74480c15ed82170b7f01813 Mon Sep 17 00:00:00 2001 From: Metalaka Date: Tue, 7 Jul 2015 21:07:39 +0200 Subject: Fix Transfer project input width. --- app/views/projects/edit.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 3fecd25c324..7ef42ac0f8c 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -176,7 +176,7 @@ .form-group = label_tag :new_namespace_id, nil, class: 'control-label' do %span Namespace - .col-sm-10 + .col-sm-9 .form-group = select_tag :new_namespace_id, namespaces_options(@project.namespace_id), { prompt: 'Choose a project namespace', class: 'select2' } %ul -- cgit v1.2.1 From c2f02fc1a4b88e1c01cb3562168322d0c5debba3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 12:25:34 +0200 Subject: Refactor star and fork buttons Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/project_show.js.coffee | 5 --- app/assets/stylesheets/pages/projects.scss | 3 ++ app/controllers/projects_controller.rb | 7 ++-- app/helpers/projects_helper.rb | 47 --------------------------- app/views/projects/_home_panel.html.haml | 40 +++++++---------------- app/views/projects/buttons/_fork.html.haml | 13 ++++++++ app/views/projects/buttons/_star.html.haml | 22 +++++++++++++ 7 files changed, 54 insertions(+), 83 deletions(-) create mode 100644 app/views/projects/buttons/_fork.html.haml create mode 100644 app/views/projects/buttons/_star.html.haml diff --git a/app/assets/javascripts/project_show.js.coffee b/app/assets/javascripts/project_show.js.coffee index 6828ae471e5..cb47062842e 100644 --- a/app/assets/javascripts/project_show.js.coffee +++ b/app/assets/javascripts/project_show.js.coffee @@ -1,10 +1,5 @@ class @ProjectShow constructor: -> - $('.project-home-panel .star').on 'ajax:success', (e, data, status, xhr) -> - $(@).toggleClass('on').find('.count').html(data.star_count) - .on 'ajax:error', (e, xhr, status, error) -> - new Flash('Star toggle failed. Try again later.', 'alert') - $("a[data-toggle='tab']").on "shown.bs.tab", (e) -> $.cookie "default_view", $(e.target).attr("href"), { expires: 30, path: '/' } diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index b363b4206ed..5f415f2d78f 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -52,8 +52,11 @@ .project-repo-buttons { margin-top: 25px; margin-bottom: 25px; + .btn { @extend .btn-info; + + margin-left: 10px; font-weight: bold; font-size: 14px; line-height: 16px; diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6db65cf47ef..be85521ffa5 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -75,8 +75,6 @@ class ProjectsController < ApplicationController return end - @show_star = !(current_user && current_user.starred?(@project)) - respond_to do |format| format.html do if @project.repository_exists? @@ -152,7 +150,10 @@ class ProjectsController < ApplicationController def toggle_star current_user.toggle_star(@project) @project.reload - render json: { star_count: @project.star_count } + + render json: { + html: view_to_html_string("projects/buttons/_star") + } end def markdown_preview diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ae65985ce75..74c8d4dad06 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -84,53 +84,6 @@ module ProjectsHelper @project.milestones.active.order("due_date, title ASC") end - def link_to_toggle_star(title, starred) - cls = 'star-btn btn' - - toggle_text = - if starred - ' Unstar' - else - ' Star' - end - - toggle_html = content_tag('span', class: 'toggle') do - icon('star') + toggle_text - end - - count_html = content_tag('span', class: 'count') do - @project.star_count.to_s - end - - link_opts = { - title: title, - class: cls, - method: :post, - remote: true, - data: { type: 'json' } - } - - path = toggle_star_namespace_project_path(@project.namespace, @project) - - content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do - link_to(path, link_opts) do - toggle_html + ' ' + count_html - end - end - end - - def link_to_toggle_fork - html = content_tag('span') do - icon('code-fork') + ' Fork' - end - - count_html = content_tag(:span, class: 'count') do - @project.forks_count.to_s - end - - html + count_html - end - def project_for_deploy_key(deploy_key) if deploy_key.projects.include?(@project) @project diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 6335d76ab81..2c32d9ccafe 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -8,35 +8,19 @@ .project-repo-buttons - .inline.star.js-toggler-container{class: @show_star ? 'on' : ''} - - if current_user - = link_to_toggle_star('Star this project.', false) - = link_to_toggle_star('Unstar this project.', true) - - else - = link_to new_user_session_path, class: 'btn star-btn has_tooltip', title: 'You must sign in to star a project' do - %span - = icon('star') - Star - %span.count - = @project.star_count + = render 'projects/buttons/star' + - unless empty_repo - - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace - .inline.fork-buttons.prepend-left-10 - - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 - = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn' do - = link_to_toggle_fork - - else - = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn' do - = link_to_toggle_fork - - elsif forked_from_project = @project.forked_from_project - .inline.prepend-left-10 - = link_to project_path(forked_from_project), class: 'btn' do - = icon("code-fork fw") - Forked from - = forked_from_project.namespace.try(:name) + = render 'projects/buttons/fork' + + - if forked_from_project = @project.forked_from_project + = link_to project_path(forked_from_project), class: 'btn' do + = icon("code-fork fw") + Forked from + = forked_from_project.namespace.try(:name) + - if can? current_user, :download_code, @project - .inline.prepend-left-10 - = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do - %i.fa.fa-download + = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do + %i.fa.fa-download = render "shared/clone_panel" diff --git a/app/views/projects/buttons/_fork.html.haml b/app/views/projects/buttons/_fork.html.haml new file mode 100644 index 00000000000..f0483c79edc --- /dev/null +++ b/app/views/projects/buttons/_fork.html.haml @@ -0,0 +1,13 @@ +- if current_user && can?(current_user, :fork_project, @project) + - if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2 + = link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'btn' do + = icon('code-fork') + Fork + %span.count + = @project.forks_count + - else + = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn' do + = icon('code-fork') + Fork + %span.count + = @project.forks_count diff --git a/app/views/projects/buttons/_star.html.haml b/app/views/projects/buttons/_star.html.haml new file mode 100644 index 00000000000..89e3f4ac738 --- /dev/null +++ b/app/views/projects/buttons/_star.html.haml @@ -0,0 +1,22 @@ +- if current_user + = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn toggle-star', method: :post, remote: true do + - if current_user.starred?(@project) + Unstar + - else + Star + %span.count + = @project.star_count +- else + = link_to new_user_session_path, class: 'btn has_tooltip', title: 'You must sign in to star a project' do + = icon('star') + Star + %span.count + = @project.star_count + +:coffeescript + $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) -> + $(@).replaceWith(data.html) + .on 'ajax:error', (e, xhr, status, error) -> + new Flash('Star toggle failed. Try again later.', 'alert') + + -- cgit v1.2.1 From 8404ab46b91103033a78fdd183e9873f85799b6f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 12:43:46 +0200 Subject: Add shortcut for project activity page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/dispatcher.js.coffee | 1 + app/assets/javascripts/shortcuts_navigation.coffee | 1 + app/views/help/_shortcuts.html.haml | 6 ++++++ app/views/layouts/nav/_project.html.haml | 4 ++-- features/project/shortcuts.feature | 8 +++++++- features/steps/project/project_shortcuts.rb | 5 +++++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index aa6b50ca0f9..8ceaef81a07 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -64,6 +64,7 @@ class Dispatcher shortcut_handler = new ShortcutsNavigation() when 'projects:activity' new Activities() + shortcut_handler = new ShortcutsNavigation() when 'projects:show' shortcut_handler = new ShortcutsNavigation() when 'groups:show' diff --git a/app/assets/javascripts/shortcuts_navigation.coffee b/app/assets/javascripts/shortcuts_navigation.coffee index 31895fbf2bc..5b6f9e7e3f2 100644 --- a/app/assets/javascripts/shortcuts_navigation.coffee +++ b/app/assets/javascripts/shortcuts_navigation.coffee @@ -4,6 +4,7 @@ class @ShortcutsNavigation extends Shortcuts constructor: -> super() Mousetrap.bind('g p', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-project')) + Mousetrap.bind('g e', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-project-activity')) Mousetrap.bind('g f', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-tree')) Mousetrap.bind('g c', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-commits')) Mousetrap.bind('g n', -> ShortcutsNavigation.findAndFollowLink('.shortcuts-network')) diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml index 825acb0ae3e..e809d99ba71 100644 --- a/app/views/help/_shortcuts.html.haml +++ b/app/views/help/_shortcuts.html.haml @@ -79,6 +79,12 @@ %td.shortcut .key g .key p + %td + Go to the project's home page + %tr + %td.shortcut + .key g + .key e %td Go to the project's activity feed %tr diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index cbd5de4cba2..2012478eba9 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -4,8 +4,8 @@ = icon('home fw') %span Project - = nav_link(path: 'projects#activity', html_options: {class: 'activity'}) do - = link_to activity_project_path(@project), title: 'Project', data: {placement: 'right'} do + = nav_link(path: 'projects#activity') do + = link_to activity_project_path(@project), title: 'Project Activity', class: 'shortcuts-project-activity', data: {placement: 'right'} do = icon('dashboard fw') %span Activity diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index cfb68bf1f50..9567b571120 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -46,7 +46,13 @@ Feature: Project Shortcuts Then the active main tab should be Wiki @javascript - Scenario: Navigate to project feed + Scenario: Navigate to project home Given I visit my project's files page Given I press "g" and "p" Then the active main tab should be Home + + @javascript + Scenario: Navigate to project feed + Given I visit my project's files page + Given I press "g" and "e" + Then the active main tab should be Activity diff --git a/features/steps/project/project_shortcuts.rb b/features/steps/project/project_shortcuts.rb index a10e7bf78ee..49e9c5520bb 100644 --- a/features/steps/project/project_shortcuts.rb +++ b/features/steps/project/project_shortcuts.rb @@ -33,4 +33,9 @@ class Spinach::Features::ProjectShortcuts < Spinach::FeatureSteps find('body').native.send_key('g') find('body').native.send_key('w') end + + step 'I press "g" and "e"' do + find('body').native.send_key('g') + find('body').native.send_key('e') + end end -- cgit v1.2.1 From 77fb7e078e49685fa649abc8ebe24376203c2c2c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 12:49:06 +0200 Subject: Fix db schema Signed-off-by: Dmitriy Zaporozhets --- db/schema.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 05d024c8c88..fb0982b10fd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150625153454) do +ActiveRecord::Schema.define(version: 20150620233230) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -344,14 +344,6 @@ ActiveRecord::Schema.define(version: 20150625153454) do add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree - create_table "participants", force: true do |t| - t.integer "target_id", null: false - t.string "target_type", null: false - t.integer "user_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - end - create_table "project_import_data", force: true do |t| t.integer "project_id" t.text "data" -- cgit v1.2.1 From 17156cf909fff49ea068b2dc00fd607af20967f8 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 13:34:05 +0200 Subject: Imrpove mobile view for project page Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/mobile.scss | 24 +++++++++++------------- app/views/projects/_home_panel.html.haml | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/generic/mobile.scss b/app/assets/stylesheets/generic/mobile.scss index a49775daf8b..24c828e0d97 100644 --- a/app/assets/stylesheets/generic/mobile.scss +++ b/app/assets/stylesheets/generic/mobile.scss @@ -44,20 +44,18 @@ .project-home-panel { padding-left: 0 !important; - .project-home-row { - .project-home-desc { - margin-right: 0 !important; - float: none !important; - } - - .project-repo-buttons { - position: static; - margin-top: 15px; - width: 100%; - float: none; - text-align: left; - } + .project-avatar { + display: block; } + + .project-repo-buttons, + .git-clone-holder { + display: none; + } + } + + .project-stats { + display: none; } .container .title { diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 2c32d9ccafe..95c84c96c41 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -2,7 +2,7 @@ .project-home-panel.clearfix{:class => ("empty-project" if empty_repo)} .project-identicon-holder = project_icon(@project, alt: '', class: 'project-avatar avatar s90') - .lead + .project-home-desc.lead - if @project.description.present? = markdown(@project.description, pipeline: :description) -- cgit v1.2.1 From bd08ac55c7b8eb1b41862937aa4f7cc7a53e4bfe Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 13:41:03 +0200 Subject: Recommend user to create README file for both empty and existing project Signed-off-by: Dmitriy Zaporozhets --- app/helpers/projects_helper.rb | 7 +++++++ app/views/projects/empty.html.haml | 10 ++++++---- app/views/projects/show.html.haml | 17 +++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 74c8d4dad06..1bcd9a49527 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -259,4 +259,11 @@ module ProjectsHelper def leave_project_message(project) "Are you sure you want to leave \"#{project.name}\" project?" end + + def new_readme_path + ref = @repository.root_ref if @repository + ref ||= 'master' + + namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'README.md') + end end diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index f103fba404e..dfe45a3802d 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -8,11 +8,13 @@ %h3.page-title The repository for this project is empty %p - You can - = link_to namespace_project_new_blob_path(@project.namespace, @project, 'master'), class: 'btn btn-new' do - add a file -  or do a push via the command line. + If you already have files you can push them using command line instructions below. + %br + Otherwise you can start with + = link_to "adding README", new_readme_path, class: 'underlined-link' + file to this project. +.prepend-top-20 %h3.page-title Command line instructions %div.git-empty diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index ceaf6c8cab3..8fb5f25c2f6 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -50,10 +50,19 @@ .wiki = render_readme(readme) - else - %h4 - Please - = link_to "add README", namespace_project_new_blob_path(@project.namespace, @project, tree_join(@repository.root_ref), file_name: 'README.md') - file to this repository + %h3.page-title + This project does not have README yet :( + - if can?(current_user, :push_code, @project) + %p.slead + A + %code README + file contains information about other files in a repository and is commonly + distributed with computer software, forming part of its documentation. + %br + We recommend you to + = link_to "add README", new_readme_path, class: 'underlined-link' + file to the repository and GitLab will render it here instead of this message. + - if current_user -- cgit v1.2.1 From 39a4bb2abda20fe85a362c1718eab9dfd7de13a3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 16:55:04 +0200 Subject: Cleanup and some test fixes after refactoring project home page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/project_show.js.coffee | 9 +-------- app/views/projects/buttons/_star.html.haml | 19 +++++++++---------- app/views/projects/show.html.haml | 2 +- features/project/issues/issues.feature | 1 + features/project/shortcuts.feature | 1 - features/steps/project/issues/issues.rb | 5 +++++ features/steps/project/star.rb | 2 +- features/steps/shared/project_tab.rb | 4 ++++ 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/project_show.js.coffee b/app/assets/javascripts/project_show.js.coffee index cb47062842e..1fdf28f2528 100644 --- a/app/assets/javascripts/project_show.js.coffee +++ b/app/assets/javascripts/project_show.js.coffee @@ -1,10 +1,3 @@ class @ProjectShow constructor: -> - $("a[data-toggle='tab']").on "shown.bs.tab", (e) -> - $.cookie "default_view", $(e.target).attr("href"), { expires: 30, path: '/' } - - defaultView = $.cookie("default_view") - if defaultView - $("a[href=" + defaultView + "]").tab "show" - else - $("a[data-toggle='tab']:first").tab "show" + # I kept class for future diff --git a/app/views/projects/buttons/_star.html.haml b/app/views/projects/buttons/_star.html.haml index 89e3f4ac738..664ebd18295 100644 --- a/app/views/projects/buttons/_star.html.haml +++ b/app/views/projects/buttons/_star.html.haml @@ -1,22 +1,21 @@ - if current_user - = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn toggle-star', method: :post, remote: true do + = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star', method: :post, remote: true do - if current_user.starred?(@project) Unstar - else Star %span.count = @project.star_count + + :coffeescript + $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) -> + $(@).replaceWith(data.html) + .on 'ajax:error', (e, xhr, status, error) -> + new Flash('Star toggle failed. Try again later.', 'alert') + - else - = link_to new_user_session_path, class: 'btn has_tooltip', title: 'You must sign in to star a project' do + = link_to new_user_session_path, class: 'btn has_tooltip star-btn', title: 'You must sign in to star a project' do = icon('star') Star %span.count = @project.star_count - -:coffeescript - $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) -> - $(@).replaceWith(data.html) - .on 'ajax:error', (e, xhr, status, error) -> - new Flash('Star toggle failed. Try again later.', 'alert') - - diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 8fb5f25c2f6..17907a42e3c 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -51,7 +51,7 @@ = render_readme(readme) - else %h3.page-title - This project does not have README yet :( + This project does not have README yet - if can?(current_user, :push_code, @project) %p.slead A diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index a15298fc452..28cc43ef710 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -189,6 +189,7 @@ Feature: Project Issues Given I logout Given public project "Community" When I visit project "Community" page + And I visit project "Community" issues page And I click link "New Issue" And I should not see assignee field And I should not see milestone field diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index 9567b571120..2369c02806f 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -53,6 +53,5 @@ Feature: Project Shortcuts @javascript Scenario: Navigate to project feed - Given I visit my project's files page Given I press "g" and "e" Then the active main tab should be Activity diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 9ace6436b15..239392eab96 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -194,6 +194,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end end + When "I visit project \"Community\" issues page" do + project = Project.find_by(name: 'Community') + visit namespace_project_issues_path(project.namespace, project) + end + When "I visit empty project's issues page" do project = Project.find_by(name: 'Empty Project') visit namespace_project_issues_path(project.namespace, project) diff --git a/features/steps/project/star.rb b/features/steps/project/star.rb index 8b50bfcef04..bd2e0619cdd 100644 --- a/features/steps/project/star.rb +++ b/features/steps/project/star.rb @@ -5,7 +5,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps include SharedUser step "The project has no stars" do - expect(page).not_to have_content '.star-buttons' + expect(page).not_to have_content '.toggle-star' end step "The project has 0 stars" do diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index 3b94b7d8621..c67e5e4a06a 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -49,4 +49,8 @@ module SharedProjectTab expect(page).to have_content('Back to project') end end + + step 'the active main tab should be Activity' do + ensure_active_main_tab('Activity') + end end -- cgit v1.2.1 From 0ebe8be02d9d17ea8caa2887466509e060e67075 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 17:36:31 +0200 Subject: Fix schortcut tests Signed-off-by: Dmitriy Zaporozhets --- features/project/shortcuts.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index 2369c02806f..0f71c32380b 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -3,7 +3,7 @@ Feature: Project Shortcuts Background: Given I sign in as a user And I own a project - And I visit my project's home page + And I visit my project's commits page @javascript Scenario: Navigate to files tab @@ -12,6 +12,7 @@ Feature: Project Shortcuts @javascript Scenario: Navigate to commits tab + Given I visit my project's files page Given I press "g" and "c" Then the active main tab should be Commits @@ -47,7 +48,6 @@ Feature: Project Shortcuts @javascript Scenario: Navigate to project home - Given I visit my project's files page Given I press "g" and "p" Then the active main tab should be Home -- cgit v1.2.1 From e05fbf04941f1ec5cb17fccb1462353aba2ea04d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 17:41:59 +0200 Subject: Fix creating file in new repo Signed-off-by: Dmitriy Zaporozhets --- features/steps/project/source/browse_files.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 398c9bf5756..95879b9544d 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -187,7 +187,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I click on "add a file" link' do - click_link 'add a file' + click_link 'adding README' # Remove pre-receive hook so we can push without auth FileUtils.rm_f(File.join(@project.repository.path, 'hooks', 'pre-receive')) -- cgit v1.2.1 From 6d56bd86906969589a7f1e2619d75c0a6a03e041 Mon Sep 17 00:00:00 2001 From: Francesco Coda Zabetta Date: Wed, 8 Jul 2015 17:46:51 +0200 Subject: use teaspoon instead of jasmine for testing javascript --- lib/tasks/gitlab/test.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake index cbb3d61af04..4d4e746503a 100644 --- a/lib/tasks/gitlab/test.rake +++ b/lib/tasks/gitlab/test.rake @@ -6,7 +6,7 @@ namespace :gitlab do %W(rake rubocop), %W(rake spinach), %W(rake spec), - %W(rake jasmine:ci) + %W(rake teaspoon) ] cmds.each do |cmd| -- cgit v1.2.1 From a0b9fe12886f55875bc4bce49f2566be3bff79cd Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 20:22:42 +0200 Subject: Fix project tests Signed-off-by: Dmitriy Zaporozhets --- features/project/project.feature | 18 +++++------------- features/steps/shared/paths.rb | 4 ++++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/features/project/project.feature b/features/project/project.feature index 56ae5c78d01..5fb2c67401e 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -18,9 +18,13 @@ Feature: Project Then I should see the default project avatar And I should not see the "Remove avatar" button + Scenario: I should have readme on page + And I visit project "Shop" page + Then I should see project "Shop" README + @javascript Scenario: I should see project activity - When I visit project "Shop" page + When I visit project "Shop" activity page Then I should see project "Shop" activity feed Scenario: I visit edit project @@ -38,24 +42,12 @@ Feature: Project And change project path settings Then I should see project with new path settings - Scenario: I should see project readme and version - When I visit project "Shop" page - And I should see project "Shop" version - Scenario: I should change project default branch When I visit edit project "Shop" page And change project default branch And I save project Then I should see project default branch changed - @javascript - Scenario: I should have default tab per my preference - And I own project "Forum" - When I select project "Forum" README tab - Then I should see project "Forum" README - And I visit project "Shop" page - Then I should see project "Shop" README - Scenario: I tag a project When I visit edit project "Shop" page Then I should see project settings diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index fe651e81dac..88a98a37807 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -251,6 +251,10 @@ module SharedPaths visit namespace_project_path(project.namespace, project) end + step 'I visit project "Shop" activity page' do + visit activity_namespace_project_path(project.namespace, project) + end + step 'I visit project "Forked Shop" merge requests page' do visit namespace_project_merge_requests_path(@forked_project.namespace, @forked_project) end -- cgit v1.2.1 From 098ad0a5b418b2414ab7c20b370d19a254109d19 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 8 Jul 2015 15:49:37 -0400 Subject: Remove "mystery guest" from Milestone filtering features --- spec/features/issues/filter_by_milestone_spec.rb | 20 ++++++++---------- .../merge_requests/filter_by_milestone_spec.rb | 24 +++++++++------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/spec/features/issues/filter_by_milestone_spec.rb b/spec/features/issues/filter_by_milestone_spec.rb index 575ce23bb67..afefe9d9691 100644 --- a/spec/features/issues/filter_by_milestone_spec.rb +++ b/spec/features/issues/filter_by_milestone_spec.rb @@ -1,34 +1,30 @@ -require 'spec_helper' +require 'rails_helper' feature 'Issue filtering by Milestone', feature: true do include Select2Helper - let(:project) { create(:project) } - - before do - login_as(:admin) - end - - scenario 'User filters by Issues without a Milestone', js: true do + scenario 'filters by no Milestone', js: true do + project = create(:project, :public) create(:issue, project: project) - visit_issues + visit_issues(project) filter_by_milestone(Milestone::None.title) expect(page).to have_css('.issue-title', count: 1) end - scenario 'User filters by Issues with a specific Milestone', js: true do + scenario 'filters by a specific Milestone', js: true do + project = create(:project, :public) milestone = create(:milestone, project: project) create(:issue, project: project, milestone: milestone) - visit_issues + visit_issues(project) filter_by_milestone(milestone.title) expect(page).to have_css('.issue-title', count: 1) end - def visit_issues + def visit_issues(project) visit namespace_project_issues_path(project.namespace, project) end diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb index 79b226bcd86..86b95e6cc29 100644 --- a/spec/features/merge_requests/filter_by_milestone_spec.rb +++ b/spec/features/merge_requests/filter_by_milestone_spec.rb @@ -1,34 +1,30 @@ -require 'spec_helper' +require 'rails_helper' feature 'Merge Request filtering by Milestone', feature: true do include Select2Helper - let(:project) { create(:project) } + scenario 'filters by no Milestone', js: true do + project = create(:project, :public) + create(:merge_request, :with_diffs, source_project: project) - before do - login_as(:admin) - end - - scenario 'User filters by Merge Requests without a Milestone', js: true do - create(:merge_request, :simple, source_project: project) - - visit_merge_requests + visit_merge_requests(project) filter_by_milestone(Milestone::None.title) expect(page).to have_css('.merge-request-title', count: 1) end - scenario 'User filters by Merge Requests with a specific Milestone', js: true do + scenario 'filters by a specific Milestone', js: true do + project = create(:project, :public) milestone = create(:milestone, project: project) - create(:merge_request, :simple, source_project: project, milestone: milestone) + create(:merge_request, :with_diffs, source_project: project, milestone: milestone) - visit_merge_requests + visit_merge_requests(project) filter_by_milestone(milestone.title) expect(page).to have_css('.merge-request-title', count: 1) end - def visit_merge_requests + def visit_merge_requests(project) visit namespace_project_merge_requests_path(project.namespace, project) end -- cgit v1.2.1 From 098ced4faad8d1048d6735f5b3ad6da6aa49fcfe Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 8 Jul 2015 08:28:37 -0700 Subject: Improve features to ensure Ajax filter has actually executed --- spec/features/issues/filter_by_milestone_spec.rb | 8 +++++--- spec/features/merge_requests/filter_by_milestone_spec.rb | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/spec/features/issues/filter_by_milestone_spec.rb b/spec/features/issues/filter_by_milestone_spec.rb index afefe9d9691..f600f8684ac 100644 --- a/spec/features/issues/filter_by_milestone_spec.rb +++ b/spec/features/issues/filter_by_milestone_spec.rb @@ -3,9 +3,12 @@ require 'rails_helper' feature 'Issue filtering by Milestone', feature: true do include Select2Helper + let(:project) { create(:project, :public) } + let(:milestone) { create(:milestone, project: project) } + scenario 'filters by no Milestone', js: true do - project = create(:project, :public) create(:issue, project: project) + create(:issue, project: project, milestone: milestone) visit_issues(project) filter_by_milestone(Milestone::None.title) @@ -14,9 +17,8 @@ feature 'Issue filtering by Milestone', feature: true do end scenario 'filters by a specific Milestone', js: true do - project = create(:project, :public) - milestone = create(:milestone, project: project) create(:issue, project: project, milestone: milestone) + create(:issue, project: project) visit_issues(project) filter_by_milestone(milestone.title) diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb index 86b95e6cc29..f70214e1122 100644 --- a/spec/features/merge_requests/filter_by_milestone_spec.rb +++ b/spec/features/merge_requests/filter_by_milestone_spec.rb @@ -3,9 +3,12 @@ require 'rails_helper' feature 'Merge Request filtering by Milestone', feature: true do include Select2Helper + let(:project) { create(:project, :public) } + let(:milestone) { create(:milestone, project: project) } + scenario 'filters by no Milestone', js: true do - project = create(:project, :public) create(:merge_request, :with_diffs, source_project: project) + create(:merge_request, :simple, source_project: project, milestone: milestone) visit_merge_requests(project) filter_by_milestone(Milestone::None.title) @@ -14,9 +17,8 @@ feature 'Merge Request filtering by Milestone', feature: true do end scenario 'filters by a specific Milestone', js: true do - project = create(:project, :public) - milestone = create(:milestone, project: project) create(:merge_request, :with_diffs, source_project: project, milestone: milestone) + create(:merge_request, :simple, source_project: project) visit_merge_requests(project) filter_by_milestone(milestone.title) -- cgit v1.2.1 From b2246ed175975cba21aa3b396fd4b5a8f5567b57 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Wed, 8 Jul 2015 22:27:36 +0200 Subject: Make sure webhooks are mentioned at the top level. --- doc/api/README.md | 2 +- doc/api/projects.md | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/api/README.md b/doc/api/README.md index b474e0ea389..f369c3fd978 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -4,7 +4,7 @@ - [Users](users.md) - [Session](session.md) -- [Projects](projects.md) +- [Projects](projects.md) including setting Webhooks - [Project Snippets](project_snippets.md) - [Services](services.md) - [Repositories](repositories.md) diff --git a/doc/api/projects.md b/doc/api/projects.md index 17c014019ea..10533c73a31 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -4,16 +4,16 @@ ### Project visibility level Project in GitLab has be either private, internal or public. -You can determine it by `visibility_level` field in project. +You can determine it by `visibility_level` field in project. Constants for project visibility levels are next: -* Private. `visibility_level` is `0`. +* Private. `visibility_level` is `0`. Project access must be granted explicitly for each user. * Internal. `visibility_level` is `10`. The project can be cloned by any logged in user. - + * Public. `visibility_level` is `20`. The project can be cloned without any authentication. @@ -362,7 +362,7 @@ Parameters: - `public` (optional) - if `true` same as setting visibility_level = 20 - `visibility_level` (optional) -On success, method returns 200 with the updated project. If parameters are +On success, method returns 200 with the updated project. If parameters are invalid, 400 is returned. ### Fork project @@ -479,6 +479,9 @@ rely on the returned JSON structure. ## Hooks +Also called Project Hooks and Webhooks. +These are different for [System Hooks](system_hooks.md) that are system wide. + ### List project hooks Get a list of project hooks. -- cgit v1.2.1 From 411d5287ed8504d6eb6218a585e944efe4936448 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Wed, 8 Jul 2015 20:30:35 +0000 Subject: Link to update page. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37badd448c1..2e2028c97f6 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Since 2011 a minor or major version of GitLab is released on the 22nd of every m ## Upgrading -For updating the Omnibus installation please see the [update documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/update.md). For installations from source there is an [upgrader script](doc/update/upgrader.md) and there are [upgrade guides](doc/update) detailing all necessary commands to migrate to the next version. +For upgrading information please see our [update page](https://about.gitlab.com/update/). ## Install a development environment @@ -101,4 +101,4 @@ Please see [Getting help for GitLab](https://about.gitlab.com/getting-help/) on ## Is it awesome? Thanks for [asking this question](https://twitter.com/supersloth/status/489462789384056832) Joshua. -[These people](https://twitter.com/gitlab/favorites) seem to like it. +[These people](https://twitter.com/gitlab/favorites) seem to like it. \ No newline at end of file -- cgit v1.2.1 From f0e1da04f061843dd6c6a45d51090c18bade3f1f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 Jul 2015 23:21:35 +0200 Subject: Show last push widget on several project pages Signed-off-by: Dmitriy Zaporozhets --- app/controllers/projects_controller.rb | 1 - app/helpers/projects_helper.rb | 6 ++++++ app/views/projects/_last_push.html.haml | 14 ++++++++++++++ app/views/projects/activity.html.haml | 3 +-- app/views/projects/blob/show.html.haml | 3 +++ app/views/projects/merge_requests/index.html.haml | 1 + app/views/projects/show.html.haml | 1 + app/views/projects/tree/show.html.haml | 4 +++- 8 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 app/views/projects/_last_push.html.haml diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index be85521ffa5..5474f9e97a6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -81,7 +81,6 @@ class ProjectsController < ApplicationController if @project.empty_repo? render 'projects/empty' else - @last_push = current_user.recent_push(@project.id) if current_user render :show end else diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 1bcd9a49527..df1d630c89d 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -266,4 +266,10 @@ module ProjectsHelper namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'README.md') end + + def last_push_event + if current_user + current_user.recent_push(@project.id) + end + end end diff --git a/app/views/projects/_last_push.html.haml b/app/views/projects/_last_push.html.haml new file mode 100644 index 00000000000..30622d8a910 --- /dev/null +++ b/app/views/projects/_last_push.html.haml @@ -0,0 +1,14 @@ +- if event = last_push_event + - if show_last_push_widget?(event) + .hidden-xs.center + .slead + %span You pushed to + = link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do + %strong= event.ref_name + branch + #{time_ago_with_tooltip(event.created_at)} + + %div + = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-info btn-sm" do + Create Merge Request + %hr diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml index 25bd93cae87..b486cd4ded4 100644 --- a/app/views/projects/activity.html.haml +++ b/app/views/projects/activity.html.haml @@ -1,6 +1,5 @@ += render 'projects/last_push' .hidden-xs - = render "events/event_last_push", event: @last_push - - if current_user %ul.nav.nav-pills.event_filter.pull-right %li diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml index a1d464bac59..bd2fc43633c 100644 --- a/app/views/projects/blob/show.html.haml +++ b/app/views/projects/blob/show.html.haml @@ -1,4 +1,7 @@ - page_title @blob.path, @ref + += render 'projects/last_push' + %div.tree-ref-holder = render 'shared/ref_switcher', destination: 'blob', path: @path diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index e0bc1df97ee..72fbe2e27a7 100644 --- a/app/views/projects/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml @@ -1,4 +1,5 @@ - page_title "Merge Requests" += render 'projects/last_push' .append-bottom-10 .pull-right = render 'shared/issuable/search_form', path: namespace_project_merge_requests_path(@project.namespace, @project) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 17907a42e3c..d9cff805575 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -6,6 +6,7 @@ = render 'shared/no_ssh' = render 'shared/no_password' += render 'projects/last_push' = render "home_panel" .project-stats diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 04590f65b27..c9e59428e78 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -2,7 +2,9 @@ = content_for :meta_tags do - if current_user = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits") - + += render 'projects/last_push' + .tree-ref-holder = render 'shared/ref_switcher', destination: 'tree', path: @path -- cgit v1.2.1 From 0e5fbb29f42e43c2b43192d61d47402602dfd84f Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 8 Jul 2015 17:56:56 -0400 Subject: Remove unused `task_[un]check` states from Update services These were left over from the old Task handling. --- app/services/issues/update_service.rb | 7 +------ app/services/merge_requests/update_service.rb | 6 +----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index 3220facaf7c..e3b508d4965 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -8,10 +8,6 @@ module Issues Issues::ReopenService.new(project, current_user, {}).execute(issue) when 'close' Issues::CloseService.new(project, current_user, {}).execute(issue) - when 'task_check' - issue.update_nth_task(params[:task_num].to_i, true) - when 'task_uncheck' - issue.update_nth_task(params[:task_num].to_i, false) end params[:assignee_id] = "" if params[:assignee_id] == IssuableFinder::NONE @@ -20,8 +16,7 @@ module Issues filter_params old_labels = issue.labels.to_a - if params.present? && issue.update_attributes(params.except(:state_event, - :task_num)) + if params.present? && issue.update_attributes(params.except(:state_event)) issue.reset_events_cache if issue.labels != old_labels diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index f6570f52241..108d755aa03 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -18,10 +18,6 @@ module MergeRequests MergeRequests::ReopenService.new(project, current_user, {}).execute(merge_request) when 'close' MergeRequests::CloseService.new(project, current_user, {}).execute(merge_request) - when 'task_check' - merge_request.update_nth_task(params[:task_num].to_i, true) - when 'task_uncheck' - merge_request.update_nth_task(params[:task_num].to_i, false) end params[:assignee_id] = "" if params[:assignee_id] == IssuableFinder::NONE @@ -31,7 +27,7 @@ module MergeRequests old_labels = merge_request.labels.to_a if params.present? && merge_request.update_attributes( - params.except(:state_event, :task_num) + params.except(:state_event) ) merge_request.reset_events_cache -- cgit v1.2.1 From 8a148793afc5e88dad27a975e9a7c1f5a7dfafc9 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 8 Jul 2015 18:00:42 -0400 Subject: Simplify Issue and MergeRequest UpdateServices Now that those pesky task states are gone, these become a lot simpler. --- app/services/issues/update_service.rb | 6 ++---- app/services/merge_requests/update_service.rb | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index e3b508d4965..f848ecedd6b 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -1,9 +1,7 @@ module Issues class UpdateService < Issues::BaseService def execute(issue) - state = params[:state_event] - - case state + case params.delete(:state_event) when 'reopen' Issues::ReopenService.new(project, current_user, {}).execute(issue) when 'close' @@ -16,7 +14,7 @@ module Issues filter_params old_labels = issue.labels.to_a - if params.present? && issue.update_attributes(params.except(:state_event)) + if params.present? && issue.update_attributes(params) issue.reset_events_cache if issue.labels != old_labels diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index 108d755aa03..e5c5368f5d6 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -11,9 +11,7 @@ module MergeRequests params.except!(:target_project_id) params.except!(:source_branch) - state = params[:state_event] - - case state + case params.delete(:state_event) when 'reopen' MergeRequests::ReopenService.new(project, current_user, {}).execute(merge_request) when 'close' @@ -26,9 +24,7 @@ module MergeRequests filter_params old_labels = merge_request.labels.to_a - if params.present? && merge_request.update_attributes( - params.except(:state_event) - ) + if params.present? && merge_request.update_attributes(params) merge_request.reset_events_cache if merge_request.labels != old_labels -- cgit v1.2.1 From 335749d7540530ae3de3bfa0715be0f2e7ef608d Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 8 Jul 2015 18:17:13 -0400 Subject: Ensure `@sort` is set by set_filters_params Closes #1750 --- app/controllers/application_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 63fc146f1d1..8a9d0ce6ff4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -265,6 +265,7 @@ class ApplicationController < ActionController::Base params[:scope] = 'all' if params[:scope].blank? params[:state] = 'opened' if params[:state].blank? + @sort = params[:sort] @filter_params = params.dup if @project -- cgit v1.2.1 From 6591485562ef590f27e3ddd3025adb8a30b8ca09 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 7 Jul 2015 00:31:59 -0400 Subject: Add Safari/iOS versions of the logo --- app/assets/images/touch-icon-ipad-retina.png | Bin 0 -> 6959 bytes app/assets/images/touch-icon-ipad.png | Bin 0 -> 3615 bytes app/assets/images/touch-icon-iphone-retina.png | Bin 0 -> 5145 bytes app/assets/images/touch-icon-iphone.png | Bin 0 -> 2827 bytes app/views/layouts/_head.html.haml | 15 +++++++++++++-- 5 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/touch-icon-ipad-retina.png create mode 100644 app/assets/images/touch-icon-ipad.png create mode 100644 app/assets/images/touch-icon-iphone-retina.png create mode 100644 app/assets/images/touch-icon-iphone.png diff --git a/app/assets/images/touch-icon-ipad-retina.png b/app/assets/images/touch-icon-ipad-retina.png new file mode 100644 index 00000000000..eb8a3f09f37 Binary files /dev/null and b/app/assets/images/touch-icon-ipad-retina.png differ diff --git a/app/assets/images/touch-icon-ipad.png b/app/assets/images/touch-icon-ipad.png new file mode 100644 index 00000000000..d0e191ea75d Binary files /dev/null and b/app/assets/images/touch-icon-ipad.png differ diff --git a/app/assets/images/touch-icon-iphone-retina.png b/app/assets/images/touch-icon-iphone-retina.png new file mode 100644 index 00000000000..482763186df Binary files /dev/null and b/app/assets/images/touch-icon-iphone-retina.png differ diff --git a/app/assets/images/touch-icon-iphone.png b/app/assets/images/touch-icon-iphone.png new file mode 100644 index 00000000000..cf4cc583022 Binary files /dev/null and b/app/assets/images/touch-icon-iphone.png differ diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index dbc68c39bf1..64ae33619e6 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -7,14 +7,25 @@ %title= page_title = favicon_link_tag 'favicon.ico' - = stylesheet_link_tag "application", :media => "all" - = stylesheet_link_tag "print", :media => "print" + + = stylesheet_link_tag "application", media: "all" + = stylesheet_link_tag "print", media: "print" + = javascript_include_tag "application" + = csrf_meta_tags + = include_gon + %meta{name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1'} %meta{name: 'theme-color', content: '#474D57'} + -# Apple Safari/iOS home screen icons + = favicon_link_tag 'touch-icon-iphone.png', rel: 'apple-touch-icon' + = favicon_link_tag 'touch-icon-ipad.png', rel: 'apple-touch-icon', sizes: '76x76' + = favicon_link_tag 'touch-icon-iphone-retina.png', rel: 'apple-touch-icon', sizes: '120x120' + = favicon_link_tag 'touch-icon-ipad-retina.png', rel: 'apple-touch-icon', sizes: '152x152' + = yield :meta_tags = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id') -- cgit v1.2.1 From c4330d97b1f58870433538430c96a3747c0d0836 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 9 Jul 2015 01:43:48 -0400 Subject: Add Windows 8 pinned site tile meta tags --- app/assets/images/msapplication-tile.png | Bin 0 -> 6102 bytes app/views/layouts/_head.html.haml | 4 ++++ 2 files changed, 4 insertions(+) create mode 100644 app/assets/images/msapplication-tile.png diff --git a/app/assets/images/msapplication-tile.png b/app/assets/images/msapplication-tile.png new file mode 100644 index 00000000000..f8c5c8b28b4 Binary files /dev/null and b/app/assets/images/msapplication-tile.png differ diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index 64ae33619e6..a43b6d57c9c 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -26,6 +26,10 @@ = favicon_link_tag 'touch-icon-iphone-retina.png', rel: 'apple-touch-icon', sizes: '120x120' = favicon_link_tag 'touch-icon-ipad-retina.png', rel: 'apple-touch-icon', sizes: '152x152' + -# Windows 8 pinned site tile + %meta{name: 'msapplication-TileImage', content: image_url('msapplication-tile.png')} + %meta{name: 'msapplication-TileColor', content: '#554488'} + = yield :meta_tags = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id') -- cgit v1.2.1 From e49f1a274a9bb6cf979f67044173d47c26c65519 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 10:34:20 +0200 Subject: Mention project page redesign in CHANGELOG Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 8cde5377766..5daee9830ed 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -40,6 +40,7 @@ v 7.13.0 (unreleased) - Query Optimization in MySQL. - Allow users to be blocked and unblocked via the API - Use native Postgres database cleaning during backup restore + - Redesign project page. Show README as default instead of activity. Move project activity to separate page v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. -- cgit v1.2.1 From 3cdd68475f80c43371610c981b41cd3dc87e3300 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 11:00:14 +0200 Subject: Add star icon to star button Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/buttons/_star.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/projects/buttons/_star.html.haml b/app/views/projects/buttons/_star.html.haml index 664ebd18295..b5f14b43bfd 100644 --- a/app/views/projects/buttons/_star.html.haml +++ b/app/views/projects/buttons/_star.html.haml @@ -1,5 +1,6 @@ - if current_user = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star', method: :post, remote: true do + = icon('star') - if current_user.starred?(@project) Unstar - else -- cgit v1.2.1 From 1bf3e1578abf41d937a2bf8e2512e0174ed0a4b4 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 11:36:09 +0200 Subject: Properly render plain readme Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/typography.scss | 8 ++++++++ app/helpers/application_helper.rb | 8 ++++++++ lib/gitlab/markup_helper.rb | 10 ++++++++++ 3 files changed, 26 insertions(+) diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss index 66767cb13cb..2db4213159a 100644 --- a/app/assets/stylesheets/generic/typography.scss +++ b/app/assets/stylesheets/generic/typography.scss @@ -17,6 +17,14 @@ pre { background: #333; color: $background-color; } + + &.plain-readme { + background: none; + border: none; + padding: 0; + margin: 0; + font-size: 14px; + } } .monospace { diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0b46db4b1c3..a803b66c502 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -213,6 +213,10 @@ module ApplicationHelper Haml::Helpers.preserve(markdown(file_content)) elsif asciidoc?(file_name) asciidoc(file_content) + elsif plain?(file_name) + content_tag :pre, class: 'plain-readme' do + file_content + end else GitHub::Markup.render(file_name, file_content). force_encoding(file_content.encoding).html_safe @@ -221,6 +225,10 @@ module ApplicationHelper simple_format(file_content) end + def plain?(filename) + Gitlab::MarkupHelper.plain?(filename) + end + def markup?(filename) Gitlab::MarkupHelper.markup?(filename) end diff --git a/lib/gitlab/markup_helper.rb b/lib/gitlab/markup_helper.rb index f99be969d3e..b1991e2e285 100644 --- a/lib/gitlab/markup_helper.rb +++ b/lib/gitlab/markup_helper.rb @@ -33,6 +33,16 @@ module Gitlab filename.downcase.end_with?(*%w(.adoc .ad .asciidoc)) end + # Public: Determines if the given filename is plain text. + # + # filename - Filename string to check + # + # Returns boolean + def plain?(filename) + filename.downcase.end_with?('.txt') || + filename.downcase == 'readme' + end + def previewable?(filename) markup?(filename) end -- cgit v1.2.1 From 6848b0a6258681286c3929979fb3e6b5571cce61 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 12:02:47 +0200 Subject: Show edit readme from project home page Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/show.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 17907a42e3c..889ad52f235 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -43,10 +43,11 @@ - if readme = @repository.readme %article.readme-holder#README .clearfix - %small.pull-right - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do - %i.fa.fa-file - = readme.name + .pull-right +   + - if can?(current_user, :push_code, @project) + = link_to namespace_project_edit_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do + %i.fa.fa-pencil .wiki = render_readme(readme) - else -- cgit v1.2.1 From 846538076bdbae11b7fbbf2ad28b6c777351cbfc Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 13:27:50 +0200 Subject: Dont check for link but for actual readme content Signed-off-by: Dmitriy Zaporozhets --- features/steps/project/project.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index b4a0ba1e27f..9a451c19374 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -86,7 +86,6 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see project "Forum" README' do - expect(page).to have_link 'README.md' expect(page).to have_content 'Sample repo for testing gitlab features' end -- cgit v1.2.1 From d8dfbc511830aff5e3e3f01f94f91f292b606f44 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 14:31:03 +0200 Subject: Improve readme tests Signed-off-by: Dmitriy Zaporozhets --- features/steps/project/project.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 9a451c19374..e8f9a80737f 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -86,12 +86,15 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see project "Forum" README' do - expect(page).to have_content 'Sample repo for testing gitlab features' + page.within('#README') do + expect(page).to have_content 'Sample repo for testing gitlab features' + end end step 'I should see project "Shop" README' do - expect(page).to have_link 'README.md' - expect(page).to have_content 'testme' + page.within('#README') do + expect(page).to have_content 'testme' + end end step 'I add project tags' do -- cgit v1.2.1 From 635ffe4841a850a074ff189a1791b64884af9621 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 14:47:28 +0200 Subject: Cache readme rendering result Signed-off-by: Dmitriy Zaporozhets --- app/helpers/projects_helper.rb | 4 ++++ app/views/projects/show.html.haml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index df1d630c89d..cef23a52e34 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -272,4 +272,8 @@ module ProjectsHelper current_user.recent_push(@project.id) end end + + def readme_cache_key + [@project.id, @project.commit.sha, "readme"].join('-') + end end diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index d9cff805575..19ac6dacf7d 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -49,7 +49,8 @@ %i.fa.fa-file = readme.name .wiki - = render_readme(readme) + = cache(readme_cache_key) do + = render_readme(readme) - else %h3.page-title This project does not have README yet -- cgit v1.2.1 From dd4fee5fdbda07fbc09234c4b043c3c9939a6a9b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 12 Mar 2015 12:55:02 -0400 Subject: api: add 'system', 'upvote', and 'downvote' fields to note queries --- doc/api/notes.md | 10 ++++++++-- lib/api/entities.rb | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/api/notes.md b/doc/api/notes.md index ee2f9fa0eac..c683cb883d4 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -31,7 +31,10 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "created_at": "2013-10-02T09:22:45Z" + "created_at": "2013-10-02T09:22:45Z", + "system": true, + "upvote": false, + "downvote": false }, { "id": 305, @@ -45,7 +48,10 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "created_at": "2013-10-02T09:56:03Z" + "created_at": "2013-10-02T09:56:03Z", + "system": false, + "upvote": false, + "downvote": false } ] ``` diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 31202fa8c1f..27d60e881ec 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -190,6 +190,9 @@ module API expose :attachment_identifier, as: :attachment expose :author, using: Entities::UserBasic expose :created_at + expose :system + expose :upvote?, as: :upvote + expose :downvote?, as: :downvote end class MRNote < Grape::Entity -- cgit v1.2.1 From df64e0db08e2aa03534c0286801eb8dfc8f02e97 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 9 Jul 2015 14:50:09 -0400 Subject: Style all blockquote children, not just p Closes #1939 --- app/assets/stylesheets/base/mixins.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/base/mixins.scss b/app/assets/stylesheets/base/mixins.scss index 08cbe911672..d64e79170b9 100644 --- a/app/assets/stylesheets/base/mixins.scss +++ b/app/assets/stylesheets/base/mixins.scss @@ -109,7 +109,7 @@ font-size: 1.2em; } - blockquote p { + blockquote { color: #888; font-size: 15px; line-height: 1.5; -- cgit v1.2.1 From 4498de4867bc87ac83898cfe80417a9d29c952ea Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 9 Jul 2015 15:10:59 -0400 Subject: Reset ul list style types inside notes Closes #259 --- app/assets/stylesheets/pages/notes.scss | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index 42b8ecabb38..4da65b28743 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -72,13 +72,28 @@ ul.notes { .note { display: block; position:relative; + .note-body { overflow: auto; + .note-text { overflow: auto; word-wrap: break-word; @include md-typography; + // Reset ul style types since we're nested inside a ul already + & > ul { + list-style-type: disc; + + ul { + list-style-type: circle; + + ul { + list-style-type: square; + } + } + } + // Reduce left padding of first task list ul element ul.task-list:first-child { padding-left: 10px; @@ -94,6 +109,7 @@ ul.notes { } } } + .note-header { padding-bottom: 3px; } -- cgit v1.2.1 From 4c586dc7c217b3e43956919fa752a8fa4e16acb9 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 9 Jul 2015 12:35:53 -0700 Subject: Revert "api: add 'system', 'upvote', and 'downvote' fields to note queries" This reverts commit dd4fee5fdbda07fbc09234c4b043c3c9939a6a9b. --- doc/api/notes.md | 10 ++-------- lib/api/entities.rb | 3 --- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/doc/api/notes.md b/doc/api/notes.md index c683cb883d4..ee2f9fa0eac 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -31,10 +31,7 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "created_at": "2013-10-02T09:22:45Z", - "system": true, - "upvote": false, - "downvote": false + "created_at": "2013-10-02T09:22:45Z" }, { "id": 305, @@ -48,10 +45,7 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "created_at": "2013-10-02T09:56:03Z", - "system": false, - "upvote": false, - "downvote": false + "created_at": "2013-10-02T09:56:03Z" } ] ``` diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 27d60e881ec..31202fa8c1f 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -190,9 +190,6 @@ module API expose :attachment_identifier, as: :attachment expose :author, using: Entities::UserBasic expose :created_at - expose :system - expose :upvote?, as: :upvote - expose :downvote?, as: :downvote end class MRNote < Grape::Entity -- cgit v1.2.1 From 360ee25ddbaff3d22fe2408e1573b0d3a29e3dbe Mon Sep 17 00:00:00 2001 From: Darby Date: Thu, 9 Jul 2015 13:38:33 -0700 Subject: Fixed the issues --- app/helpers/gitlab_markdown_helper.rb | 2 +- app/views/projects/notes/_edit_form.html.haml | 2 +- app/views/projects/notes/_form.html.haml | 3 ++- spec/helpers/gitlab_markdown_helper_spec.rb | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index f4c7a6494a9..eb3f72a307d 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -118,7 +118,7 @@ module GitlabMarkdownHelper # Returns a random markdown tip for use as a textarea placeholder def random_markdown_tip - "#{MARKDOWN_TIPS.sample}" + MARKDOWN_TIPS.sample end private diff --git a/app/views/projects/notes/_edit_form.html.haml b/app/views/projects/notes/_edit_form.html.haml index 9c4c5dc0c7f..7472b33bb53 100644 --- a/app/views/projects/notes/_edit_form.html.haml +++ b/app/views/projects/notes/_edit_form.html.haml @@ -5,7 +5,7 @@ = render 'projects/zen', f: f, attr: :note, classes: 'note_text js-note-text js-task-list-field' .comment-hints.clearfix - .pull-left #{link_to 'Markdown tip:', help_page_path('markdown', 'markdown'),{ target: '_blank', tabindex: -1 }} + .pull-left #{link_to 'Markdown ', help_page_path('markdown', 'markdown'),{ target: '_blank', tabindex: -1 }} .pull-right #{link_to 'Attach a file', '#', class: 'markdown-selector', tabindex: -1 } .note-form-actions diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 4c662336428..64f98741d45 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -13,7 +13,8 @@ .comment-hints.clearfix .pull-left - = link_to "Markdown tip:", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 } + = link_to "Markdown ", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 } + tip: = random_markdown_tip .pull-right = link_to '#', class: 'markdown-selector', tabindex: -1 do diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 30a15b974bd..a42ccb9b501 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -137,6 +137,7 @@ describe GitlabMarkdownHelper do describe 'random_markdown_tip' do it 'returns a random Markdown tip' do stub_const("#{described_class}::MARKDOWN_TIPS", ['Random tip']) + expect(random_markdown_tip).to eq 'Random tip' end end end -- cgit v1.2.1 From 7b06c32e0027fffafd5314ad6bbe7d4cdd18c5b6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Jul 2015 22:28:12 +0000 Subject: Point to ci.gitlab.com badge in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e2028c97f6..7dc0ffb30ee 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ To use EE and get official support please [become a subscriber](https://about.gi ## Code status -- [![build status](https://ci.gitlab.org/projects/1/status.png?ref=master)](https://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) +- [![build status](https://ci.gitlab.com/projects/1/status.png?ref=master)](https://ci.gitlab.com/projects/1?ref=master) on ci.gitlab.com (master branch) - [![Build Status](https://semaphoreapp.com/api/v1/projects/2f1a5809-418b-4cc2-a1f4-819607579fe7/243338/badge.png)](https://semaphoreapp.com/gitlabhq/gitlabhq) -- cgit v1.2.1 From ec72aaeae7c478c671c11bd678c3bd22d79e1549 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Thu, 9 Jul 2015 15:33:42 -0700 Subject: added new doc about creating a new branch --- doc/gitlab-basics/README.md | 2 ++ doc/gitlab-basics/basic-git-commands.md | 29 +++++++++++++---------- doc/gitlab-basics/command-line-commands.md | 30 +++++++++++++----------- doc/gitlab-basics/create-branch.md | 37 ++++++++++++++++++++++++++++++ doc/gitlab-basics/create-project.md | 8 +++---- doc/gitlab-basics/create-your-ssh-keys.md | 20 ++++++++-------- doc/gitlab-basics/start-using-git.md | 36 ++++++++++++----------------- 7 files changed, 100 insertions(+), 62 deletions(-) create mode 100644 doc/gitlab-basics/create-branch.md diff --git a/doc/gitlab-basics/README.md b/doc/gitlab-basics/README.md index 3e4400b544b..63fa7a90a26 100644 --- a/doc/gitlab-basics/README.md +++ b/doc/gitlab-basics/README.md @@ -13,3 +13,5 @@ Step-by-step guides on the basics of working with Git and GitLab. * [Create a project](create-project.md) * [Create a group](create-group.md) + +* [Create a branch](create-branch.md) diff --git a/doc/gitlab-basics/basic-git-commands.md b/doc/gitlab-basics/basic-git-commands.md index ed210ba5420..52465c24319 100644 --- a/doc/gitlab-basics/basic-git-commands.md +++ b/doc/gitlab-basics/basic-git-commands.md @@ -1,58 +1,63 @@ # Basic Git commands -* Go to the master branch to pull the latest changes from there +### Go to the master branch to pull the latest changes from there ``` git checkout master ``` -* Download the latest changes in the project, so that you work on an up-to-date copy (this is important to do every time you work on a project), while you setup tracking branches +### Download the latest changes in the project +This is for you to work on an up-to-date copy (it is important to do every time you work on a project), while you setup tracking branches. ``` git pull REMOTE NAME-OF-BRANCH -u ``` (REMOTE: origin) (NAME-OF-BRANCH: could be "master" or an existing branch) -* Create a branch (remember that spaces won't be recognized, you need to use a hyphen or underscore) +### Create a branch +Spaces won't be recognized, so you need to use a hyphen or underscore. ``` git checkout -b NAME-OF-BRANCH ``` -* Work on a branch that has already been created +### Work on a branch that has already been created ``` git checkout NAME-OF-BRANCH ``` -* To see the changes you've made (it's important to be aware of what's happening and what's the status of your changes) +### View the changes you've made +It's important to be aware of what's happening and what's the status of your changes. ``` git status ``` -* Add changes to commit (you'll be able to see your changes in red when you type "git status") +### Add changes to commit +You'll see your changes in red when you type "git status". ``` git add CHANGES IN RED git commit -m "DESCRIBE THE INTENTION OF THE COMMIT" ``` -* Send changes to gitlab.com +### Send changes to gitlab.com ``` -git push origin NAME-OF-BRANCH +git push REMOTE NAME-OF-BRANCH ``` -* Throw away all changes in the Git repository, but leave unstaged things +### Delete all changes in the Git repository, but leave unstaged things ``` git checkout . ``` -* Delete all changes in the Git repository, including untracked files +### Delete all changes in the Git repository, including untracked files ``` git clean -f ``` -* Remove all the changes that you don't want to send to gitlab.com +### Remove all the changes that you don't want to send to gitlab.com ``` git add NAME-OF-FILE -all ``` -* Merge created branch with master branch. You need to be in the created branch +### Merge created branch with master branch +You need to be in the created branch. ``` git checkout NAME-OF-BRANCH git merge master diff --git a/doc/gitlab-basics/command-line-commands.md b/doc/gitlab-basics/command-line-commands.md index a596bf20c74..a8223a9b161 100644 --- a/doc/gitlab-basics/command-line-commands.md +++ b/doc/gitlab-basics/command-line-commands.md @@ -2,46 +2,47 @@ ## Start working on your project -* In Git, when you copy a project you say you "clone" it. To work on a git project locally (from your own computer), you will need to clone it. To do this, sign in to [GitLab.com](https://gitlab.com) +In Git, when you copy a project you say you "clone" it. To work on a git project locally (from your own computer), you will need to clone it. To do this, sign in to [GitLab.com](https://gitlab.com). -* When you are on your Dashboard, click on the project that you'd like to clone, which you'll find at the right side of your screen +When you are on your Dashboard, click on the project that you'd like to clone, which you'll find at the right side of your screen. ![Select a project](basicsimages/select_project.png) -* To work in the project, you can copy a link to the Git repository through a SSH or a HTTPS protocol. SSH is easier to use after it's been [setup](create-your-ssh-keys.md). When you're in the project, click on the HTTPS or SSH button at the right side of your screen. Then copy the link (you'll have to paste it on your shell in the next step) +To work in the project, you can copy a link to the Git repository through a SSH or a HTTPS protocol. SSH is easier to use after it's been [setup](create-your-ssh-keys.md). When you're in the project, click on the HTTPS or SSH button at the right side of your screen. Then copy the link (you'll have to paste it on your shell in the next step). ![Copy the HTTPS or SSH](basicsimages/https.png) ## On the command line -* To clone your project, go to your computer's shell and type the following command +### Clone your project +Go to your computer's shell and type the following command: ``` git clone PASTE HTTPS OR SSH HERE ``` -* A clone of the project will be created in your computer +A clone of the project will be created in your computer. -* Go into a project, directory or file to work in it +### Go into a project, directory or file to work in it ``` cd NAME-OF-PROJECT-OR-FILE ``` -* Go back one directory or file +### Go back one directory or file ``` cd ../ ``` -* To see what’s in the directory that you are in +### View what’s in the directory that you are in ``` ls ``` -* Create a directory +### Create a directory ``` mkdir NAME-OF-YOUR-DIRECTORY ``` -* Create a README.md or file in directory +### Create a README.md or file in directory ``` touch README.md nano README.md @@ -51,22 +52,23 @@ nano README.md #### Press: enter ``` -* Remove a file +### Remove a file ``` rm NAME-OF-FILE ``` -* Remove a directory and all of its contents +### Remove a directory and all of its contents ``` rm -rf NAME-OF-DIRECTORY ``` -* View history in the command line +### View history in the command line ``` history ``` -* Carry out commands for which the account you are using lacks authority. (You will be asked for an administrator’s password) +### Carry out commands for which the account you are using lacks authority +You will be asked for an administrator’s password. ``` sudo ``` diff --git a/doc/gitlab-basics/create-branch.md b/doc/gitlab-basics/create-branch.md new file mode 100644 index 00000000000..ea37bc377ed --- /dev/null +++ b/doc/gitlab-basics/create-branch.md @@ -0,0 +1,37 @@ +# How to create a branch + +To add changes to your project in GitLab, you should create a branch. + +To create a new branch, sign in to [gitlab.com](https://gitlab.com). + +Select a project on the right side of your screen: + +![Select a project](basicsimages/select_project.png) + +Click on "commits" on the menu on the left side of your screen: + +![Commits](basicsimages/commits.png) + +Click on the "branches" tab: + +![Branches](basicsimages/branches.png) + +Click on the "new branch" button on the right side of the screen: + +![New branch](basicsimages/newbranch.png) + +Fill out the information required: + +1. Add a name for your new branch (you can't add spaces, so you can use hyphens or underscores) + +1. On the "create from" space, add the word: master or the name of the master branch + +1. Click on the button "create branch" + +![Branch info](basicsimages/branch_info.png) + +After you created a new branch, click on the files on which you'll be working. + +You will be able to find and select the name of your branch in the white box next to the project's name: + +![Branch name](basicsimages/branch_name.png) diff --git a/doc/gitlab-basics/create-project.md b/doc/gitlab-basics/create-project.md index e3963f66010..90d40cb6c51 100644 --- a/doc/gitlab-basics/create-project.md +++ b/doc/gitlab-basics/create-project.md @@ -1,14 +1,12 @@ # How to create a project in GitLab -## Create a project +To create a new project, sign in to [GitLab.com](https://gitlab.com). -* Sign in to [GitLab.com](https://gitlab.com) - -* Go to your Dashboard and click on "new project" on the right side of your screen +Go to your Dashboard and click on "new project" on the right side of your screen. ![Create a project](basicsimages/new_project.png) -* Fill out the required information +Fill out the required information: 1. Project path or the name of your project (you can't add spaces, so you can use hyphens or underscores) diff --git a/doc/gitlab-basics/create-your-ssh-keys.md b/doc/gitlab-basics/create-your-ssh-keys.md index cb699588cac..dcd3e6ffb31 100644 --- a/doc/gitlab-basics/create-your-ssh-keys.md +++ b/doc/gitlab-basics/create-your-ssh-keys.md @@ -4,34 +4,34 @@ You need to connect your computer to your GitLab account through SSH Keys. They ## Generate your SSH Key -* Create an account on GitLab. Sign up and check your email for your confirmation link +Create an account on GitLab. Sign up and check your email for your confirmation link. -* After you confirm, go to [GitLab.com](https://about.gitlab.com/) and sign in to your account +After you confirm, go to [GitLab.com](https://about.gitlab.com/) and sign in to your account. ## Add your SSH Key -* At the top right corner, click on "profile settings" +At the top right corner, click on "profile settings": ![profile settings](basicsimages/profile_settings.png) -* On the left side menu click on "SSH Keys" +On the left side menu click on "SSH Keys": ![SSH Keys](basicsimages/shh_keys.png) -* Then click on the green button "Add SSH Key" +Then click on the green button "Add SSH Key": ![Add SSH Key](basicsimages/add_sshkey.png) -* There, you should paste the SSH Key that your commandline will generate for you. Below you'll find the steps to generate it +There, you should paste the SSH Key that your command line will generate for you. Below you'll find the steps to generate it: ![Paste SSH Key](basicsimages/paste_sshkey.png) -## To generate an SSH Key on your commandline +## To generate an SSH Key on your command line -* Go to your [commandline](start-using-git.md) and follow the [instructions](../ssh/README.md) to generate it +Go to your [command line](start-using-git.md) and follow the [instructions](../ssh/README.md) to generate it. -* Copy the SSH Key that your commandline created and paste it on the "Key" box on the GitLab page. The title will be added automatically +Copy the SSH Key that your command line created and paste it on the "Key" box on the GitLab page. The title will be added automatically. ![Paste SSH Key](basicsimages/key.png) -* Now, you'll be able to use Git over SSH, instead of Git over HTTP. +Now, you'll be able to use Git over SSH, instead of Git over HTTP. diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md index 21d93ed2e4d..5b1c6c1cd46 100644 --- a/doc/gitlab-basics/start-using-git.md +++ b/doc/gitlab-basics/start-using-git.md @@ -1,10 +1,10 @@ -# Start using Git on the commandline +# Start using Git on the command line -If you want to start using a Git and GitLab, make sure that you have created an account on [GitLab.com](https://about.gitlab.com/) +If you want to start using a Git and GitLab, make sure that you have created an account on [GitLab.com](https://about.gitlab.com/). ## Open a shell -* Depending on your operating system, find the shell of your preference. Here are some suggestions +Depending on your operating system, find the shell of your preference. Here are some suggestions. - [Terminal](http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line) on Mac OSX @@ -14,54 +14,48 @@ If you want to start using a Git and GitLab, make sure that you have created an ## Check if Git has already been installed -* Git is usually preinstalled on Mac and Linux - -* Type the following command and then press enter +Git is usually preinstalled on Mac and Linux. +Type the following command and then press enter: ``` git --version ``` -* You should receive a message that will tell you which Git version you have in your computer. If you don’t receive a "Git version" message, it means that you need to [download Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) +You should receive a message that will tell you which Git version you have in your computer. If you don’t receive a "Git version" message, it means that you need to [download Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). -* If Git doesn't automatically download, there's an option on the website to [download manually](https://git-scm.com/downloads). Then follow the steps on the installation window +If Git doesn't automatically download, there's an option on the website to [download manually](https://git-scm.com/downloads). Then follow the steps on the installation window. -* After you finished installing, open a new shell and type "git --version" again to verify that it was correctly installed +After you finished installing, open a new shell and type "git --version" again to verify that it was correctly installed. ## Add your Git username and set your email -* It is important because every Git commit that you create will use this information - -* On your shell, type the following command to add your username +It is important because every Git commit that you create will use this information. +On your shell, type the following command to add your username: ``` git config --global user.name ADD YOUR USERNAME ``` -* Then verify that you have the correct username - +Then verify that you have the correct username: ``` git config --global user.name ``` -* To set your email address, type the following command - +To set your email address, type the following command: ``` git config --global user.email ADD YOUR EMAIL ``` -* To verify that you entered your email correctly, type - +To verify that you entered your email correctly, type: ``` git config --global user.email ``` -* You'll need to do this only once because you are using the "--global" option. It tells Git to always use this information for anything you do on that system. If you want to override this with a different username or email address for specific projects, you can run the command without the "--global" option when you’re in that project +You'll need to do this only once because you are using the "--global" option. It tells Git to always use this information for anything you do on that system. If you want to override this with a different username or email address for specific projects, you can run the command without the "--global" option when you’re in that project. ## Check your information -* To view the information that you entered, type - +To view the information that you entered, type: ``` git config --global --list ``` -- cgit v1.2.1 From b50bfcc61965b71a66df21964d7d98b50c5f8d19 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 9 Jul 2015 18:35:40 -0400 Subject: Bump coveralls version, remove explicit rest-client dependency --- Gemfile | 12 +++--------- Gemfile.lock | 5 ++--- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index cde8d631ab5..9b7fd18ab19 100644 --- a/Gemfile +++ b/Gemfile @@ -231,19 +231,13 @@ group :development, :test do gem 'fuubar', '~> 2.0.0' gem 'pry-rails' - gem 'coveralls', require: false + gem 'coveralls', '~> 0.8.2', require: false gem 'database_cleaner', '~> 1.4.0' gem 'factory_girl_rails' - gem 'rspec-rails', '~> 3.3.0' - gem 'rubocop', '0.28.0', require: false + gem 'rspec-rails', '~> 3.3.0' + gem 'rubocop', '0.28.0', require: false gem 'spinach-rails' - # rest-client is a coveralls dependency and not used directly in GitLab, but - # we specify a version here to pick up some security fixes. - # See https://github.com/rest-client/rest-client/issues/369 - # and http://www.osvdb.org/show/osvdb/117461 - gem 'rest-client', '~> 1.8.0' - # Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826) gem 'minitest', '~> 5.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 8114063cee0..6e571072a4c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -703,7 +703,7 @@ GEM underscore-rails (1.4.4) unf (0.1.4) unf_ext - unf_ext (0.0.6) + unf_ext (0.0.7.1) unicorn (4.6.3) kgio (~> 2.6) rack @@ -759,7 +759,7 @@ DEPENDENCIES charlock_holmes coffee-rails colored - coveralls + coveralls (~> 0.8.2) creole (~> 0.3.6) d3_rails (~> 3.5.5) database_cleaner (~> 1.4.0) @@ -833,7 +833,6 @@ DEPENDENCIES redis-rails request_store rerun (~> 0.10.0) - rest-client (~> 1.8.0) rqrcode-rails3 rspec-rails (~> 3.3.0) rubocop (= 0.28.0) -- cgit v1.2.1 From 13bf844a1e7884c2fa964704b9d02146086ceb93 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 9 Jul 2015 22:50:05 -0700 Subject: Revert "use relative link to SSH setup page" This reverts commit f876ef6e4db9c5ece17d3bd5c7c8a4e31d9374b3. --- doc/gitlab-basics/create-your-ssh-keys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/gitlab-basics/create-your-ssh-keys.md b/doc/gitlab-basics/create-your-ssh-keys.md index cb699588cac..e1acc2bd65b 100644 --- a/doc/gitlab-basics/create-your-ssh-keys.md +++ b/doc/gitlab-basics/create-your-ssh-keys.md @@ -28,7 +28,7 @@ You need to connect your computer to your GitLab account through SSH Keys. They ## To generate an SSH Key on your commandline -* Go to your [commandline](start-using-git.md) and follow the [instructions](../ssh/README.md) to generate it +* Go to your [commandline](start-using-git.md) and follow the [instructions](https://gitlab.com/help/ssh/README) to generate it * Copy the SSH Key that your commandline created and paste it on the "Key" box on the GitLab page. The title will be added automatically -- cgit v1.2.1 From 198d5c6e06d23f8fd244b16ff5ef6cc763c1bd9e Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 10 Jul 2015 10:56:39 +0000 Subject: Remove intro and link to Dockerhub --- docker/README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docker/README.md b/docker/README.md index 9cd48bf87d4..8df603eca4f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,9 +1,6 @@ # GitLab Docker images -## What is GitLab? - -GitLab offers git repository management, code reviews, issue tracking, activity feeds, wikis. It has LDAP/AD integration, handles 25,000 users on a single server but can also run on a highly available active/active cluster. -Learn more on [https://about.gitlab.com](https://about.gitlab.com) +The GitLab docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ce/). ## After starting a container @@ -165,4 +162,4 @@ sudo docker push gitlab/gitlab-ce:latest ## Troubleshooting -Please see the [troubleshooting](troubleshooting.md) file in this directory. +Please see the [troubleshooting](troubleshooting.md) file in this directory. \ No newline at end of file -- cgit v1.2.1 From 57ec2832875aa976950093479b6a69f4e852807c Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 10 Jul 2015 10:57:39 +0000 Subject: Remove intro and link to Dockerhub --- docker/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 8df603eca4f..0e5eee9955a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,6 +1,9 @@ # GitLab Docker images -The GitLab docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ce/). +## What is GitLab? + +GitLab offers git repository management, code reviews, issue tracking, activity feeds, wikis. It has LDAP/AD integration, handles 25,000 users on a single server but can also run on a highly available active/active cluster. +Learn more on [https://about.gitlab.com](https://about.gitlab.com) ## After starting a container -- cgit v1.2.1 From 14b7a8b886b90afba29fc67a7d28ba7aaf3c0163 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 10 Jul 2015 12:59:25 +0200 Subject: Revert "Remove intro and link to Dockerhub" This reverts commit 57ec2832875aa976950093479b6a69f4e852807c. --- docker/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 0e5eee9955a..8df603eca4f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,9 +1,6 @@ # GitLab Docker images -## What is GitLab? - -GitLab offers git repository management, code reviews, issue tracking, activity feeds, wikis. It has LDAP/AD integration, handles 25,000 users on a single server but can also run on a highly available active/active cluster. -Learn more on [https://about.gitlab.com](https://about.gitlab.com) +The GitLab docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ce/). ## After starting a container -- cgit v1.2.1 From 4dfded8934b9ba04317bf53c2ad1f9bd3a31cc6d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jul 2015 13:07:24 +0200 Subject: Make left menu more hierarchical and less contextual by adding back item at top Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 1 + app/views/layouts/nav/_group.html.haml | 8 ++++++++ app/views/layouts/nav/_profile.html.haml | 8 ++++++++ app/views/layouts/nav/_project.html.haml | 15 +++++++++++++++ features/groups.feature | 4 ++++ features/project/project.feature | 9 +++++++++ features/steps/groups.rb | 4 ++++ features/steps/project/project.rb | 14 ++++++++++++++ 8 files changed, 63 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5daee9830ed..80d0a1f954e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -41,6 +41,7 @@ v 7.13.0 (unreleased) - Allow users to be blocked and unblocked via the API - Use native Postgres database cleaning during backup restore - Redesign project page. Show README as default instead of activity. Move project activity to separate page + - Make left menu more hierarchical and less contextual by adding back item at top v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml index 9d216be151a..691bd12ecab 100644 --- a/app/views/layouts/nav/_group.html.haml +++ b/app/views/layouts/nav/_group.html.haml @@ -1,4 +1,12 @@ %ul.nav.nav-sidebar + = nav_link do + = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'} do + = icon('caret-square-o-left fw') + %span + Back to Dashboard + + %li.separate-item + = nav_link(path: 'groups#show', html_options: {class: 'home'}) do = link_to group_path(@group), title: 'Home', data: {placement: 'right'} do = icon('dashboard fw') diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml index de5544268a1..00d3cb300d4 100644 --- a/app/views/layouts/nav/_profile.html.haml +++ b/app/views/layouts/nav/_profile.html.haml @@ -1,4 +1,12 @@ %ul.nav.nav-sidebar + = nav_link do + = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'} do + = icon('caret-square-o-left fw') + %span + Back to Dashboard + + %li.separate-item + = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = link_to profile_path, title: 'Profile', data: {placement: 'right'} do = icon('user fw') diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 2012478eba9..a92d618284d 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -1,4 +1,19 @@ %ul.nav.nav-sidebar + - if @project.group + = nav_link do + = link_to group_path(@project.group), title: 'Back to group', data: {placement: 'right'} do + = icon('caret-square-o-left fw') + %span + Back to Group + - else + = nav_link do + = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'} do + = icon('caret-square-o-left fw') + %span + Back to Dashboard + + %li.separate-item + = nav_link(path: 'projects#show', html_options: {class: 'home'}) do = link_to project_path(@project), title: 'Project', class: 'shortcuts-project', data: {placement: 'right'} do = icon('home fw') diff --git a/features/groups.feature b/features/groups.feature index 415e43d6ae7..299e846edb0 100644 --- a/features/groups.feature +++ b/features/groups.feature @@ -4,6 +4,10 @@ Feature: Groups And "John Doe" is owner of group "Owned" And "John Doe" is guest of group "Guest" + Scenario: I should have back to group button + When I visit group "Owned" page + Then I should see back to dashboard button + @javascript Scenario: I should see group "Owned" dashboard list When I visit group "Owned" page diff --git a/features/project/project.feature b/features/project/project.feature index 5fb2c67401e..089ffcba14a 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -18,6 +18,15 @@ Feature: Project Then I should see the default project avatar And I should not see the "Remove avatar" button + Scenario: I should have back to group button + And project "Shop" belongs to group + And I visit project "Shop" page + Then I should see back to group button + + Scenario: I should have back to group button + And I visit project "Shop" page + Then I should see back to dashboard button + Scenario: I should have readme on page And I visit project "Shop" page Then I should see project "Shop" README diff --git a/features/steps/groups.rb b/features/steps/groups.rb index 2812c5473e9..46e1f4d0990 100644 --- a/features/steps/groups.rb +++ b/features/steps/groups.rb @@ -5,6 +5,10 @@ class Spinach::Features::Groups < Spinach::FeatureSteps include SharedUser include Select2Helper + step 'I should see back to dashboard button' do + expect(page).to have_content 'Back to Dashboard' + end + step 'gitlab user "Mike"' do create(:user, name: "Mike") end diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index e8f9a80737f..0404fd5e594 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -116,4 +116,18 @@ class Spinach::Features::Project < Spinach::FeatureSteps step 'I should not see "Snippets" button' do expect(page).not_to have_link 'Snippets' end + + step 'project "Shop" belongs to group' do + group = create(:group) + @project.namespace = group + @project.save! + end + + step 'I should see back to dashboard button' do + expect(page).to have_content 'Back to Dashboard' + end + + step 'I should see back to group button' do + expect(page).to have_content 'Back to Group' + end end -- cgit v1.2.1 From e4a1d29077bcd6165ffde8889c4822d2d1d02e9f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jul 2015 13:29:08 +0200 Subject: Better name for group tab Signed-off-by: Dmitriy Zaporozhets --- app/views/layouts/nav/_group.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml index 691bd12ecab..fc74d0205c6 100644 --- a/app/views/layouts/nav/_group.html.haml +++ b/app/views/layouts/nav/_group.html.haml @@ -11,7 +11,7 @@ = link_to group_path(@group), title: 'Home', data: {placement: 'right'} do = icon('dashboard fw') %span - Activity + Group - if current_user = nav_link(controller: [:group, :milestones]) do = link_to group_milestones_path(@group), title: 'Milestones', data: {placement: 'right'} do -- cgit v1.2.1 From 3e97051bcebc6e7e902ab664acbce121a3c8f619 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jul 2015 13:33:08 +0200 Subject: Fix missing avatar in event feed when created project Signed-off-by: Dmitriy Zaporozhets --- app/views/events/_event.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index b2e5d11279b..b8409f64665 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -5,6 +5,7 @@ - if event.created_project? = cache [event, current_user] do + = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' = render "events/event/created_project", event: event - else = cache event do -- cgit v1.2.1 From 37cdffd98b6845af39bd6ce05c3c4bf40976c479 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jul 2015 14:27:12 +0200 Subject: Make edit/remove label buttons smaller Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/labels/_label.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/projects/labels/_label.html.haml b/app/views/projects/labels/_label.html.haml index 7fa1ee53f76..c6ebfa281a1 100644 --- a/app/views/projects/labels/_label.html.haml +++ b/app/views/projects/labels/_label.html.haml @@ -6,5 +6,5 @@ = pluralize label.open_issues_count, 'open issue' - if can? current_user, :admin_label, @project - = link_to 'Edit', edit_namespace_project_label_path(@project.namespace, @project, label), class: 'btn' - = link_to 'Remove', namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"} + = link_to 'Edit', edit_namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm' + = link_to 'Remove', namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"} -- cgit v1.2.1 From 8902253e0d259177a19d74ff47e12bcbdab67145 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jul 2015 15:33:10 +0200 Subject: Smaller font and leing height for sidebar elements Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/sidebar.scss | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss index 00e0534b81e..cb8ecba8dee 100644 --- a/app/assets/stylesheets/generic/sidebar.scss +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -39,12 +39,12 @@ } a { + padding: 7px 15px; + font-size: 13px; + line-height: 18px; color: $gray; display: block; text-decoration: none; - padding: 8px 15px; - font-size: 14px; - line-height: 20px; padding-left: 16px; &:hover { @@ -114,9 +114,6 @@ width: $sidebar_collapsed_width; li a { - font-size: 14px; - padding: 8px 15px; - text-align: left; padding-left: 16px; } } -- cgit v1.2.1 From 414cacd7f47c8c89a6a270928bbf9c8d8dcbd3ab Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 9 Jul 2015 13:21:37 -0400 Subject: api: expose work_in_progress flag --- doc/api/merge_requests.md | 7 +++++-- lib/api/entities.rb | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 7b0873a9111..24c0b461308 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -49,7 +49,8 @@ Parameters: "state": "active", "created_at": "2012-04-29T08:46:00Z" }, - "description":"fixed login page css paddings" + "description":"fixed login page css paddings", + "work_in_progress": false } ] ``` @@ -94,7 +95,8 @@ Parameters: "state": "active", "created_at": "2012-04-29T08:46:00Z" }, - "description":"fixed login page css paddings" + "description":"fixed login page css paddings", + "work_in_progress": false } ``` @@ -118,6 +120,7 @@ Parameters: "project_id": 4, "title": "Blanditiis beatae suscipit hic assumenda et molestias nisi asperiores repellat et.", "description": "Qui voluptatibus placeat ipsa alias quasi. Deleniti rem ut sint. Optio velit qui distinctio.", + "work_in_progress": false, "state": "reopened", "created_at": "2015-02-02T19:49:39.159Z", "updated_at": "2015-02-02T20:08:49.959Z", diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 31202fa8c1f..ecf1412dee5 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -171,6 +171,7 @@ module API expose :source_project_id, :target_project_id expose :label_names, as: :labels expose :description + expose :work_in_progress?, as: :work_in_progress expose :milestone, using: Entities::Milestone end -- cgit v1.2.1 From f6609c9882c1d85b7f31072e6341fe5c91b37b41 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jul 2015 17:50:50 +0200 Subject: Implement search of code via git grep Signed-off-by: Dmitriy Zaporozhets --- app/models/repository.rb | 34 ++++++++++++++++++++++++++++++++ app/views/search/results/_blob.html.haml | 1 + 2 files changed, 35 insertions(+) diff --git a/app/models/repository.rb b/app/models/repository.rb index c767d1051d1..a7b990b1ba5 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -431,6 +431,40 @@ class Repository end end + def search_files(query, ref) + offset = 2 + args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref}) + Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/) + end + + def search_to_blob(result) + ref = nil + filename = nil + startline = 0 + + lines = result.lstrip.lines + lines.each_with_index do |line, index| + if line =~ /^.*:.*:\d+:/ + ref, filename, startline = line.split(':') + startline = startline.to_i - index + break + end + end + + data = lines.map do |line| + line.sub(ref, '').sub(filename, '').sub(/^:-\d+-/, '').sub(/^::\d+:/, '') + end + + data = data.join("") + + OpenStruct.new( + filename: filename, + ref: ref, + startline: startline, + data: data + ) + end + private def cache diff --git a/app/views/search/results/_blob.html.haml b/app/views/search/results/_blob.html.haml index 84e9be82c44..9be13207070 100644 --- a/app/views/search/results/_blob.html.haml +++ b/app/views/search/results/_blob.html.haml @@ -1,3 +1,4 @@ +- blob = @project.repository.search_to_blob(blob) .blob-result .file-holder .file-title -- cgit v1.2.1 From 18f6cf33efc0dd479a2d54ddaaf3794b56e22bd1 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 10 Jul 2015 09:20:24 -0700 Subject: Fix migrating from SVN document link Closes #1959 --- app/views/projects/new.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 5114e63c05f..d49eacb30dd 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -85,7 +85,7 @@ %li The import will time out after 4 minutes. For big repositories, use a clone/push combination. %li - To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/migrating_from_svn.html"}. + To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/importing/migrating_from_svn.html"}. %hr.prepend-botton-10 -- cgit v1.2.1 From aa33189c09c5f096db5cb59bfa23741cb148f46e Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 10 Jul 2015 16:32:09 +0000 Subject: Update image to latest one --- docker/marathon.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/marathon.json b/docker/marathon.json index d23c2b84e0e..473417510ed 100644 --- a/docker/marathon.json +++ b/docker/marathon.json @@ -8,7 +8,7 @@ "type": "DOCKER", "docker": { "network": "HOST", - "image": "sytse/gitlab-ce:7.10.1" + "image": "gitlab/gitlab-ce:latest" } } } \ No newline at end of file -- cgit v1.2.1 From 1ea0db475f399c3d1a841bbcfe8e19518e88506f Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 10 Jul 2015 18:43:32 +0200 Subject: Add volumes to marathon file. --- docker/marathon.json | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docker/marathon.json b/docker/marathon.json index d23c2b84e0e..2f3bb6f17b4 100644 --- a/docker/marathon.json +++ b/docker/marathon.json @@ -9,6 +9,23 @@ "docker": { "network": "HOST", "image": "sytse/gitlab-ce:7.10.1" - } + }, + "volumes": [ + { + "containerPath": "/etc/gitlab", + "hostPath": "/var/data/etc/gitlab", + "mode": "RW" + }, + { + "containerPath": "/var/opt/gitlab", + "hostPath": "/var/data/opt/gitlab", + "mode": "RW" + }, + { + "containerPath": "/var/log/gitlab", + "hostPath": "/var/data/log/gitlab", + "mode": "RW" + } + ] } } \ No newline at end of file -- cgit v1.2.1 From 1ea2dfa5de7930ddc9602ed376d2c557077f45e6 Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt Date: Fri, 10 Jul 2015 19:46:40 +0200 Subject: Do not add the same icon multiple times to dropzones Some DOM queries were to broad which caused paperclip icons and spinners to be added multiple times to a dropzone in case of multiple dropzones on a page. --- app/assets/javascripts/dropzone_input.js.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/dropzone_input.js.coffee b/app/assets/javascripts/dropzone_input.js.coffee index a7476146010..a4f511301c1 100644 --- a/app/assets/javascripts/dropzone_input.js.coffee +++ b/app/assets/javascripts/dropzone_input.js.coffee @@ -25,10 +25,10 @@ class @DropzoneInput form_dropzone = $(form).find('.div-dropzone') form_dropzone.parent().addClass "div-dropzone-wrapper" form_dropzone.append divHover - $(".div-dropzone-hover").append iconPaperclip + form_dropzone.find(".div-dropzone-hover").append iconPaperclip form_dropzone.append divSpinner - $(".div-dropzone-spinner").append iconSpinner - $(".div-dropzone-spinner").css + form_dropzone.find(".div-dropzone-spinner").append iconSpinner + form_dropzone.find(".div-dropzone-spinner").css "opacity": 0 "display": "none" -- cgit v1.2.1 From 353dc1e83e14b02d9644dc52bd435b746920c27e Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 10 Jul 2015 14:03:56 -0400 Subject: Update background color for touch-icon-* images --- app/assets/images/touch-icon-ipad-retina.png | Bin 6959 -> 8130 bytes app/assets/images/touch-icon-ipad.png | Bin 3615 -> 3493 bytes app/assets/images/touch-icon-iphone-retina.png | Bin 5145 -> 4997 bytes app/assets/images/touch-icon-iphone.png | Bin 2827 -> 2766 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/touch-icon-ipad-retina.png b/app/assets/images/touch-icon-ipad-retina.png index eb8a3f09f37..feb32b48ec9 100644 Binary files a/app/assets/images/touch-icon-ipad-retina.png and b/app/assets/images/touch-icon-ipad-retina.png differ diff --git a/app/assets/images/touch-icon-ipad.png b/app/assets/images/touch-icon-ipad.png index d0e191ea75d..a6ddc543509 100644 Binary files a/app/assets/images/touch-icon-ipad.png and b/app/assets/images/touch-icon-ipad.png differ diff --git a/app/assets/images/touch-icon-iphone-retina.png b/app/assets/images/touch-icon-iphone-retina.png index 482763186df..8bf7ccb7534 100644 Binary files a/app/assets/images/touch-icon-iphone-retina.png and b/app/assets/images/touch-icon-iphone-retina.png differ diff --git a/app/assets/images/touch-icon-iphone.png b/app/assets/images/touch-icon-iphone.png index cf4cc583022..87da550f8be 100644 Binary files a/app/assets/images/touch-icon-iphone.png and b/app/assets/images/touch-icon-iphone.png differ -- cgit v1.2.1 From 5431368ad1c918b5e246a4b174f0c3b8d3713c67 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 10 Jul 2015 14:04:56 -0400 Subject: Update msapplication-TileColor value --- app/views/layouts/_head.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index a43b6d57c9c..54cddc30b74 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -28,7 +28,7 @@ -# Windows 8 pinned site tile %meta{name: 'msapplication-TileImage', content: image_url('msapplication-tile.png')} - %meta{name: 'msapplication-TileColor', content: '#554488'} + %meta{name: 'msapplication-TileColor', content: '#30353E'} = yield :meta_tags -- cgit v1.2.1 From f110bb2db22edf7d6bcf31ac7abe5c80982ccd32 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Fri, 10 Jul 2015 12:33:31 -0700 Subject: information about why we use fig.yml --- docker/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker/README.md b/docker/README.md index 8df603eca4f..293ca79f915 100644 --- a/docker/README.md +++ b/docker/README.md @@ -94,12 +94,12 @@ To upgrade GitLab to new version you have to do: sudo docker stop gitlab ``` -1. stop running container, +1. stop running container, ```bash sudo docker rm gitlab ``` -1. remove existing container, +1. remove existing container, ```bash sudo docker pull gitlab/gitlab-ce:latest ``` @@ -162,4 +162,6 @@ sudo docker push gitlab/gitlab-ce:latest ## Troubleshooting -Please see the [troubleshooting](troubleshooting.md) file in this directory. \ No newline at end of file +Please see the [troubleshooting](troubleshooting.md) file in this directory. + +Note: We use `fig.yml` to have compatibility with fig and because docker-compose also supports it. -- cgit v1.2.1 From 903daedb5a963d55f8b2e836127958f92a1562a5 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Fri, 10 Jul 2015 12:54:02 -0700 Subject: added link to issue closing pattern in doc --- doc/api/milestones.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/api/milestones.md b/doc/api/milestones.md index a6828728264..cba4a7c484c 100644 --- a/doc/api/milestones.md +++ b/doc/api/milestones.md @@ -87,3 +87,5 @@ Parameters: - `id` (required) - The ID of a project - `milestone_id` (required) - The ID of a project milestone + +You can close multiple issues with one Merge Request by following the [issue closing pattern documentation](http://doc.gitlab.com/ce/customization/issue_closing.html). -- cgit v1.2.1 From 22724418d350001e2683b68fad65186af783d3f2 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 10 Jul 2015 16:08:39 -0400 Subject: Add User#disable_two_factor! This method encapsulates all the logic for disabling 2FA on a specific User model. --- .../profiles/two_factor_auths_controller.rb | 8 +------- app/models/user.rb | 10 ++++++++++ .../profiles/two_factor_auths_controller_spec.rb | 13 +++---------- spec/factories.rb | 1 + spec/models/user_spec.rb | 18 ++++++++++++++++++ 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb index 03845f1e1ec..f9af0871cf1 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/profiles/two_factor_auths_controller.rb @@ -29,13 +29,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController end def destroy - current_user.update_attributes({ - two_factor_enabled: false, - encrypted_otp_secret: nil, - encrypted_otp_secret_iv: nil, - encrypted_otp_secret_salt: nil, - otp_backup_codes: nil - }) + current_user.disable_two_factor! redirect_to profile_account_path end diff --git a/app/models/user.rb b/app/models/user.rb index dc84f5141d8..317257a2500 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -322,6 +322,16 @@ class User < ActiveRecord::Base @reset_token end + def disable_two_factor! + update_attributes( + two_factor_enabled: false, + encrypted_otp_secret: nil, + encrypted_otp_secret_iv: nil, + encrypted_otp_secret_salt: nil, + otp_backup_codes: nil + ) + end + def namespace_uniq namespace_name = self.username existing_namespace = Namespace.by_path(namespace_name) diff --git a/spec/controllers/profiles/two_factor_auths_controller_spec.rb b/spec/controllers/profiles/two_factor_auths_controller_spec.rb index aa09f1a758d..f54706e3aa3 100644 --- a/spec/controllers/profiles/two_factor_auths_controller_spec.rb +++ b/spec/controllers/profiles/two_factor_auths_controller_spec.rb @@ -105,19 +105,12 @@ describe Profiles::TwoFactorAuthsController do end describe 'DELETE destroy' do - let(:user) { create(:user, :two_factor) } - let!(:codes) { user.generate_otp_backup_codes! } + let(:user) { create(:user, :two_factor) } - it 'clears all 2FA-related fields' do - expect(user).to be_two_factor_enabled - expect(user.otp_backup_codes).not_to be_nil - expect(user.encrypted_otp_secret).not_to be_nil + it 'disables two factor' do + expect(user).to receive(:disable_two_factor!) delete :destroy - - expect(user).not_to be_two_factor_enabled - expect(user.otp_backup_codes).to be_nil - expect(user.encrypted_otp_secret).to be_nil end it 'redirects to profile_account_path' do diff --git a/spec/factories.rb b/spec/factories.rb index 578a2e4dc69..05e3211d551 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -32,6 +32,7 @@ FactoryGirl.define do before(:create) do |user| user.two_factor_enabled = true user.otp_secret = User.generate_otp_secret(32) + user.generate_otp_backup_codes! end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6d2423ae27a..16902317f10 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -217,6 +217,24 @@ describe User do end end + describe '#disable_two_factor!' do + it 'clears all 2FA-related fields' do + user = create(:user, :two_factor) + + expect(user).to be_two_factor_enabled + expect(user.encrypted_otp_secret).not_to be_nil + expect(user.otp_backup_codes).not_to be_nil + + user.disable_two_factor! + + expect(user).not_to be_two_factor_enabled + expect(user.encrypted_otp_secret).to be_nil + expect(user.encrypted_otp_secret_iv).to be_nil + expect(user.encrypted_otp_secret_salt).to be_nil + expect(user.otp_backup_codes).to be_nil + end + end + describe 'projects' do before do @user = create :user -- cgit v1.2.1 From 4e4ab4893d4ee379f2f49459c0ec56f96cf4b6b7 Mon Sep 17 00:00:00 2001 From: Darby Date: Fri, 10 Jul 2015 13:41:52 -0700 Subject: Changed to using the btn class --- app/assets/stylesheets/pages/admin.scss | 13 ------------- app/helpers/application_settings_helper.rb | 2 +- app/views/admin/application_settings/_form.html.haml | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/pages/admin.scss b/app/assets/stylesheets/pages/admin.scss index 12372719a35..144852e7874 100644 --- a/app/assets/stylesheets/pages/admin.scss +++ b/app/assets/stylesheets/pages/admin.scss @@ -61,16 +61,3 @@ @extend .broadcast-message; margin-bottom: 20px; } - -.btn-visibility { - .btn-primary { - color: black; - background-color: white; - border-color: black; - } - .btn-primary.active { - color: black; - background-color: #d3d3d3; - border-color: black; - } -} diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 63c3ff5674d..61d14383945 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -28,7 +28,7 @@ module ApplicationSettingsHelper def restricted_level_checkboxes(help_block_id) Gitlab::VisibilityLevel.options.map do |name, level| checked = restricted_visibility_levels(true).include?(level) - css_class = 'btn btn-primary' + css_class = 'btn' css_class += ' active' if checked checkbox_name = 'application_setting[restricted_visibility_levels][]' diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index 8ce0b3cd207..6bef33c6d7a 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -23,7 +23,7 @@ = f.label :restricted_visibility_levels, class: 'control-label col-sm-2' .col-sm-10 - data_attrs = { toggle: 'buttons' } - .btn-group.btn-visibility{ data: data_attrs } + .btn-group{ data: data_attrs } - restricted_level_checkboxes('restricted-visibility-help').each do |level| = level %span.help-block#restricted-visibility-help Selected levels cannot be used by non-admin users for projects or snippets -- cgit v1.2.1 From 800df45db2dd9f3baf8377896ecde8a917901fe6 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 10 Jul 2015 17:11:18 -0400 Subject: Add disable_two_factor route for Admin::Users --- app/controllers/admin/users_controller.rb | 6 ++++++ config/routes.rb | 1 + spec/controllers/admin/users_controller_spec.rb | 28 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 7a683098df3..770fe00af51 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -55,6 +55,12 @@ class Admin::UsersController < Admin::ApplicationController end end + def disable_two_factor + user.disable_two_factor! + redirect_to admin_user_path(user), + notice: 'Two-factor Authentication has been disabled for this user' + end + def create opts = { force_random_password: true, diff --git a/config/routes.rb b/config/routes.rb index fd04d7b2f54..055d59a0c93 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -159,6 +159,7 @@ Gitlab::Application.routes.draw do put :block put :unblock put :unlock + patch :disable_two_factor delete 'remove/:email_id', action: 'remove_email', as: 'remove_email' end end diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index 550a91a79e2..6f4c8987637 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -36,4 +36,32 @@ describe Admin::UsersController do expect(user.access_locked?).to be_falsey end end + + describe 'PATCH disable_two_factor' do + let(:user) { create(:user) } + + it 'disables 2FA for the user' do + expect(user).to receive(:disable_two_factor!) + allow(subject).to receive(:user).and_return(user) + + go + end + + it 'redirects back' do + go + + expect(response).to redirect_to(admin_user_path(user)) + end + + it 'displays an alert' do + go + + expect(flash[:notice]). + to eq 'Two-factor Authentication has been disabled for this user' + end + + def go + patch :disable_two_factor, id: user.to_param + end + end end -- cgit v1.2.1 From db8f4c06060d002c63b20ff51871976aaf9c9d4c Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 10 Jul 2015 17:11:39 -0400 Subject: Add a button to Admin::Users#show to disable 2FA for that user --- CHANGELOG | 1 + app/views/admin/users/show.html.haml | 1 + .../admin/admin_disables_two_factor_spec.rb | 33 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 spec/features/admin/admin_disables_two_factor_spec.rb diff --git a/CHANGELOG b/CHANGELOG index a964a192216..a63d90a8f91 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,7 @@ v 7.13.0 (unreleased) - Redesign project page. Show README as default instead of activity. Move project activity to separate page - Make left menu more hierarchical and less contextual by adding back item at top - A fork can’t have a visibility level that is greater than the original project. + - Allow administrators to disable 2FA for a specific user v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index 8c6b8e851c4..33730ff05df 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -43,6 +43,7 @@ %strong{class: @user.two_factor_enabled? ? 'cgreen' : 'cred'} - if @user.two_factor_enabled? Enabled + = link_to 'Disable', disable_two_factor_admin_user_path(@user), data: {confirm: 'Are you sure?'}, method: :patch, class: 'btn btn-xs btn-remove pull-right', title: 'Disable Two-factor Authentication' - else Disabled diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb new file mode 100644 index 00000000000..71be66303d2 --- /dev/null +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -0,0 +1,33 @@ +require 'rails_helper' + +feature 'Admin disables 2FA for a user', feature: true do + scenario 'successfully', js: true do + login_as(:admin) + user = create(:user, :two_factor) + + edit_user(user) + page.within('.two-factor-status') do + click_link 'Disable' + end + + page.within('.two-factor-status') do + expect(page).to have_content 'Disabled' + expect(page).not_to have_button 'Disable' + end + end + + scenario 'for a user without 2FA enabled' do + login_as(:admin) + user = create(:user) + + edit_user(user) + + page.within('.two-factor-status') do + expect(page).not_to have_button 'Disable' + end + end + + def edit_user(user) + visit admin_user_path(user) + end +end -- cgit v1.2.1 From 10e8fd46b1b6b91adb253c08dba4eb53fb2a6f6d Mon Sep 17 00:00:00 2001 From: karen Carias Date: Fri, 10 Jul 2015 16:09:52 -0700 Subject: fixed info in doc --- doc/gitlab-basics/create-branch.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/gitlab-basics/create-branch.md b/doc/gitlab-basics/create-branch.md index ea37bc377ed..b0a26176b31 100644 --- a/doc/gitlab-basics/create-branch.md +++ b/doc/gitlab-basics/create-branch.md @@ -1,10 +1,11 @@ # How to create a branch -To add changes to your project in GitLab, you should create a branch. +A branch is an independent line of development. +New commits are recorded in the history for the current branch, which results in taking the source from someone’s repository (the place where the history of your work is stored) at certain point in time, and apply your own changes to it in the history of the project. -To create a new branch, sign in to [gitlab.com](https://gitlab.com). +To add changes to your GitLab project, you should create a branch. You can do it in your shell or in [GitLab.com](https://gitlab.com). -Select a project on the right side of your screen: +To create a new branch in [GitLab.com](https://gitlab.com), sign in and then select a project on the right side of your screen: ![Select a project](basicsimages/select_project.png) @@ -24,7 +25,7 @@ Fill out the information required: 1. Add a name for your new branch (you can't add spaces, so you can use hyphens or underscores) -1. On the "create from" space, add the word: master or the name of the master branch +1. On the "create from" space, add the the name of the branch you want to branch off from 1. Click on the button "create branch" -- cgit v1.2.1 From 0b67d7a0fe79c05681c6e541105350d94fff6931 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 10 Jul 2015 17:36:24 -0700 Subject: Fix user autocomplete for unauthenticated users accessing public projects Closes #1955 --- CHANGELOG | 1 + app/controllers/autocomplete_controller.rb | 6 +++++- spec/controllers/autocomplete_controller_spec.rb | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 5daee9830ed..8524862da5a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.13.0 (unreleased) + - Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu) - Fix redirection to home page URL for unauthorized users (Daniel Gerhardt) - Add branch switching support for graphs (Daniel Gerhardt) - Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt) diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index 11af9895261..8b12643bb97 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -1,4 +1,6 @@ class AutocompleteController < ApplicationController + skip_before_action :authenticate_user!, only: [:users] + def users @users = if params[:project_id].present? @@ -13,8 +15,10 @@ class AutocompleteController < ApplicationController if can?(current_user, :read_group, group) group.users end - else + elsif current_user User.all + else + User.none end @users = @users.search(params[:search]) if params[:search].present? diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index 9ad9cb41cc1..9be8d0333ad 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -48,4 +48,28 @@ describe AutocompleteController do it { expect(body).to be_kind_of(Array) } it { expect(body.size).to eq User.count } end + + context 'unauthenticated user' do + let(:project) { create(:project, :public) } + let(:body) { JSON.parse(response.body) } + + describe 'GET #users with public project' do + before do + project.team << [user, :guest] + get(:users, project_id: project.id) + end + + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq 1 } + end + + describe 'GET #users with no project' do + before do + get(:users) + end + + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq 0 } + end + end end -- cgit v1.2.1 From 96644c1fc146b55795d36cf4c03a80d2d58d112e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 11 Jul 2015 06:16:59 -0700 Subject: Better handle unknown projects and groups for autocomplete --- app/controllers/autocomplete_controller.rb | 37 ++++++----- spec/controllers/autocomplete_controller_spec.rb | 78 +++++++++++++++++++----- 2 files changed, 86 insertions(+), 29 deletions(-) diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index 8b12643bb97..52e9c58b47c 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -2,25 +2,34 @@ class AutocompleteController < ApplicationController skip_before_action :authenticate_user!, only: [:users] def users - @users = - if params[:project_id].present? - project = Project.find(params[:project_id]) + begin + @users = + if params[:project_id].present? + project = Project.find(params[:project_id]) - if can?(current_user, :read_project, project) - project.team.users - end - elsif params[:group_id] - group = Group.find(params[:group_id]) + if can?(current_user, :read_project, project) + project.team.users + end + elsif params[:group_id] + group = Group.find(params[:group_id]) - if can?(current_user, :read_group, group) - group.users + if can?(current_user, :read_group, group) + group.users + end + elsif current_user + User.all end - elsif current_user - User.all - else - User.none + rescue ActiveRecord::RecordNotFound + if current_user + return render json: {}, status: 404 end + end + + if @users.nil? && current_user.nil? + authenticate_user! + end + @users ||= User.none @users = @users.search(params[:search]) if params[:search].present? @users = @users.active @users = @users.page(params[:page]).per(PER_PAGE) diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index 9be8d0333ad..1230017c270 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -9,15 +9,27 @@ describe AutocompleteController do before do sign_in(user) project.team << [user, :master] - - get(:users, project_id: project.id) end let(:body) { JSON.parse(response.body) } - it { expect(body).to be_kind_of(Array) } - it { expect(body.size).to eq 1 } - it { expect(body.first["username"]).to eq user.username } + describe 'GET #users with project ID' do + before do + get(:users, project_id: project.id) + end + + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq 1 } + it { expect(body.first["username"]).to eq user.username } + end + + describe 'GET #users with unknown project' do + before do + get(:users, project_id: 'unknown') + end + + it { expect(response.status).to eq(404) } + end end context 'group members' do @@ -26,15 +38,27 @@ describe AutocompleteController do before do sign_in(user) group.add_owner(user) - - get(:users, group_id: group.id) end let(:body) { JSON.parse(response.body) } - it { expect(body).to be_kind_of(Array) } - it { expect(body.size).to eq 1 } - it { expect(body.first["username"]).to eq user.username } + describe 'GET #users with group ID' do + before do + get(:users, group_id: group.id) + end + + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq 1 } + it { expect(body.first["username"]).to eq user.username } + end + + describe 'GET #users with unknown group ID' do + before do + get(:users, group_id: 'unknown') + end + + it { expect(response.status).to eq(404) } + end end context 'all users' do @@ -50,26 +74,50 @@ describe AutocompleteController do end context 'unauthenticated user' do - let(:project) { create(:project, :public) } + let(:public_project) { create(:project, :public) } let(:body) { JSON.parse(response.body) } describe 'GET #users with public project' do before do - project.team << [user, :guest] - get(:users, project_id: project.id) + public_project.team << [user, :guest] + get(:users, project_id: public_project.id) end it { expect(body).to be_kind_of(Array) } it { expect(body.size).to eq 1 } end + describe 'GET #users with project' do + before do + get(:users, project_id: project.id) + end + + it { expect(response.status).to eq(302) } + end + + describe 'GET #users with unknown project' do + before do + get(:users, project_id: 'unknown') + end + + it { expect(response.status).to eq(302) } + end + + describe 'GET #users with inaccessible group' do + before do + project.team << [user, :guest] + get(:users, group_id: user.namespace.id) + end + + it { expect(response.status).to eq(302) } + end + describe 'GET #users with no project' do before do get(:users) end - it { expect(body).to be_kind_of(Array) } - it { expect(body.size).to eq 0 } + it { expect(response.status).to eq(302) } end end end -- cgit v1.2.1 From e9df1cd363837ec8ca06d99b85292bb32b28aa29 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 11 Jul 2015 10:20:47 -0700 Subject: Fix typo and remove duplicate entry shipped in v7.12.2 --- CHANGELOG | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7d5f186d755..56f6a48cc51 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,12 +8,11 @@ v 7.13.0 (unreleased) - Remove link leading to a 404 error in Deploy Keys page (Stan Hu) - Add support for unlocking users in admin settings (Stan Hu) - Add Irker service configuration options (Stan Hu) - - Fix order of issues imported form GitHub (Hiroyuki Sato) + - Fix order of issues imported from GitHub (Hiroyuki Sato) - Bump rugments to 1.0.0beta8 to fix C prototype function highlighting (Jonathon Reinhart) - Fix Merge Request webhook to properly fire "merge" action when accepted from the web UI - Add `two_factor_enabled` field to admin user API (Stan Hu) - Fix invalid timestamps in RSS feeds (Rowan Wookey) - - Fix error when deleting a user who has projects (Stan Hu) - Fix downloading of patches on public merge requests when user logged out (Stan Hu) - The password for the default administrator (root) account has been changed from "5iveL!fe" to "password". - Fix Error 500 when relative submodule resolves to a namespace that has a different name from its path (Stan Hu) -- cgit v1.2.1 From 562d78a65a5d6d9ebd593b0fe20d1cbc187bc570 Mon Sep 17 00:00:00 2001 From: Nikita Verkhovin Date: Sun, 12 Jul 2015 00:18:56 +0600 Subject: Add error message for SSH key linebreaks --- CHANGELOG | 1 + app/models/key.rb | 1 + spec/models/key_spec.rb | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 56f6a48cc51..7fc52d175f1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,7 @@ v 7.13.0 (unreleased) - Redesign project page. Show README as default instead of activity. Move project activity to separate page - Make left menu more hierarchical and less contextual by adding back item at top - A fork can’t have a visibility level that is greater than the original project. + - Add error message for SSH key linebreaks v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. diff --git a/app/models/key.rb b/app/models/key.rb index bbc28678177..2dcae059c0e 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -24,6 +24,7 @@ class Key < ActiveRecord::Base validates :title, presence: true, length: { within: 0..255 } validates :key, presence: true, length: { within: 0..5000 }, format: { with: /\A(ssh|ecdsa)-.*\Z/ }, uniqueness: true + validates :key, format: { without: /\n|\r/, message: 'should be a single line' } validates :fingerprint, uniqueness: true, presence: { message: 'cannot be generated' } delegate :name, :email, to: :user, prefix: true diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index fbb9e162952..456bf221d62 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -63,7 +63,7 @@ describe Key do key = build(:key) # Not always the middle, but close enough - key.key = key.key[0..100] + ' ' + key.key[100..-1] + key.key = key.key[0..100] + ' ' + key.key[101..-1] expect(key).not_to be_valid end @@ -71,6 +71,12 @@ describe Key do it 'rejects the unfingerprintable key (not a key)' do expect(build(:key, key: 'ssh-rsa an-invalid-key==')).not_to be_valid end + + it 'rejects the multiple line key' do + key = build(:key) + key.key.gsub!(' ', "\n") + expect(key).not_to be_valid + end end context 'callbacks' do -- cgit v1.2.1 From b93053695a94822801a87ff2b1850999130842c1 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 2 Jul 2015 14:31:25 +0200 Subject: Fix transferring of project to another group using the API. --- CHANGELOG | 1 + app/controllers/admin/projects_controller.rb | 3 ++- app/controllers/projects_controller.rb | 9 +++++---- app/services/projects/transfer_service.rb | 13 +++++-------- lib/api/groups.rb | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 56f6a48cc51..6496fea2efb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -48,6 +48,7 @@ v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. - Faster automerge check and merge itself when source and target branches are in same repository - Audit log for user authentication + - Fix transferring of project to another group using the API. v 7.12.1 - Fix error when deleting a user who has projects (Stan Hu) diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index f616ccf5684..da5f5bb83fa 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -23,7 +23,8 @@ class Admin::ProjectsController < Admin::ApplicationController end def transfer - ::Projects::TransferService.new(@project, current_user, params.dup).execute + namespace = Namespace.find_by(id: params[:new_namespace_id]) + ::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace) @project.reload redirect_to admin_namespace_project_path(@project.namespace, @project) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5474f9e97a6..b191819a117 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -52,10 +52,11 @@ class ProjectsController < ApplicationController end def transfer - transfer_params = params.permit(:new_namespace_id) - ::Projects::TransferService.new(project, current_user, transfer_params).execute - if @project.errors[:namespace_id].present? - flash[:alert] = @project.errors[:namespace_id].first + namespace = Namespace.find_by(id: params[:new_namespace_id]) + ::Projects::TransferService.new(project, current_user).execute(namespace) + + if @project.errors[:new_namespace].present? + flash[:alert] = @project.errors[:new_namespace].first end end diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 489e03bd5ef..f43c0ef70e9 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -11,19 +11,16 @@ module Projects include Gitlab::ShellAdapter class TransferError < StandardError; end - def execute - namespace_id = params[:new_namespace_id] - namespace = Namespace.find_by(id: namespace_id) - - if allowed_transfer?(current_user, project, namespace) - transfer(project, namespace) + def execute(new_namespace) + if allowed_transfer?(current_user, project, new_namespace) + transfer(project, new_namespace) else - project.errors.add(:namespace, 'is invalid') + project.errors.add(:new_namespace, 'is invalid') false end rescue Projects::TransferService::TransferError => ex project.reload - project.errors.add(:namespace_id, ex.message) + project.errors.add(:new_namespace, ex.message) false end diff --git a/lib/api/groups.rb b/lib/api/groups.rb index e88b6e31775..024aeec2e14 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -74,9 +74,9 @@ module API # POST /groups/:id/projects/:project_id post ":id/projects/:project_id" do authenticated_as_admin! - group = Group.find(params[:id]) + group = Group.find_by(id: params[:id]) project = Project.find(params[:project_id]) - result = ::Projects::TransferService.new(project, current_user, namespace_id: group.id).execute + result = ::Projects::TransferService.new(project, current_user).execute(group) if result present group -- cgit v1.2.1 From 29cbb2f0782a97c793bf8fdada4162ac47ad0ca6 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 2 Jul 2015 16:47:15 +0200 Subject: Update specs. --- spec/services/projects/transfer_service_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 79acba78bda..bb7da33b12e 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -8,7 +8,7 @@ describe Projects::TransferService do context 'namespace -> namespace' do before do group.add_owner(user) - @result = transfer_project(project, user, new_namespace_id: group.id) + @result = transfer_project(project, user, group) end it { expect(@result).to be_truthy } @@ -17,7 +17,7 @@ describe Projects::TransferService do context 'namespace -> no namespace' do before do - @result = transfer_project(project, user, new_namespace_id: nil) + @result = transfer_project(project, user, nil) end it { expect(@result).to eq false } @@ -26,14 +26,14 @@ describe Projects::TransferService do context 'namespace -> not allowed namespace' do before do - @result = transfer_project(project, user, new_namespace_id: group.id) + @result = transfer_project(project, user, group) end it { expect(@result).to eq false } it { expect(project.namespace).to eq(user.namespace) } end - def transfer_project(project, user, params) - Projects::TransferService.new(project, user, params).execute + def transfer_project(project, user, new_namespace) + Projects::TransferService.new(project, user).execute(new_namespace) end end -- cgit v1.2.1 From 9ab12e099d10925c1e97d441cb7a3f8f9af31bd2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 12 Jul 2015 14:01:06 +0200 Subject: Fix search blobs for wiki Signed-off-by: Dmitriy Zaporozhets --- app/models/repository.rb | 2 +- app/views/search/results/_blob.html.haml | 2 +- app/views/search/results/_wiki_blob.html.haml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index a7b990b1ba5..8a9213f659c 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -437,7 +437,7 @@ class Repository Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/) end - def search_to_blob(result) + def parse_search_result(result) ref = nil filename = nil startline = 0 diff --git a/app/views/search/results/_blob.html.haml b/app/views/search/results/_blob.html.haml index 9be13207070..58f58eff54d 100644 --- a/app/views/search/results/_blob.html.haml +++ b/app/views/search/results/_blob.html.haml @@ -1,4 +1,4 @@ -- blob = @project.repository.search_to_blob(blob) +- blob = @project.repository.parse_search_result(blob) .blob-result .file-holder .file-title diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml index f9c5810e3d0..c03438eb952 100644 --- a/app/views/search/results/_wiki_blob.html.haml +++ b/app/views/search/results/_wiki_blob.html.haml @@ -1,3 +1,4 @@ +- wiki_blob = @project.repository.parse_search_result(wiki_blob) .blob-result .file-holder .file-title -- cgit v1.2.1 From ec19a960ca45c630872ef65f681d42ccc91b1c7f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 12 Jul 2015 14:32:25 +0200 Subject: Add tests for repository search files Signed-off-by: Dmitriy Zaporozhets --- app/models/repository.rb | 2 +- spec/models/repository_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 8a9213f659c..6262b5c4c92 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -442,7 +442,7 @@ class Repository filename = nil startline = 0 - lines = result.lstrip.lines + lines = result.lines lines.each_with_index do |line, index| if line =~ /^.*:.*:\d+:/ ref, filename, startline = line.split(':') diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index a083dcb1274..d25351b0f0e 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -47,4 +47,28 @@ describe Repository do it { is_expected.to be_falsey } end end + + describe "search_files" do + let(:results) { repository.search_files('feature', 'master') } + subject { results } + + it { is_expected.to be_an Array } + + describe 'result' do + subject { results.first } + + it { is_expected.to be_an String } + it { expect(subject.lines[2]).to eq("master:CHANGELOG:188: - Feature: Replace teams with group membership\n") } + end + + describe 'parsing result' do + subject { repository.parse_search_result(results.first) } + + it { is_expected.to be_an OpenStruct } + it { expect(subject.filename).to eq('CHANGELOG') } + it { expect(subject.ref).to eq('master') } + it { expect(subject.startline).to eq(186) } + it { expect(subject.data.lines[2]).to eq(" - Feature: Replace teams with group membership\n") } + end + end end -- cgit v1.2.1 From ed97b057f61e219c252a18e3421b158c905ec317 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 12 Jul 2015 14:37:34 +0200 Subject: Mention search improvements in CHANGELOG Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index a964a192216..c3a24e63bfe 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,7 @@ v 7.13.0 (unreleased) - Redesign project page. Show README as default instead of activity. Move project activity to separate page - Make left menu more hierarchical and less contextual by adding back item at top - A fork can’t have a visibility level that is greater than the original project. + - Faster code search in repository and wiki. Fixes search page timeout for big repositories v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. -- cgit v1.2.1 From f4f216db67e2a02ed8f5057d8a74f77cf2fc8ab2 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 12 Jul 2015 21:37:10 -0700 Subject: Only enable HSTS header for HTTPS and port 443 Closes https://github.com/gitlabhq/gitlabhq/issues/9449 --- CHANGELOG | 1 + app/controllers/application_controller.rb | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7d5f186d755..e95c72790d6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.13.0 (unreleased) + - Only enable HSTS header for HTTPS and port 443 (Stan Hu) - Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu) - Fix redirection to home page URL for unauthorized users (Daniel Gerhardt) - Add branch switching support for graphs (Daniel Gerhardt) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8a9d0ce6ff4..362b03e0d5e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -183,7 +183,10 @@ class ApplicationController < ActionController::Base headers['X-XSS-Protection'] = '1; mode=block' headers['X-UA-Compatible'] = 'IE=edge' headers['X-Content-Type-Options'] = 'nosniff' - headers['Strict-Transport-Security'] = 'max-age=31536000' if Gitlab.config.gitlab.https + # Enabling HSTS for non-standard ports would send clients to the wrong port + if Gitlab.config.gitlab.https and Gitlab.config.gitlab.port == 443 + headers['Strict-Transport-Security'] = 'max-age=31536000' + end end def add_gon_variables -- cgit v1.2.1 From bbd3d2c39d2068411f8d8067655d6b139a8a4201 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 11:27:25 +0200 Subject: Avoid copy of strings in memory for parsing git grep result Signed-off-by: Dmitriy Zaporozhets --- app/models/repository.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 6262b5c4c92..c0bc1829e82 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -442,8 +442,7 @@ class Repository filename = nil startline = 0 - lines = result.lines - lines.each_with_index do |line, index| + result.each_line.each_with_index do |line, index| if line =~ /^.*:.*:\d+:/ ref, filename, startline = line.split(':') startline = startline.to_i - index @@ -451,11 +450,11 @@ class Repository end end - data = lines.map do |line| - line.sub(ref, '').sub(filename, '').sub(/^:-\d+-/, '').sub(/^::\d+:/, '') - end + data = "" - data = data.join("") + result.each_line do |line| + data << line.sub(ref, '').sub(filename, '').sub(/^:-\d+-/, '').sub(/^::\d+:/, '') + end OpenStruct.new( filename: filename, -- cgit v1.2.1 From 62da53af33da26ac5dc071a83f8d5c89a5717a6a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 11:56:08 +0200 Subject: Hide icon for bact-to-location menu in sidebar Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/sidebar.scss | 6 ++++++ app/views/layouts/nav/_group.html.haml | 2 +- app/views/layouts/nav/_group_settings.html.haml | 2 +- app/views/layouts/nav/_profile.html.haml | 2 +- app/views/layouts/nav/_project.html.haml | 4 ++-- app/views/layouts/nav/_project_settings.html.haml | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss index cb8ecba8dee..f3950cef6bc 100644 --- a/app/assets/stylesheets/generic/sidebar.scss +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -96,6 +96,12 @@ .nav-sidebar li a{ width: 230px; + + &.back-link { + i { + visibility: hidden; + } + } } } } diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml index fc74d0205c6..695ce68a201 100644 --- a/app/views/layouts/nav/_group.html.haml +++ b/app/views/layouts/nav/_group.html.haml @@ -1,6 +1,6 @@ %ul.nav.nav-sidebar = nav_link do - = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'} do + = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do = icon('caret-square-o-left fw') %span Back to Dashboard diff --git a/app/views/layouts/nav/_group_settings.html.haml b/app/views/layouts/nav/_group_settings.html.haml index 72ada771ca4..8075fe32fbc 100644 --- a/app/views/layouts/nav/_group_settings.html.haml +++ b/app/views/layouts/nav/_group_settings.html.haml @@ -1,6 +1,6 @@ %ul.nav.nav-sidebar = nav_link do - = link_to group_path(@group), title: 'Back to group', data: {placement: 'right'} do + = link_to group_path(@group), title: 'Back to group', data: {placement: 'right'}, class: 'back-link' do = icon('caret-square-o-left fw') %span Back to group diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml index 00d3cb300d4..33fd5fcef6c 100644 --- a/app/views/layouts/nav/_profile.html.haml +++ b/app/views/layouts/nav/_profile.html.haml @@ -1,6 +1,6 @@ %ul.nav.nav-sidebar = nav_link do - = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'} do + = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do = icon('caret-square-o-left fw') %span Back to Dashboard diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index a92d618284d..d17d1c5fbd4 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -1,13 +1,13 @@ %ul.nav.nav-sidebar - if @project.group = nav_link do - = link_to group_path(@project.group), title: 'Back to group', data: {placement: 'right'} do + = link_to group_path(@project.group), title: 'Back to group', data: {placement: 'right'}, class: 'back-link' do = icon('caret-square-o-left fw') %span Back to Group - else = nav_link do - = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'} do + = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do = icon('caret-square-o-left fw') %span Back to Dashboard diff --git a/app/views/layouts/nav/_project_settings.html.haml b/app/views/layouts/nav/_project_settings.html.haml index 9c86d3c09b2..857fb199957 100644 --- a/app/views/layouts/nav/_project_settings.html.haml +++ b/app/views/layouts/nav/_project_settings.html.haml @@ -1,6 +1,6 @@ %ul.nav.nav-sidebar = nav_link do - = link_to project_path(@project), title: 'Back to project', data: {placement: 'right'} do + = link_to project_path(@project), title: 'Back to project', data: {placement: 'right'}, class: 'back-link' do = icon('caret-square-o-left fw') %span Back to project -- cgit v1.2.1 From 31565d78906577bf8582982e5492166e8edd3218 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Mon, 13 Jul 2015 12:36:53 +0200 Subject: Revert "added link to issue closing pattern in doc" This reverts commit 903daedb5a963d55f8b2e836127958f92a1562a5. --- doc/api/milestones.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/api/milestones.md b/doc/api/milestones.md index cba4a7c484c..a6828728264 100644 --- a/doc/api/milestones.md +++ b/doc/api/milestones.md @@ -87,5 +87,3 @@ Parameters: - `id` (required) - The ID of a project - `milestone_id` (required) - The ID of a project milestone - -You can close multiple issues with one Merge Request by following the [issue closing pattern documentation](http://doc.gitlab.com/ce/customization/issue_closing.html). -- cgit v1.2.1 From 057d45fb23fdbc44636ffd9f352d66cef76c4d6a Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 13 Jul 2015 13:32:14 +0200 Subject: Use password field default password masking. --- app/helpers/projects_helper.rb | 10 ---------- app/views/shared/_field.html.haml | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index aa15398cbed..78f24dbd7ef 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -248,16 +248,6 @@ module ProjectsHelper end end - def service_field_value(type, value) - return value unless type == 'password' - - if value.present? - "***********" - else - nil - end - end - def user_max_access_in_project(user, project) level = project.team.max_member_access(user) diff --git a/app/views/shared/_field.html.haml b/app/views/shared/_field.html.haml index 30d37dceb30..45ec49280d2 100644 --- a/app/views/shared/_field.html.haml +++ b/app/views/shared/_field.html.haml @@ -1,6 +1,6 @@ - name = field[:name] - title = field[:title] || name.humanize -- value = service_field_value(field[:type], @service.send(name)) +- value = @service.send(name) - type = field[:type] - placeholder = field[:placeholder] - choices = field[:choices] @@ -19,6 +19,6 @@ - elsif type == 'select' = form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" } - elsif type == 'password' - = form.password_field name, placeholder: value, class: 'form-control' + = form.password_field name, value: value, class: 'form-control' - if help %span.help-block= help -- cgit v1.2.1 From 9ba0079c5133cfef71b469c0af69db3e6c01bda1 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 13 Jul 2015 18:14:26 +0200 Subject: Add 'ed' step to mysql-to-postgres procedure Introduced in https://github.com/gitlabhq/mysql-postgresql-converter/commit/b2d1599706f532e1bac836243f25e005c816ef14 --- doc/update/mysql_to_postgresql.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 8ef3e0d55cc..6f89f9eda79 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -16,6 +16,7 @@ git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -b gitlab cd mysql-postgresql-converter mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production -p python db_converter.py gitlabhq_production.mysql gitlabhq_production.psql +ed -s gitlabhq_production.psql < move_drop_indexes.ed # Import the database dump as the application database user sudo -u git psql -f gitlabhq_production.psql -d gitlabhq_production @@ -56,6 +57,7 @@ sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter. # Convert gitlabhq_production.mysql sudo -u git -H mkdir db sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql +sudo -u git -H ed -s db/database.sql < move_drop_indexes.ed # Compress database backup sudo -u git -H gzip db/database.sql -- cgit v1.2.1 From 5f34759ecb630ef410fe1025cf19e37f1dd4615f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 18:24:15 +0200 Subject: Allow user to specify content he wants to see on project page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/dispatcher.js.coffee | 1 - app/assets/javascripts/pager.js.coffee | 2 +- app/controllers/profiles/preferences_controller.rb | 1 + app/helpers/preferences_helper.rb | 12 ++++++++++ app/models/user.rb | 4 ++++ app/views/profiles/preferences/show.html.haml | 8 +++++++ app/views/projects/_activity.html.haml | 15 ++++++++++++ app/views/projects/_readme.html.haml | 24 +++++++++++++++++++ app/views/projects/activity.html.haml | 13 +---------- app/views/projects/show.html.haml | 27 +++------------------- .../20150713160110_add_project_view_to_users.rb | 5 ++++ db/schema.rb | 3 ++- doc/profile/preferences.md | 6 +++++ 13 files changed, 82 insertions(+), 39 deletions(-) create mode 100644 app/views/projects/_activity.html.haml create mode 100644 app/views/projects/_readme.html.haml create mode 100644 db/migrate/20150713160110_add_project_view_to_users.rb diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index 8ceaef81a07..2ab148bc296 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -63,7 +63,6 @@ class Dispatcher when 'projects:commits:show' shortcut_handler = new ShortcutsNavigation() when 'projects:activity' - new Activities() shortcut_handler = new ShortcutsNavigation() when 'projects:show' shortcut_handler = new ShortcutsNavigation() diff --git a/app/assets/javascripts/pager.js.coffee b/app/assets/javascripts/pager.js.coffee index fe83dc0410e..d639303aed3 100644 --- a/app/assets/javascripts/pager.js.coffee +++ b/app/assets/javascripts/pager.js.coffee @@ -12,7 +12,7 @@ @loading.show() $.ajax type: "GET" - url: location.href + url: $(".content_list").data('href') || location.href data: "limit=" + @limit + "&offset=" + @offset complete: => @loading.hide() diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index 538b09ca54d..f83b4abd1e2 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -32,6 +32,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController params.require(:user).permit( :color_scheme_id, :dashboard, + :project_view, :theme_id ) end diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index bceff4fd52e..ea774e28ecf 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -42,6 +42,13 @@ module PreferencesHelper end end + def project_view_choices + [ + ['Readme (default)', :readme], + ['Activity view', :activity] + ] + end + def user_application_theme theme = Gitlab::Themes.by_id(current_user.try(:theme_id)) theme.css_class @@ -50,4 +57,9 @@ module PreferencesHelper def user_color_scheme_class COLOR_SCHEMES[current_user.try(:color_scheme_id)] if defined?(current_user) end + + def prefer_readme? + !current_user || + current_user.project_view == 'readme' + end end diff --git a/app/models/user.rb b/app/models/user.rb index 317257a2500..fb330ff7185 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -177,6 +177,10 @@ class User < ActiveRecord::Base # Note: When adding an option, it MUST go on the end of the array. enum dashboard: [:projects, :stars] + # User's Project preference + # Note: When adding an option, it MUST go on the end of the array. + enum project_view: [:readme, :activity] + alias_attribute :private_token, :authentication_token delegate :path, to: :namespace, allow_nil: true, prefix: true diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index aa99280fde6..1134317ee06 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -38,5 +38,13 @@ = link_to('(?)', help_page_path('profile', 'preferences') + '#default-dashboard', target: '_blank') .col-sm-10 = f.select :dashboard, dashboard_choices, {}, class: 'form-control' + .form-group + = f.label :project_view, class: 'control-label' do + Project view + = link_to('(?)', help_page_path('profile', 'preferences') + '#default-project-view', target: '_blank') + .col-sm-10 + = f.select :project_view, project_view_choices, {}, class: 'form-control' + .help-block + Choose what content you want to see when visit project page .panel-footer = f.submit 'Save', class: 'btn btn-save' diff --git a/app/views/projects/_activity.html.haml b/app/views/projects/_activity.html.haml new file mode 100644 index 00000000000..ee02b7f6a6c --- /dev/null +++ b/app/views/projects/_activity.html.haml @@ -0,0 +1,15 @@ += render 'projects/last_push' +.hidden-xs + - if current_user + %ul.nav.nav-pills.event_filter.pull-right + %li + = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do + %i.fa.fa-rss + + = render 'shared/event_filter' + %hr +.content_list{:"data-href" => activity_project_path(@project)} += spinner + +:coffeescript + new Activities() diff --git a/app/views/projects/_readme.html.haml b/app/views/projects/_readme.html.haml new file mode 100644 index 00000000000..5038edb95ed --- /dev/null +++ b/app/views/projects/_readme.html.haml @@ -0,0 +1,24 @@ +- if readme = @repository.readme + %article.readme-holder#README + .clearfix + .pull-right +   + - if can?(current_user, :push_code, @project) + = link_to namespace_project_edit_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do + %i.fa.fa-pencil + .wiki + = cache(readme_cache_key) do + = render_readme(readme) +- else + %h3.page-title + This project does not have README yet + - if can?(current_user, :push_code, @project) + %p.slead + A + %code README + file contains information about other files in a repository and is commonly + distributed with computer software, forming part of its documentation. + %br + We recommend you to + = link_to "add README", new_readme_path, class: 'underlined-link' + file to the repository and GitLab will render it here instead of this message. diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml index b486cd4ded4..65674913bb0 100644 --- a/app/views/projects/activity.html.haml +++ b/app/views/projects/activity.html.haml @@ -1,12 +1 @@ -= render 'projects/last_push' -.hidden-xs - - if current_user - %ul.nav.nav-pills.event_filter.pull-right - %li - = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do - %i.fa.fa-rss - - = render 'shared/event_filter' - %hr -.content_list -= spinner += render 'projects/activity' diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 5c2ac484ceb..98d9053eb1d 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -41,31 +41,10 @@ %hr %section - - if readme = @repository.readme - %article.readme-holder#README - .clearfix - .pull-right -   - - if can?(current_user, :push_code, @project) - = link_to namespace_project_edit_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do - %i.fa.fa-pencil - .wiki - = cache(readme_cache_key) do - = render_readme(readme) + - if prefer_readme? + = render 'projects/readme' - else - %h3.page-title - This project does not have README yet - - if can?(current_user, :push_code, @project) - %p.slead - A - %code README - file contains information about other files in a repository and is commonly - distributed with computer software, forming part of its documentation. - %br - We recommend you to - = link_to "add README", new_readme_path, class: 'underlined-link' - file to the repository and GitLab will render it here instead of this message. - + = render 'projects/activity' - if current_user diff --git a/db/migrate/20150713160110_add_project_view_to_users.rb b/db/migrate/20150713160110_add_project_view_to_users.rb new file mode 100644 index 00000000000..fe3d206df89 --- /dev/null +++ b/db/migrate/20150713160110_add_project_view_to_users.rb @@ -0,0 +1,5 @@ +class AddProjectViewToUsers < ActiveRecord::Migration + def change + add_column :users, :project_view, :integer, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index fb0982b10fd..d6c34a77ee6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150620233230) do +ActiveRecord::Schema.define(version: 20150713160110) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -517,6 +517,7 @@ ActiveRecord::Schema.define(version: 20150620233230) do t.text "otp_backup_codes" t.string "public_email", default: "", null: false t.integer "dashboard", default: 0 + t.integer "project_view", default: 0 end add_index "users", ["admin"], name: "index_users_on_admin", using: :btree diff --git a/doc/profile/preferences.md b/doc/profile/preferences.md index ce5f1936782..f17bbe8f2aa 100644 --- a/doc/profile/preferences.md +++ b/doc/profile/preferences.md @@ -30,3 +30,9 @@ will be. Setting it to **Starred Projects** will make that Dashboard view the default when signing in or clicking the application logo in the upper left. The default is **Your Projects**. + +### Default Project view + +It allows user to choose what content he or she want to see on project page. + +The default is **Readme**. -- cgit v1.2.1 From 78a94027eabad9f70fe525530a39da4d0dbf7105 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 18:42:07 +0200 Subject: Add dropdown to quickly create issue or branch from project page Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/_dropdown.html.haml | 33 ++++++++++++++++++++++++++++++++ app/views/projects/_home_panel.html.haml | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 app/views/projects/_dropdown.html.haml diff --git a/app/views/projects/_dropdown.html.haml b/app/views/projects/_dropdown.html.haml new file mode 100644 index 00000000000..cfdb899453b --- /dev/null +++ b/app/views/projects/_dropdown.html.haml @@ -0,0 +1,33 @@ +- if current_user + %span.dropdown + %a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"} + %i.fa.fa-bars + %ul.dropdown-menu + - if @project.issues_enabled && can?(current_user, :create_issue, @project) + %li + = link_to url_for_new_issue, title: "New Issue" do + New issue + - if @project.merge_requests_enabled && can?(current_user, :create_merge_request, @project) + %li + = link_to new_namespace_project_merge_request_path(@project.namespace, @project), title: "New Merge Request" do + New merge request + - if @project.snippets_enabled && can?(current_user, :create_snippet, @project) + %li + = link_to new_namespace_project_snippet_path(@project.namespace, @project), title: "New Snippet" do + New snippet + - if can?(current_user, :admin_project_member, @project) + %li + = link_to namespace_project_project_members_path(@project.namespace, @project), title: "New project member" do + New project member + - if can? current_user, :push_code, @project + %li.divider + %li + = link_to new_namespace_project_branch_path(@project.namespace, @project) do + %i.fa.fa-code-fork + Git branch + %li + = link_to new_namespace_project_tag_path(@project.namespace, @project) do + %i.fa.fa-tag + Git tag + + diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 95c84c96c41..64055a9ccf2 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -23,4 +23,6 @@ = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do %i.fa.fa-download + = render 'projects/dropdown' + = render "shared/clone_panel" -- cgit v1.2.1 From 6f581841d5c01b39fcc9f5c013541136d861ebcc Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Mon, 13 Jul 2015 18:54:15 +0200 Subject: Remove author information from "post" in merge_requests API. From both experimenting with the API and reading the source code, this appears to not be used at all. My guess is this was copypasta from somewhere else. --- doc/api/merge_requests.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 7b0873a9111..7624fd3a3ef 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -336,14 +336,6 @@ Parameters: ```json { - "author": { - "id": 1, - "username": "admin", - "email": "admin@example.com", - "name": "Administrator", - "blocked": false, - "created_at": "2012-04-29T08:46:00Z" - }, "note": "text1" } ``` -- cgit v1.2.1 From 67c17df2219f04faa19066bd0996687360ba68b1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 19:04:48 +0200 Subject: Better wording for project dropdown Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/_dropdown.html.haml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/projects/_dropdown.html.haml b/app/views/projects/_dropdown.html.haml index cfdb899453b..dfdf9fb7ac4 100644 --- a/app/views/projects/_dropdown.html.haml +++ b/app/views/projects/_dropdown.html.haml @@ -23,11 +23,10 @@ %li.divider %li = link_to new_namespace_project_branch_path(@project.namespace, @project) do - %i.fa.fa-code-fork - Git branch + New git branch %li = link_to new_namespace_project_tag_path(@project.namespace, @project) do %i.fa.fa-tag - Git tag + New git tag -- cgit v1.2.1 From a839b2afc40d09d1867fea4ff8cd00b0a4d88f9e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 19:23:15 +0200 Subject: Make sidebar scrollable. It prevents content overflow for small screens Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/sidebar.scss | 13 +++++-------- app/assets/stylesheets/themes/gitlab-theme.scss | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss index f3950cef6bc..116428fbdbe 100644 --- a/app/assets/stylesheets/generic/sidebar.scss +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -2,6 +2,8 @@ .sidebar-wrapper { position: fixed; top: 0; + bottom: 0; + overflow-y: scroll; left: 0; height: 100%; transition-duration: .3s; @@ -21,8 +23,9 @@ } .nav-sidebar { + margin-top: 29 + $header-height; + margin-bottom: 50px; transition-duration: .3s; - margin: 0; list-style: none; overflow: hidden; @@ -88,9 +91,6 @@ width: $sidebar_width; .nav-sidebar { - margin-top: 29px; - position: fixed; - top: $header-height; width: $sidebar_width; } @@ -114,9 +114,6 @@ width: $sidebar_collapsed_width; .nav-sidebar { - margin-top: 29px; - position: fixed; - top: $header-height; width: $sidebar_collapsed_width; li a { @@ -178,7 +175,7 @@ } .sidebar-user { - position: absolute; + position: fixed; bottom: 0; width: $sidebar_width; padding: 10px; diff --git a/app/assets/stylesheets/themes/gitlab-theme.scss b/app/assets/stylesheets/themes/gitlab-theme.scss index dc47b108100..e5325bbdc74 100644 --- a/app/assets/stylesheets/themes/gitlab-theme.scss +++ b/app/assets/stylesheets/themes/gitlab-theme.scss @@ -38,6 +38,7 @@ border-right: 1px solid $color-darker; .sidebar-user { + background: $color-darker; color: $color-light; &:hover { -- cgit v1.2.1 From 24ecc9049f9359ef3f6a1f1259cbba1b9e2b1e0c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 19:24:41 +0200 Subject: Increase padding between menu items a bit Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/sidebar.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss index 116428fbdbe..4e9daa5ea34 100644 --- a/app/assets/stylesheets/generic/sidebar.scss +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -42,7 +42,7 @@ } a { - padding: 7px 15px; + padding: 8px 15px; font-size: 13px; line-height: 18px; color: $gray; -- cgit v1.2.1 From 3d6e67e44ed65eafbf81de3abb6b3c69b2500079 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Mon, 13 Jul 2015 10:36:29 -0700 Subject: fixed notifications title --- doc/workflow/README.md | 2 +- doc/workflow/notifications.md | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/workflow/README.md b/doc/workflow/README.md index f1959d30139..1f39d02bdf3 100644 --- a/doc/workflow/README.md +++ b/doc/workflow/README.md @@ -7,7 +7,7 @@ - [Groups](groups.md) - [Keyboard shortcuts](shortcuts.md) - [Labels](labels.md) -- [Notifications](notifications.md) +- [Notification emails](notifications.md) - [Project Features](project_features.md) - [Project forking workflow](forking_workflow.md) - [Protected branches](protected_branches.md) diff --git a/doc/workflow/notifications.md b/doc/workflow/notifications.md index 17215de677e..2b5f06dd1fa 100644 --- a/doc/workflow/notifications.md +++ b/doc/workflow/notifications.md @@ -1,6 +1,6 @@ -# GitLab Notifications +# GitLab Notification Emails -GitLab has notifications system in place to notify a user of events important for the workflow. +GitLab has a notification system in place to notify a user of events that are important for the workflow. ## Notification settings @@ -67,5 +67,3 @@ Below is the table of events users can be notified of: | Reopen merge request | Project members [1] | [1] higher than participating | | Merge merge request | MR author [1], MR assignee [2], project members [3] | [1] [2] not disabled, [3] higher than participating | | New comment | Mentioned users [1], users participating [2], project members [3] | [1] [2] not disabled, [3] higher than participating | - - -- cgit v1.2.1 From 3020fa9945c9c15878ce043c961e764e02fa2511 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Mon, 13 Jul 2015 12:44:50 -0700 Subject: added link to doc --- doc/gitlab-basics/basic-git-commands.md | 5 ----- doc/gitlab-basics/create-branch.md | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/doc/gitlab-basics/basic-git-commands.md b/doc/gitlab-basics/basic-git-commands.md index 52465c24319..2b5767dd2d3 100644 --- a/doc/gitlab-basics/basic-git-commands.md +++ b/doc/gitlab-basics/basic-git-commands.md @@ -51,11 +51,6 @@ git checkout . git clean -f ``` -### Remove all the changes that you don't want to send to gitlab.com -``` -git add NAME-OF-FILE -all -``` - ### Merge created branch with master branch You need to be in the created branch. ``` diff --git a/doc/gitlab-basics/create-branch.md b/doc/gitlab-basics/create-branch.md index b0a26176b31..3521de6bea3 100644 --- a/doc/gitlab-basics/create-branch.md +++ b/doc/gitlab-basics/create-branch.md @@ -3,9 +3,9 @@ A branch is an independent line of development. New commits are recorded in the history for the current branch, which results in taking the source from someone’s repository (the place where the history of your work is stored) at certain point in time, and apply your own changes to it in the history of the project. -To add changes to your GitLab project, you should create a branch. You can do it in your shell or in [GitLab.com](https://gitlab.com). +To add changes to your GitLab project, you should create a branch. You can do it in your [shell](basic-git-commands.md) or in [GitLab](https://gitlab.com). -To create a new branch in [GitLab.com](https://gitlab.com), sign in and then select a project on the right side of your screen: +To create a new branch in GitLab, sign in and then select a project on the right side of your screen: ![Select a project](basicsimages/select_project.png) -- cgit v1.2.1 From fd84567545d274f29bbcf397c074618d4b300349 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jul 2015 23:36:21 +0200 Subject: Improve project new item dropdown Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/_dropdown.html.haml | 32 -------------------------- app/views/projects/_home_panel.html.haml | 2 +- app/views/projects/buttons/_dropdown.html.haml | 31 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 33 deletions(-) delete mode 100644 app/views/projects/_dropdown.html.haml create mode 100644 app/views/projects/buttons/_dropdown.html.haml diff --git a/app/views/projects/_dropdown.html.haml b/app/views/projects/_dropdown.html.haml deleted file mode 100644 index dfdf9fb7ac4..00000000000 --- a/app/views/projects/_dropdown.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -- if current_user - %span.dropdown - %a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"} - %i.fa.fa-bars - %ul.dropdown-menu - - if @project.issues_enabled && can?(current_user, :create_issue, @project) - %li - = link_to url_for_new_issue, title: "New Issue" do - New issue - - if @project.merge_requests_enabled && can?(current_user, :create_merge_request, @project) - %li - = link_to new_namespace_project_merge_request_path(@project.namespace, @project), title: "New Merge Request" do - New merge request - - if @project.snippets_enabled && can?(current_user, :create_snippet, @project) - %li - = link_to new_namespace_project_snippet_path(@project.namespace, @project), title: "New Snippet" do - New snippet - - if can?(current_user, :admin_project_member, @project) - %li - = link_to namespace_project_project_members_path(@project.namespace, @project), title: "New project member" do - New project member - - if can? current_user, :push_code, @project - %li.divider - %li - = link_to new_namespace_project_branch_path(@project.namespace, @project) do - New git branch - %li - = link_to new_namespace_project_tag_path(@project.namespace, @project) do - %i.fa.fa-tag - New git tag - - diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 64055a9ccf2..7b6b4b35c8d 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -23,6 +23,6 @@ = link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do %i.fa.fa-download - = render 'projects/dropdown' + = render 'projects/buttons/dropdown' = render "shared/clone_panel" diff --git a/app/views/projects/buttons/_dropdown.html.haml b/app/views/projects/buttons/_dropdown.html.haml new file mode 100644 index 00000000000..99c2ed62545 --- /dev/null +++ b/app/views/projects/buttons/_dropdown.html.haml @@ -0,0 +1,31 @@ +- if current_user + %span.dropdown + %a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"} + %i.fa.fa-plus + %ul.dropdown-menu + - if @project.issues_enabled && can?(current_user, :create_issue, @project) + %li + = link_to url_for_new_issue, title: "New Issue" do + New issue + - if @project.merge_requests_enabled && can?(current_user, :create_merge_request, @project) + %li + = link_to new_namespace_project_merge_request_path(@project.namespace, @project), title: "New Merge Request" do + New merge request + - if @project.snippets_enabled && can?(current_user, :create_snippet, @project) + %li + = link_to new_namespace_project_snippet_path(@project.namespace, @project), title: "New Snippet" do + New snippet + - if can?(current_user, :admin_project_member, @project) + %li + = link_to namespace_project_project_members_path(@project.namespace, @project), title: "New project member" do + New project member + - if can? current_user, :push_code, @project + %li.divider + %li + = link_to new_namespace_project_branch_path(@project.namespace, @project) do + New git branch + %li + = link_to new_namespace_project_tag_path(@project.namespace, @project) do + New git tag + + -- cgit v1.2.1 From e4c698fd5ce77e46e3851384c14271eb74c3c9ee Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Mon, 13 Jul 2015 18:28:10 -0400 Subject: Refactor Mentionable#notice_added_references It now accounts for models that have changed but have already been persisted, such as when called from an UpdateService. Closes #1773 --- app/models/concerns/mentionable.rb | 36 ++++++++++++++++------- spec/models/concerns/mentionable_spec.rb | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 11 deletions(-) diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 56849f28ff0..8ff670dd2bf 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -82,19 +82,33 @@ module Mentionable # If the mentionable_text field is about to change, locate any *added* references and create cross references for # them. Invoke from an observer's #before_save implementation. def notice_added_references(p = project, a = author) - ch = changed_attributes - original, mentionable_changed = "", false - self.class.mentionable_attrs.each do |attr| - if ch[attr] - original << ch[attr] - mentionable_changed = true - end - end + changes = detect_mentionable_changes + + return if changes.empty? - # Only proceed if the saved changes actually include a chance to an attr_mentionable field. - return unless mentionable_changed + original_text = changes.collect { |_, vals| vals.first }.join(' ') - preexisting = references(p, self.author, original) + preexisting = references(p, self.author, original_text) create_cross_references!(p, a, preexisting) end + + private + + # Returns a Hash of changed mentionable fields + # + # Preference is given to the `changes` Hash, but falls back to + # `previous_changes` if it's empty (i.e., the changes have already been + # persisted). + # + # See ActiveModel::Dirty. + # + # Returns a Hash. + def detect_mentionable_changes + source = (changes.present? ? changes : previous_changes).dup + + mentionable = self.class.mentionable_attrs + + # Only include changed fields that are mentionable + source.select { |key, val| mentionable.include?(key) } + end end diff --git a/spec/models/concerns/mentionable_spec.rb b/spec/models/concerns/mentionable_spec.rb index f7f66987b5f..82e8a83bb3d 100644 --- a/spec/models/concerns/mentionable_spec.rb +++ b/spec/models/concerns/mentionable_spec.rb @@ -28,4 +28,53 @@ describe Issue, "Mentionable" do issue.create_cross_references!(project, author, [commit2]) end end + + describe '#notice_added_references' do + let(:project) { create(:project) } + let(:issues) { create_list(:issue, 2, project: project) } + + context 'before changes are persisted' do + it 'ignores pre-existing references' do + issue = create_issue(description: issues[0].to_reference) + + expect(SystemNoteService).not_to receive(:cross_reference) + + issue.description = 'New description' + issue.notice_added_references + end + + it 'notifies new references' do + issue = create_issue(description: issues[0].to_reference) + + expect(SystemNoteService).to receive(:cross_reference).with(issues[1], any_args) + + issue.description = issues[1].to_reference + issue.notice_added_references + end + end + + context 'after changes are persisted' do + it 'ignores pre-existing references' do + issue = create_issue(description: issues[0].to_reference) + + expect(SystemNoteService).not_to receive(:cross_reference) + + issue.update_attributes(description: 'New description') + issue.notice_added_references + end + + it 'notifies new references' do + issue = create_issue(description: issues[0].to_reference) + + expect(SystemNoteService).to receive(:cross_reference).with(issues[1], any_args) + + issue.update_attributes(description: issues[1].to_reference) + issue.notice_added_references + end + end + + def create_issue(description:) + create(:issue, project: project, description: description) + end + end end -- cgit v1.2.1 From f3d4767d0c78daf315e6b653bed3a3a3ee308072 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Mon, 13 Jul 2015 18:33:50 -0400 Subject: Rename `notice_added_references` to `create_new_cross_references!` --- app/models/concerns/mentionable.rb | 6 +++--- app/models/note.rb | 2 +- app/services/issues/update_service.rb | 2 +- app/services/merge_requests/update_service.rb | 2 +- spec/models/concerns/mentionable_spec.rb | 10 +++++----- spec/support/mentionable_shared_examples.rb | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 8ff670dd2bf..5b0ae411642 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -79,9 +79,9 @@ module Mentionable end end - # If the mentionable_text field is about to change, locate any *added* references and create cross references for - # them. Invoke from an observer's #before_save implementation. - def notice_added_references(p = project, a = author) + # When a mentionable field is changed, creates cross-reference notes that + # don't already exist + def create_new_cross_references!(p = project, a = author) changes = detect_mentionable_changes return if changes.empty? diff --git a/app/models/note.rb b/app/models/note.rb index 68b9d433ae0..62567f471dc 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -356,7 +356,7 @@ class Note < ActiveRecord::Base end def set_references - notice_added_references(project, author) + create_new_cross_references!(project, author) end def editable? diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index f848ecedd6b..eabab65c9b0 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -35,7 +35,7 @@ module Issues create_title_change_note(issue, issue.previous_changes['title'].first) end - issue.notice_added_references(issue.project, current_user) + issue.create_new_cross_references!(issue.project, current_user) execute_hooks(issue, 'update') end diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index e5c5368f5d6..589fad16165 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -59,7 +59,7 @@ module MergeRequests merge_request.mark_as_unchecked end - merge_request.notice_added_references(merge_request.project, current_user) + merge_request.create_new_cross_references!(merge_request.project, current_user) execute_hooks(merge_request, 'update') end diff --git a/spec/models/concerns/mentionable_spec.rb b/spec/models/concerns/mentionable_spec.rb index 82e8a83bb3d..2d6fe003215 100644 --- a/spec/models/concerns/mentionable_spec.rb +++ b/spec/models/concerns/mentionable_spec.rb @@ -29,7 +29,7 @@ describe Issue, "Mentionable" do end end - describe '#notice_added_references' do + describe '#create_new_cross_references!' do let(:project) { create(:project) } let(:issues) { create_list(:issue, 2, project: project) } @@ -40,7 +40,7 @@ describe Issue, "Mentionable" do expect(SystemNoteService).not_to receive(:cross_reference) issue.description = 'New description' - issue.notice_added_references + issue.create_new_cross_references! end it 'notifies new references' do @@ -49,7 +49,7 @@ describe Issue, "Mentionable" do expect(SystemNoteService).to receive(:cross_reference).with(issues[1], any_args) issue.description = issues[1].to_reference - issue.notice_added_references + issue.create_new_cross_references! end end @@ -60,7 +60,7 @@ describe Issue, "Mentionable" do expect(SystemNoteService).not_to receive(:cross_reference) issue.update_attributes(description: 'New description') - issue.notice_added_references + issue.create_new_cross_references! end it 'notifies new references' do @@ -69,7 +69,7 @@ describe Issue, "Mentionable" do expect(SystemNoteService).to receive(:cross_reference).with(issues[1], any_args) issue.update_attributes(description: issues[1].to_reference) - issue.notice_added_references + issue.create_new_cross_references! end end diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb index a2a0b6905f9..f0717e61781 100644 --- a/spec/support/mentionable_shared_examples.rb +++ b/spec/support/mentionable_shared_examples.rb @@ -143,6 +143,6 @@ shared_examples 'an editable mentionable' do end set_mentionable_text.call(new_text) - subject.notice_added_references(project, author) + subject.create_new_cross_references!(project, author) end end -- cgit v1.2.1 From ce02bf9900eae0f15d7ff94755960f4440d5a3e5 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Mon, 13 Jul 2015 22:41:47 -0400 Subject: Move coverage-related setup back to spec_helper These tools must be loaded before our regular Rails environment. --- spec/spec_helper.rb | 11 +++++++++++ spec/support/coverage.rb | 8 -------- 2 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 spec/support/coverage.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 682a8863bad..d0f1873ee2d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,15 @@ +if ENV['SIMPLECOV'] + require 'simplecov' + SimpleCov.start :rails +end + +if ENV['COVERALLS'] + require 'coveralls' + Coveralls.wear_merged! +end + ENV["RAILS_ENV"] ||= 'test' + require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'shoulda/matchers' diff --git a/spec/support/coverage.rb b/spec/support/coverage.rb deleted file mode 100644 index a54bf03380c..00000000000 --- a/spec/support/coverage.rb +++ /dev/null @@ -1,8 +0,0 @@ -if ENV['SIMPLECOV'] - require 'simplecov' -end - -if ENV['COVERALLS'] - require 'coveralls' - Coveralls.wear_merged! -end -- cgit v1.2.1 From 80afd4c594e74737e0dfae5ecb747104ec83f157 Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Tue, 14 Jul 2015 11:49:53 +0200 Subject: create update guides for 7.13 --- doc/update/6.x-or-7.x-to-7.12.md | 304 --------------------------------------- doc/update/6.x-or-7.x-to-7.13.md | 304 +++++++++++++++++++++++++++++++++++++++ doc/update/7.12-to-7.13.md | 129 +++++++++++++++++ 3 files changed, 433 insertions(+), 304 deletions(-) delete mode 100644 doc/update/6.x-or-7.x-to-7.12.md create mode 100644 doc/update/6.x-or-7.x-to-7.13.md create mode 100644 doc/update/7.12-to-7.13.md diff --git a/doc/update/6.x-or-7.x-to-7.12.md b/doc/update/6.x-or-7.x-to-7.12.md deleted file mode 100644 index 5705fb360db..00000000000 --- a/doc/update/6.x-or-7.x-to-7.12.md +++ /dev/null @@ -1,304 +0,0 @@ -# From 6.x or 7.x to 7.12 -*Make sure you view this [upgrade guide from the `master` branch](../../../master/doc/update/6.x-or-7.x-to-7.12.md) for the most up to date instructions.* - -This allows you to upgrade any version of GitLab from 6.0 and up (including 7.0 and up) to 7.12. - -## Global issue numbers - -As of 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their URL. If you use an old issue number URL and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects. - -## Editable labels - -In GitLab 7.2 we replace Issue and Merge Request tags with labels, making it -possible to edit the label text and color. The characters `?`, `&` and `,` are -no longer allowed however so those will be removed from your tags during the -database migrations for GitLab 7.2. - -## 0. Stop server - - sudo service gitlab stop - -## 1. Backup - -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) - -```bash -cd /home/git/gitlab -sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production -``` - -## 2. Update Ruby - -If you are still using Ruby 1.9.3 or below, you will need to update Ruby. -You can check which version you are running with `ruby -v`. - -If you are you running Ruby 2.0.x, you do not need to upgrade ruby, but can consider doing so for performance reasons. - -If you are running Ruby 2.1.1 consider upgrading to 2.1.6, because of the high memory usage of Ruby 2.1.1. - -Install, update dependencies: - -```bash -sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl -``` - -Download and compile Ruby: - -```bash -mkdir /tmp/ruby && cd /tmp/ruby -curl --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz | tar xz -cd ruby-2.1.6 -./configure --disable-install-rdoc -make -sudo make install -``` - -Install Bundler: - -```bash -sudo gem install bundler --no-ri --no-rdoc -``` - -## 3. Get latest code - -```bash -cd /home/git/gitlab -sudo -u git -H git fetch --all -sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically -``` - -For GitLab Community Edition: - -```bash -sudo -u git -H git checkout 7-12-stable -``` - -OR - -For GitLab Enterprise Edition: - -```bash -sudo -u git -H git checkout 7-12-stable-ee -``` - -## 4. Install additional packages - -```bash -# Add support for logrotate for better log file handling -sudo apt-get install logrotate - -# Install pkg-config and cmake, which is needed for the latest versions of rugged -sudo apt-get install pkg-config cmake - -# If you want to use Kerberos with GitLab EE for user authentication, install Kerberos header files -# If you don't know what Kerberos is, you can assume you don't need it. -sudo apt-get install libkrb5-dev - -# Install nodejs, javascript runtime required for assets -sudo apt-get install nodejs -``` - -## 5. Configure Redis to use sockets - - # Configure redis to use sockets - sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig - # Disable Redis listening on TCP by setting 'port' to 0 - sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf - # Enable Redis socket for default Debian / Ubuntu path - echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf - # Be sure redis group can write to the socket, enable only if supported (>= redis 2.4.0). - sudo sed -i '/# unixsocketperm/ s/^# unixsocketperm.*/unixsocketperm 0775/' /etc/redis/redis.conf - # Activate the changes to redis.conf - sudo service redis-server restart - # Add git to the redis group - sudo usermod -aG redis git - - # Configure Redis connection settings - sudo -u git -H cp config/resque.yml.example config/resque.yml - # Change the Redis socket path if you are not using the default Debian / Ubuntu configuration - sudo -u git -H editor config/resque.yml - - # Configure gitlab-shell to use Redis sockets - sudo -u git -H sed -i 's|^ # socket.*| socket: /var/run/redis/redis.sock|' /home/git/gitlab-shell/config.yml - -## 6. Update gitlab-shell - -```bash -cd /home/git/gitlab-shell -sudo -u git -H git fetch -sudo -u git -H git checkout v2.6.3 -``` - -## 7. Install libs, migrations, etc. - -```bash -cd /home/git/gitlab - -# MySQL installations (note: the line below states '--without ... postgres') -sudo -u git -H bundle install --without development test postgres --deployment - -# PostgreSQL installations (note: the line below states '--without ... mysql') -sudo -u git -H bundle install --without development test mysql --deployment - -# Run database migrations -sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production - -# Enable internal issue IDs (introduced in GitLab 6.1) -sudo -u git -H bundle exec rake migrate_iids RAILS_ENV=production - -# Clean up assets and cache -sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production - -# Close access to gitlab-satellites for others -sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites - -# Update init.d script -sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab -``` - -## 8. Update config files - -TIP: to see what changed in `gitlab.yml.example` in this release use next command: - -``` -git diff 6-0-stable:config/gitlab.yml.example 7-12-stable:config/gitlab.yml.example -``` - -* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-12-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-12-stable/config/unicorn.rb.example but with your settings. -* Make `/home/git/gitlab-shell/config.yml` the same as https://gitlab.com/gitlab-org/gitlab-shell/blob/v2.6.0/config.yml.example but with your settings. -* Copy rack attack middleware config - -```bash -sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb -``` - -* Set up logrotate - -```bash -sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab -``` - -### Change Nginx settings - -* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-12-stable/lib/support/nginx/gitlab but with your settings. -* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-12-stable/lib/support/nginx/gitlab-ssl but with your settings. -* A new `location /uploads/` section has been added that needs to have the same content as the existing `location @gitlab` section. - -### Check the version of /usr/local/bin/git - -If you installed Git from source into /usr/local/bin/git then please [check -your version](7.11-to-7.12.md). - -## 9. Start application - - sudo service gitlab start - sudo service nginx restart - -## 10. Check application status - -Check if GitLab and its environment are configured correctly: - - cd /home/git/gitlab - sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production - -To make sure you didn't miss anything run a more thorough check with: - - sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production - -If all items are green, then congratulations upgrade complete! - -## 11. Update OmniAuth configuration - -When using Google omniauth login, changes of the Google account required. -Ensure that `Contacts API` and the `Google+ API` are enabled in the [Google Developers Console](https://console.developers.google.com/). -More details can be found at the [integration documentation](../../../master/doc/integration/google.md). - -## 12. Optional optimizations for GitLab setups with MySQL databases - -Only applies if running MySQL database created with GitLab 6.7 or earlier. If you are not experiencing any issues you may not need the following instructions however following them will bring your database in line with the latest recommended installation configuration and help avoid future issues. Be sure to follow these directions exactly. These directions should be safe for any MySQL instance but to be sure make a current MySQL database backup beforehand. - -``` -# Stop GitLab -sudo service gitlab stop - -# Secure your MySQL installation (added in GitLab 6.2) -sudo mysql_secure_installation - -# Login to MySQL -mysql -u root -p - -# do not type the 'mysql>', this is part of the prompt - -# Convert all tables to use the InnoDB storage engine (added in GitLab 6.8) -SELECT CONCAT('ALTER TABLE gitlabhq_production.', table_name, ' ENGINE=InnoDB;') AS 'Copy & run these SQL statements:' FROM information_schema.tables WHERE table_schema = 'gitlabhq_production' AND `ENGINE` <> 'InnoDB' AND `TABLE_TYPE` = 'BASE TABLE'; - -# If previous query returned results, copy & run all shown SQL statements - -# Convert all tables to correct character set -SET foreign_key_checks = 0; -SELECT CONCAT('ALTER TABLE gitlabhq_production.', table_name, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;') AS 'Copy & run these SQL statements:' FROM information_schema.tables WHERE table_schema = 'gitlabhq_production' AND `TABLE_COLLATION` <> 'utf8_unicode_ci' AND `TABLE_TYPE` = 'BASE TABLE'; - -# If previous query returned results, copy & run all shown SQL statements - -# turn foreign key checks back on -SET foreign_key_checks = 1; - -# Find MySQL users -mysql> SELECT user FROM mysql.user WHERE user LIKE '%git%'; - -# If git user exists and gitlab user does not exist -# you are done with the database cleanup tasks -mysql> \q - -# If both users exist skip to Delete gitlab user - -# Create new user for GitLab (changed in GitLab 6.4) -# change $password in the command below to a real password you pick -mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password'; - -# Grant the git user necessary permissions on the database -mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'git'@'localhost'; - -# Delete the old gitlab user -mysql> DELETE FROM mysql.user WHERE user='gitlab'; - -# Quit the database session -mysql> \q - -# Try connecting to the new database with the new user -sudo -u git -H mysql -u git -p -D gitlabhq_production - -# Type the password you replaced $password with earlier - -# You should now see a 'mysql>' prompt - -# Quit the database session -mysql> \q - -# Update database configuration details -# See config/database.yml.mysql for latest recommended configuration details -# Remove the reaping_frequency setting line if it exists (removed in GitLab 6.8) -# Set production -> pool: 10 (updated in GitLab 5.3) -# Set production -> username: git -# Set production -> password: the password your replaced $password with earlier -sudo -u git -H editor /home/git/gitlab/config/database.yml -``` - -## Things went south? Revert to previous version (7.0) - -### 1. Revert the code to the previous version - -Follow the [upgrade guide from 6.9 to 7.0](6.9-to-7.0.md), except for the database migration (the backup is already migrated to the previous version). - -### 2. Restore from the backup: - -```bash -cd /home/git/gitlab -sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production -``` - -## Login issues after upgrade? - -If running in HTTPS mode, be sure to read [Can't Verify CSRF token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page) diff --git a/doc/update/6.x-or-7.x-to-7.13.md b/doc/update/6.x-or-7.x-to-7.13.md new file mode 100644 index 00000000000..3e3ceb1194c --- /dev/null +++ b/doc/update/6.x-or-7.x-to-7.13.md @@ -0,0 +1,304 @@ +# From 6.x or 7.x to 7.13 +*Make sure you view this [upgrade guide from the `master` branch](../../../master/doc/update/6.x-or-7.x-to-7.13.md) for the most up to date instructions.* + +This allows you to upgrade any version of GitLab from 6.0 and up (including 7.0 and up) to 7.13. + +## Global issue numbers + +As of 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their URL. If you use an old issue number URL and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects. + +## Editable labels + +In GitLab 7.2 we replace Issue and Merge Request tags with labels, making it +possible to edit the label text and color. The characters `?`, `&` and `,` are +no longer allowed however so those will be removed from your tags during the +database migrations for GitLab 7.2. + +## 0. Stop server + + sudo service gitlab stop + +## 1. Backup + +It's useful to make a backup just in case things go south: +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +## 2. Update Ruby + +If you are still using Ruby 1.9.3 or below, you will need to update Ruby. +You can check which version you are running with `ruby -v`. + +If you are you running Ruby 2.0.x, you do not need to upgrade ruby, but can consider doing so for performance reasons. + +If you are running Ruby 2.1.1 consider upgrading to 2.1.6, because of the high memory usage of Ruby 2.1.1. + +Install, update dependencies: + +```bash +sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl +``` + +Download and compile Ruby: + +```bash +mkdir /tmp/ruby && cd /tmp/ruby +curl --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz | tar xz +cd ruby-2.1.6 +./configure --disable-install-rdoc +make +sudo make install +``` + +Install Bundler: + +```bash +sudo gem install bundler --no-ri --no-rdoc +``` + +## 3. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch --all +sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically +``` + +For GitLab Community Edition: + +```bash +sudo -u git -H git checkout 7-13-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +sudo -u git -H git checkout 7-13-stable-ee +``` + +## 4. Install additional packages + +```bash +# Add support for logrotate for better log file handling +sudo apt-get install logrotate + +# Install pkg-config and cmake, which is needed for the latest versions of rugged +sudo apt-get install pkg-config cmake + +# If you want to use Kerberos with GitLab EE for user authentication, install Kerberos header files +# If you don't know what Kerberos is, you can assume you don't need it. +sudo apt-get install libkrb5-dev + +# Install nodejs, javascript runtime required for assets +sudo apt-get install nodejs +``` + +## 5. Configure Redis to use sockets + + # Configure redis to use sockets + sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig + # Disable Redis listening on TCP by setting 'port' to 0 + sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf + # Enable Redis socket for default Debian / Ubuntu path + echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf + # Be sure redis group can write to the socket, enable only if supported (>= redis 2.4.0). + sudo sed -i '/# unixsocketperm/ s/^# unixsocketperm.*/unixsocketperm 0775/' /etc/redis/redis.conf + # Activate the changes to redis.conf + sudo service redis-server restart + # Add git to the redis group + sudo usermod -aG redis git + + # Configure Redis connection settings + sudo -u git -H cp config/resque.yml.example config/resque.yml + # Change the Redis socket path if you are not using the default Debian / Ubuntu configuration + sudo -u git -H editor config/resque.yml + + # Configure gitlab-shell to use Redis sockets + sudo -u git -H sed -i 's|^ # socket.*| socket: /var/run/redis/redis.sock|' /home/git/gitlab-shell/config.yml + +## 6. Update gitlab-shell + +```bash +cd /home/git/gitlab-shell +sudo -u git -H git fetch +sudo -u git -H git checkout v2.6.3 +``` + +## 7. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL installations (note: the line below states '--without ... postgres') +sudo -u git -H bundle install --without development test postgres --deployment + +# PostgreSQL installations (note: the line below states '--without ... mysql') +sudo -u git -H bundle install --without development test mysql --deployment + +# Run database migrations +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production + +# Enable internal issue IDs (introduced in GitLab 6.1) +sudo -u git -H bundle exec rake migrate_iids RAILS_ENV=production + +# Clean up assets and cache +sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production + +# Close access to gitlab-satellites for others +sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites + +# Update init.d script +sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab +``` + +## 8. Update config files + +TIP: to see what changed in `gitlab.yml.example` in this release use next command: + +``` +git diff 6-0-stable:config/gitlab.yml.example 7-13-stable:config/gitlab.yml.example +``` + +* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-13-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-13-stable/config/unicorn.rb.example but with your settings. +* Make `/home/git/gitlab-shell/config.yml` the same as https://gitlab.com/gitlab-org/gitlab-shell/blob/v2.6.0/config.yml.example but with your settings. +* Copy rack attack middleware config + +```bash +sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb +``` + +* Set up logrotate + +```bash +sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab +``` + +### Change Nginx settings + +* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-13-stable/lib/support/nginx/gitlab but with your settings. +* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-13-stable/lib/support/nginx/gitlab-ssl but with your settings. +* A new `location /uploads/` section has been added that needs to have the same content as the existing `location @gitlab` section. + +### Check the version of /usr/local/bin/git + +If you installed Git from source into /usr/local/bin/git then please [check +your version](7.12-to-7.13.md). + +## 9. Start application + + sudo service gitlab start + sudo service nginx restart + +## 10. Check application status + +Check if GitLab and its environment are configured correctly: + + cd /home/git/gitlab + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations upgrade complete! + +## 11. Update OmniAuth configuration + +When using Google omniauth login, changes of the Google account required. +Ensure that `Contacts API` and the `Google+ API` are enabled in the [Google Developers Console](https://console.developers.google.com/). +More details can be found at the [integration documentation](../../../master/doc/integration/google.md). + +## 12. Optional optimizations for GitLab setups with MySQL databases + +Only applies if running MySQL database created with GitLab 6.7 or earlier. If you are not experiencing any issues you may not need the following instructions however following them will bring your database in line with the latest recommended installation configuration and help avoid future issues. Be sure to follow these directions exactly. These directions should be safe for any MySQL instance but to be sure make a current MySQL database backup beforehand. + +``` +# Stop GitLab +sudo service gitlab stop + +# Secure your MySQL installation (added in GitLab 6.2) +sudo mysql_secure_installation + +# Login to MySQL +mysql -u root -p + +# do not type the 'mysql>', this is part of the prompt + +# Convert all tables to use the InnoDB storage engine (added in GitLab 6.8) +SELECT CONCAT('ALTER TABLE gitlabhq_production.', table_name, ' ENGINE=InnoDB;') AS 'Copy & run these SQL statements:' FROM information_schema.tables WHERE table_schema = 'gitlabhq_production' AND `ENGINE` <> 'InnoDB' AND `TABLE_TYPE` = 'BASE TABLE'; + +# If previous query returned results, copy & run all shown SQL statements + +# Convert all tables to correct character set +SET foreign_key_checks = 0; +SELECT CONCAT('ALTER TABLE gitlabhq_production.', table_name, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;') AS 'Copy & run these SQL statements:' FROM information_schema.tables WHERE table_schema = 'gitlabhq_production' AND `TABLE_COLLATION` <> 'utf8_unicode_ci' AND `TABLE_TYPE` = 'BASE TABLE'; + +# If previous query returned results, copy & run all shown SQL statements + +# turn foreign key checks back on +SET foreign_key_checks = 1; + +# Find MySQL users +mysql> SELECT user FROM mysql.user WHERE user LIKE '%git%'; + +# If git user exists and gitlab user does not exist +# you are done with the database cleanup tasks +mysql> \q + +# If both users exist skip to Delete gitlab user + +# Create new user for GitLab (changed in GitLab 6.4) +# change $password in the command below to a real password you pick +mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password'; + +# Grant the git user necessary permissions on the database +mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'git'@'localhost'; + +# Delete the old gitlab user +mysql> DELETE FROM mysql.user WHERE user='gitlab'; + +# Quit the database session +mysql> \q + +# Try connecting to the new database with the new user +sudo -u git -H mysql -u git -p -D gitlabhq_production + +# Type the password you replaced $password with earlier + +# You should now see a 'mysql>' prompt + +# Quit the database session +mysql> \q + +# Update database configuration details +# See config/database.yml.mysql for latest recommended configuration details +# Remove the reaping_frequency setting line if it exists (removed in GitLab 6.8) +# Set production -> pool: 10 (updated in GitLab 5.3) +# Set production -> username: git +# Set production -> password: the password your replaced $password with earlier +sudo -u git -H editor /home/git/gitlab/config/database.yml +``` + +## Things went south? Revert to previous version (7.0) + +### 1. Revert the code to the previous version + +Follow the [upgrade guide from 6.9 to 7.0](6.9-to-7.0.md), except for the database migration (the backup is already migrated to the previous version). + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production +``` + +## Login issues after upgrade? + +If running in HTTPS mode, be sure to read [Can't Verify CSRF token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page) diff --git a/doc/update/7.12-to-7.13.md b/doc/update/7.12-to-7.13.md new file mode 100644 index 00000000000..57ebe3261b6 --- /dev/null +++ b/doc/update/7.12-to-7.13.md @@ -0,0 +1,129 @@ +# From 7.12 to 7.13 + +### 0. Double-check your Git version + +**This notice applies only to /usr/local/bin/git** + +If you compiled Git from source on your GitLab server then please double-check +that you are using a version that protects against CVE-2014-9390. For six +months after this vulnerability became known the GitLab installation guide +still contained instructions that would install the outdated, 'vulnerable' Git +version 2.1.2. + +Run the following command to get your current Git version. + +``` +/usr/local/bin/git --version +``` + +If you see 'No such file or directory' then you did not install Git according +to the outdated instructions from the GitLab installation guide and you can go +to the next step 'Stop server' below. + +If you see a version string then it should be v1.8.5.6, v1.9.5, v2.0.5, v2.1.4, +v2.2.1 or newer. You can use the [instructions in the GitLab source +installation +guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies) +to install a newer version of Git. + +### 1. Stop server + + sudo service gitlab stop + +### 2. Backup + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +### 3. Get latest code + +```bash +sudo -u git -H git fetch --all +sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically +``` + +For GitLab Community Edition: + +```bash +sudo -u git -H git checkout 7-13-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +sudo -u git -H git checkout 7-13-stable-ee +``` + +### 4. Update gitlab-shell + +```bash +cd /home/git/gitlab-shell +sudo -u git -H git fetch +sudo -u git -H git checkout v2.6.3 +``` + +### 5. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL installations (note: the line below states '--without ... postgres') +sudo -u git -H bundle install --without development test postgres --deployment + +# PostgreSQL installations (note: the line below states '--without ... mysql') +sudo -u git -H bundle install --without development test mysql --deployment + +# Run database migrations +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production + +# Clean up assets and cache +sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production + +# Update init.d script +sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab +``` + +### 6. Update config files + +#### New configuration options for `gitlab.yml` + +There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example). View them with the command below and apply them to your current `gitlab.yml`. + +``` +git diff origin/7-12-stable:config/gitlab.yml.example origin/7-13-stable:config/gitlab.yml.example +`````` + +### 7. Start application + + sudo service gitlab start + sudo service nginx restart + +### 8. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations, the upgrade is complete! + +## Things went south? Revert to previous version (7.12) + +### 1. Revert the code to the previous version +Follow the [upgrade guide from 7.11 to 7.12](7.11-to-7.12.md), except for the database migration +(The backup is already migrated to the previous version) + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production +``` +If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. -- cgit v1.2.1 From e26e46db2c8a3ed5254428b1406bd60719d4ba23 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 14 Jul 2015 11:50:01 +0200 Subject: Fix path to move_drop_indexes.ed --- doc/update/mysql_to_postgresql.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 6f89f9eda79..26605c7c3a3 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -57,7 +57,7 @@ sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter. # Convert gitlabhq_production.mysql sudo -u git -H mkdir db sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql -sudo -u git -H ed -s db/database.sql < move_drop_indexes.ed +sudo -u git -H ed -s db/database.sql < mysql-postgresql-converter/move_drop_indexes.ed # Compress database backup sudo -u git -H gzip db/database.sql -- cgit v1.2.1 From 2def2cc60abeeb22c1f77e93b7c437ddcf7aa68c Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 14 Jul 2015 12:02:42 +0200 Subject: Hide scrollbar from sidebar when external mouse is connected to OSX --- app/assets/stylesheets/generic/sidebar.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss index 4e9daa5ea34..b96664d30db 100644 --- a/app/assets/stylesheets/generic/sidebar.scss +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -3,7 +3,8 @@ position: fixed; top: 0; bottom: 0; - overflow-y: scroll; + overflow-y: auto; + overflow-x: hidden; left: 0; height: 100%; transition-duration: .3s; -- cgit v1.2.1 From 98cb6256faddf1dc862b38e8943bb25734d03e93 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 14 Jul 2015 12:29:57 +0200 Subject: Add nice scroll for sidebar Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/application.js.coffee | 3 + app/assets/stylesheets/themes/gitlab-theme.scss | 1 - app/views/layouts/_page.html.haml | 2 +- vendor/assets/javascripts/jquery.nicescroll.min.js | 118 +++++++++++++++++++++ 4 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 vendor/assets/javascripts/jquery.nicescroll.min.js diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index bb120424ccf..8b041c490d8 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -40,6 +40,7 @@ #= require shortcuts_issuable #= require shortcuts_network #= require cal-heatmap +#= require jquery.nicescroll.min #= require_tree . window.slugify = (text) -> @@ -104,6 +105,8 @@ if location.hash window.addEventListener "hashchange", shiftWindow $ -> + $(".nicescroll").niceScroll(cursoropacitymax: '0.4', cursorcolor: '#FFF', cursorborder: "1px solid #FFF") + # Click a .js-select-on-focus field, select the contents $(".js-select-on-focus").on "focusin", -> # Prevent a mouseup event from deselecting the input diff --git a/app/assets/stylesheets/themes/gitlab-theme.scss b/app/assets/stylesheets/themes/gitlab-theme.scss index e5325bbdc74..3589cb88d03 100644 --- a/app/assets/stylesheets/themes/gitlab-theme.scss +++ b/app/assets/stylesheets/themes/gitlab-theme.scss @@ -35,7 +35,6 @@ .sidebar-wrapper { background: $color-darker; - border-right: 1px solid $color-darker; .sidebar-user { background: $color-darker; diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index f17f6fdd91c..96e15783a36 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,6 +1,6 @@ .page-with-sidebar{ class: nav_sidebar_class } = render "layouts/broadcast" - .sidebar-wrapper + .sidebar-wrapper.nicescroll - if defined?(sidebar) && sidebar = render "layouts/nav/#{sidebar}" - elsif current_user diff --git a/vendor/assets/javascripts/jquery.nicescroll.min.js b/vendor/assets/javascripts/jquery.nicescroll.min.js new file mode 100644 index 00000000000..5440b6a0da0 --- /dev/null +++ b/vendor/assets/javascripts/jquery.nicescroll.min.js @@ -0,0 +1,118 @@ +/* jquery.nicescroll 3.6.0 InuYaksa*2014 MIT http://nicescroll.areaaperta.com */(function(f){"function"===typeof define&&define.amd?define(["jquery"],f):f(jQuery)})(function(f){var y=!1,D=!1,N=0,O=2E3,x=0,H=["webkit","ms","moz","o"],s=window.requestAnimationFrame||!1,t=window.cancelAnimationFrame||!1;if(!s)for(var P in H){var E=H[P];s||(s=window[E+"RequestAnimationFrame"]);t||(t=window[E+"CancelAnimationFrame"]||window[E+"CancelRequestAnimationFrame"])}var v=window.MutationObserver||window.WebKitMutationObserver||!1,I={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242", +cursorwidth:"5px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom", +enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var f=document.getElementsByTagName("script"),f=f[f.length-1].src.split("?")[0];return 0d?a.getScrollLeft()>=a.page.maxw:0>=a.getScrollLeft())&&(e=d,d=0));d&&(a.scrollmom&&a.scrollmom.stop(),a.lastdeltax+=d,a.debounced("mousewheelx",function(){var b=a.lastdeltax;a.lastdeltax=0;a.rail.drag||a.doScrollLeftBy(b)},15));if(e){if(a.opt.nativeparentscrolling&&c&&!a.ispage&&!a.zoomactive)if(0>e){if(a.getScrollTop()>=a.page.maxh)return!0}else if(0>=a.getScrollTop())return!0;a.scrollmom&&a.scrollmom.stop();a.lastdeltay+=e;a.debounced("mousewheely", +function(){var b=a.lastdeltay;a.lastdeltay=0;a.rail.drag||a.doScrollBy(b)},15)}b.stopImmediatePropagation();return b.preventDefault()}var a=this;this.version="3.6.0";this.name="nicescroll";this.me=c;this.opt={doc:f("body"),win:!1};f.extend(this.opt,I);this.opt.snapbackspeed=80;if(k)for(var G in a.opt)"undefined"!=typeof k[G]&&(a.opt[G]=k[G]);this.iddoc=(this.doc=a.opt.doc)&&this.doc[0]?this.doc[0].id||"":"";this.ispage=/^BODY|HTML/.test(a.opt.win?a.opt.win[0].nodeName:this.doc[0].nodeName);this.haswrapper= +!1!==a.opt.win;this.win=a.opt.win||(this.ispage?f(window):this.doc);this.docscroll=this.ispage&&!this.haswrapper?f(window):this.win;this.body=f("body");this.iframe=this.isfixed=this.viewport=!1;this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName;this.istextarea="TEXTAREA"==this.win[0].nodeName;this.forcescreen=!1;this.canshowonmouseevent="scroll"!=a.opt.autohidemode;this.page=this.view=this.onzoomout=this.onzoomin=this.onscrollcancel=this.onscrollend=this.onscrollstart=this.onclick= +this.ongesturezoom=this.onkeypress=this.onmousewheel=this.onmousemove=this.onmouseup=this.onmousedown=!1;this.scroll={x:0,y:0};this.scrollratio={x:0,y:0};this.cursorheight=20;this.scrollvaluemax=0;this.isrtlmode="auto"==this.opt.rtlmode?"rtl"==(this.win[0]==window?this.body:this.win).css("direction"):!0===this.opt.rtlmode;this.observerbody=this.observerremover=this.observer=this.scrollmom=this.scrollrunning=!1;do this.id="ascrail"+O++;while(document.getElementById(this.id));this.hasmousefocus=this.hasfocus= +this.zoomactive=this.zoom=this.selectiondrag=this.cursorfreezed=this.cursor=this.rail=!1;this.visibility=!0;this.hidden=this.locked=this.railslocked=!1;this.cursoractive=!0;this.wheelprevented=!1;this.overflowx=a.opt.overflowx;this.overflowy=a.opt.overflowy;this.nativescrollingarea=!1;this.checkarea=0;this.events=[];this.saved={};this.delaylist={};this.synclist={};this.lastdeltay=this.lastdeltax=0;this.detected=Q();var e=f.extend({},this.detected);this.ishwscroll=(this.canhwscroll=e.hastransform&& +a.opt.hwacceleration)&&a.haswrapper;this.hasreversehr=this.isrtlmode&&!e.iswebkit;this.istouchcapable=!1;!e.cantouch||e.isios||e.isandroid||!e.iswebkit&&!e.ismozilla||(this.istouchcapable=!0,e.cantouch=!1);a.opt.enablemouselockapi||(e.hasmousecapture=!1,e.haspointerlock=!1);this.debounced=function(b,g,c){var d=a.delaylist[b];a.delaylist[b]=g;d||setTimeout(function(){var g=a.delaylist[b];a.delaylist[b]=!1;g.call(a)},c)};var r=!1;this.synched=function(b,g){a.synclist[b]=g;(function(){r||(s(function(){r= +!1;for(var b in a.synclist){var g=a.synclist[b];g&&g.call(a);a.synclist[b]=!1}}),r=!0)})();return b};this.unsynched=function(b){a.synclist[b]&&(a.synclist[b]=!1)};this.css=function(b,g){for(var c in g)a.saved.css.push([b,c,b.css(c)]),b.css(c,g[c])};this.scrollTop=function(b){return"undefined"==typeof b?a.getScrollTop():a.setScrollTop(b)};this.scrollLeft=function(b){return"undefined"==typeof b?a.getScrollLeft():a.setScrollLeft(b)};var A=function(a,g,c,d,e,f,h){this.st=a;this.ed=g;this.spd=c;this.p1= +d||0;this.p2=e||1;this.p3=f||0;this.p4=h||1;this.ts=(new Date).getTime();this.df=this.ed-this.st};A.prototype={B2:function(a){return 3*a*a*(1-a)},B3:function(a){return 3*a*(1-a)*(1-a)},B4:function(a){return(1-a)*(1-a)*(1-a)},getNow:function(){var a=1-((new Date).getTime()-this.ts)/this.spd,g=this.B2(a)+this.B3(a)+this.B4(a);return 0>a?this.ed:this.st+Math.round(this.df*g)},update:function(a,g){this.st=this.getNow();this.ed=a;this.spd=g;this.ts=(new Date).getTime();this.df=this.ed-this.st;return this}}; +if(this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"};e.hastranslate3d&&e.isios&&this.doc.css("-webkit-backface-visibility","hidden");this.getScrollTop=function(b){if(!b){if(b=h())return 16==b.length?-b[13]:-b[5];if(a.timerscroll&&a.timerscroll.bz)return a.timerscroll.bz.getNow()}return a.doc.translate.y};this.getScrollLeft=function(b){if(!b){if(b=h())return 16==b.length?-b[12]:-b[4];if(a.timerscroll&&a.timerscroll.bh)return a.timerscroll.bh.getNow()}return a.doc.translate.x};this.notifyScrollEvent= +function(a){var g=document.createEvent("UIEvents");g.initUIEvent("scroll",!1,!0,window,1);g.niceevent=!0;a.dispatchEvent(g)};var K=this.isrtlmode?1:-1;e.hastranslate3d&&a.opt.enabletranslate3d?(this.setScrollTop=function(b,g){a.doc.translate.y=b;a.doc.translate.ty=-1*b+"px";a.doc.css(e.trstyle,"translate3d("+a.doc.translate.tx+","+a.doc.translate.ty+",0px)");g||a.notifyScrollEvent(a.win[0])},this.setScrollLeft=function(b,g){a.doc.translate.x=b;a.doc.translate.tx=b*K+"px";a.doc.css(e.trstyle,"translate3d("+ +a.doc.translate.tx+","+a.doc.translate.ty+",0px)");g||a.notifyScrollEvent(a.win[0])}):(this.setScrollTop=function(b,g){a.doc.translate.y=b;a.doc.translate.ty=-1*b+"px";a.doc.css(e.trstyle,"translate("+a.doc.translate.tx+","+a.doc.translate.ty+")");g||a.notifyScrollEvent(a.win[0])},this.setScrollLeft=function(b,g){a.doc.translate.x=b;a.doc.translate.tx=b*K+"px";a.doc.css(e.trstyle,"translate("+a.doc.translate.tx+","+a.doc.translate.ty+")");g||a.notifyScrollEvent(a.win[0])})}else this.getScrollTop= +function(){return a.docscroll.scrollTop()},this.setScrollTop=function(b){return a.docscroll.scrollTop(b)},this.getScrollLeft=function(){return a.detected.ismozilla&&a.isrtlmode?Math.abs(a.docscroll.scrollLeft()):a.docscroll.scrollLeft()},this.setScrollLeft=function(b){return a.docscroll.scrollLeft(a.detected.ismozilla&&a.isrtlmode?-b:b)};this.getTarget=function(a){return a?a.target?a.target:a.srcElement?a.srcElement:!1:!1};this.hasParent=function(a,g){if(!a)return!1;for(var c=a.target||a.srcElement|| +a||!1;c&&c.id!=g;)c=c.parentNode||!1;return!1!==c};var w={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||document.documentElement.scrollTop,left:window.pageXOffset||document.documentElement.scrollLeft}};this.getOffset=function(){if(a.isfixed){var b=a.win.offset(),g=a.getDocumentScrollOffset();b.top-=g.top;b.left-=g.left;return b}b=a.win.offset();if(!a.viewport)return b;g=a.viewport.offset();return{top:b.top-g.top,left:b.left-g.left}};this.updateScrollBar= +function(b){if(a.ishwscroll)a.rail.css({height:a.win.innerHeight()-(a.opt.railpadding.top+a.opt.railpadding.bottom)}),a.railh&&a.railh.css({width:a.win.innerWidth()-(a.opt.railpadding.left+a.opt.railpadding.right)});else{var g=a.getOffset(),c=g.top,e=g.left-(a.opt.railpadding.left+a.opt.railpadding.right),c=c+d(a.win,"border-top-width",!0),e=e+(a.rail.align?a.win.outerWidth()-d(a.win,"border-right-width")-a.rail.width:d(a.win,"border-left-width")),f=a.opt.railoffset;f&&(f.top&&(c+=f.top),a.rail.align&& +f.left&&(e+=f.left));a.railslocked||a.rail.css({top:c,left:e,height:(b?b.h:a.win.innerHeight())-(a.opt.railpadding.top+a.opt.railpadding.bottom)});a.zoom&&a.zoom.css({top:c+1,left:1==a.rail.align?e-20:e+a.rail.width+4});if(a.railh&&!a.railslocked){c=g.top;e=g.left;if(f=a.opt.railhoffset)f.top&&(c+=f.top),f.left&&(e+=f.left);b=a.railh.align?c+d(a.win,"border-top-width",!0)+a.win.innerHeight()-a.railh.height:c+d(a.win,"border-top-width",!0);e+=d(a.win,"border-left-width");a.railh.css({top:b-(a.opt.railpadding.top+ +a.opt.railpadding.bottom),left:e,width:a.railh.width})}}};this.doRailClick=function(b,g,c){var e;a.railslocked||(a.cancelEvent(b),g?(g=c?a.doScrollLeft:a.doScrollTop,e=c?(b.pageX-a.railh.offset().left-a.cursorwidth/2)*a.scrollratio.x:(b.pageY-a.rail.offset().top-a.cursorheight/2)*a.scrollratio.y,g(e)):(g=c?a.doScrollLeftBy:a.doScrollBy,e=c?a.scroll.x:a.scroll.y,b=c?b.pageX-a.railh.offset().left:b.pageY-a.rail.offset().top,c=c?a.view.w:a.view.h,g(e>=b?c:-c)))};a.hasanimationframe=s;a.hascancelanimationframe= +t;a.hasanimationframe?a.hascancelanimationframe||(t=function(){a.cancelAnimationFrame=!0}):(s=function(a){return setTimeout(a,15-Math.floor(+new Date/1E3)%16)},t=clearInterval);this.init=function(){a.saved.css=[];if(e.isie7mobile||e.isoperamini)return!0;e.hasmstouch&&a.css(a.ispage?f("html"):a.win,{"-ms-touch-action":"none"});a.zindex="auto";a.zindex=a.ispage||"auto"!=a.opt.zindex?a.opt.zindex:m()||"auto";!a.ispage&&"auto"!=a.zindex&&a.zindex>x&&(x=a.zindex);a.isie&&0==a.zindex&&"auto"==a.opt.zindex&& +(a.zindex="auto");if(!a.ispage||!e.cantouch&&!e.isieold&&!e.isie9mobile){var b=a.docscroll;a.ispage&&(b=a.haswrapper?a.win:a.doc);e.isie9mobile||a.css(b,{"overflow-y":"hidden"});a.ispage&&e.isie7&&("BODY"==a.doc[0].nodeName?a.css(f("html"),{"overflow-y":"hidden"}):"HTML"==a.doc[0].nodeName&&a.css(f("body"),{"overflow-y":"hidden"}));!e.isios||a.ispage||a.haswrapper||a.css(f("body"),{"-webkit-overflow-scrolling":"touch"});var g=f(document.createElement("div"));g.css({position:"relative",top:0,"float":"right", +width:a.opt.cursorwidth,height:"0px","background-color":a.opt.cursorcolor,border:a.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":a.opt.cursorborderradius,"-moz-border-radius":a.opt.cursorborderradius,"border-radius":a.opt.cursorborderradius});g.hborder=parseFloat(g.outerHeight()-g.innerHeight());g.addClass("nicescroll-cursors");a.cursor=g;var c=f(document.createElement("div"));c.attr("id",a.id);c.addClass("nicescroll-rails nicescroll-rails-vr");var d,h,k=["left","right", +"top","bottom"],J;for(J in k)h=k[J],(d=a.opt.railpadding[h])?c.css("padding-"+h,d+"px"):a.opt.railpadding[h]=0;c.append(g);c.width=Math.max(parseFloat(a.opt.cursorwidth),g.outerWidth());c.css({width:c.width+"px",zIndex:a.zindex,background:a.opt.background,cursor:"default"});c.visibility=!0;c.scrollable=!0;c.align="left"==a.opt.railalign?0:1;a.rail=c;g=a.rail.drag=!1;!a.opt.boxzoom||a.ispage||e.isieold||(g=document.createElement("div"),a.bind(g,"click",a.doZoom),a.bind(g,"mouseenter",function(){a.zoom.css("opacity", +a.opt.cursoropacitymax)}),a.bind(g,"mouseleave",function(){a.zoom.css("opacity",a.opt.cursoropacitymin)}),a.zoom=f(g),a.zoom.css({cursor:"pointer","z-index":a.zindex,backgroundImage:"url("+a.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),a.opt.dblclickzoom&&a.bind(a.win,"dblclick",a.doZoom),e.cantouch&&a.opt.gesturezoom&&(a.ongesturezoom=function(b){1.5b.scale&&a.doZoomOut(b);return a.cancelEvent(b)},a.bind(a.win,"gestureend",a.ongesturezoom))); +a.railh=!1;var l;a.opt.horizrailenabled&&(a.css(b,{"overflow-x":"hidden"}),g=f(document.createElement("div")),g.css({position:"absolute",top:0,height:a.opt.cursorwidth,width:"0px","background-color":a.opt.cursorcolor,border:a.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":a.opt.cursorborderradius,"-moz-border-radius":a.opt.cursorborderradius,"border-radius":a.opt.cursorborderradius}),e.isieold&&g.css({overflow:"hidden"}),g.wborder=parseFloat(g.outerWidth()-g.innerWidth()), +g.addClass("nicescroll-cursors"),a.cursorh=g,l=f(document.createElement("div")),l.attr("id",a.id+"-hr"),l.addClass("nicescroll-rails nicescroll-rails-hr"),l.height=Math.max(parseFloat(a.opt.cursorwidth),g.outerHeight()),l.css({height:l.height+"px",zIndex:a.zindex,background:a.opt.background}),l.append(g),l.visibility=!0,l.scrollable=!0,l.align="top"==a.opt.railvalign?0:1,a.railh=l,a.railh.drag=!1);a.ispage?(c.css({position:"fixed",top:"0px",height:"100%"}),c.align?c.css({right:"0px"}):c.css({left:"0px"}), +a.body.append(c),a.railh&&(l.css({position:"fixed",left:"0px",width:"100%"}),l.align?l.css({bottom:"0px"}):l.css({top:"0px"}),a.body.append(l))):(a.ishwscroll?("static"==a.win.css("position")&&a.css(a.win,{position:"relative"}),b="HTML"==a.win[0].nodeName?a.body:a.win,f(b).scrollTop(0).scrollLeft(0),a.zoom&&(a.zoom.css({position:"absolute",top:1,right:0,"margin-right":c.width+4}),b.append(a.zoom)),c.css({position:"absolute",top:0}),c.align?c.css({right:0}):c.css({left:0}),b.append(c),l&&(l.css({position:"absolute", +left:0,bottom:0}),l.align?l.css({bottom:0}):l.css({top:0}),b.append(l))):(a.isfixed="fixed"==a.win.css("position"),b=a.isfixed?"fixed":"absolute",a.isfixed||(a.viewport=a.getViewport(a.win[0])),a.viewport&&(a.body=a.viewport,0==/fixed|absolute/.test(a.viewport.css("position"))&&a.css(a.viewport,{position:"relative"})),c.css({position:b}),a.zoom&&a.zoom.css({position:b}),a.updateScrollBar(),a.body.append(c),a.zoom&&a.body.append(a.zoom),a.railh&&(l.css({position:b}),a.body.append(l))),e.isios&&a.css(a.win, +{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),e.isie&&a.opt.disableoutline&&a.win.attr("hideFocus","true"),e.iswebkit&&a.opt.disableoutline&&a.win.css({outline:"none"}));!1===a.opt.autohidemode?(a.autohidedom=!1,a.rail.css({opacity:a.opt.cursoropacitymax}),a.railh&&a.railh.css({opacity:a.opt.cursoropacitymax})):!0===a.opt.autohidemode||"leave"===a.opt.autohidemode?(a.autohidedom=f().add(a.rail),e.isie8&&(a.autohidedom=a.autohidedom.add(a.cursor)),a.railh&&(a.autohidedom= +a.autohidedom.add(a.railh)),a.railh&&e.isie8&&(a.autohidedom=a.autohidedom.add(a.cursorh))):"scroll"==a.opt.autohidemode?(a.autohidedom=f().add(a.rail),a.railh&&(a.autohidedom=a.autohidedom.add(a.railh))):"cursor"==a.opt.autohidemode?(a.autohidedom=f().add(a.cursor),a.railh&&(a.autohidedom=a.autohidedom.add(a.cursorh))):"hidden"==a.opt.autohidemode&&(a.autohidedom=!1,a.hide(),a.railslocked=!1);if(e.isie9mobile)a.scrollmom=new L(a),a.onmangotouch=function(){var b=a.getScrollTop(),c=a.getScrollLeft(); +if(b==a.scrollmom.lastscrolly&&c==a.scrollmom.lastscrollx)return!0;var g=b-a.mangotouch.sy,e=c-a.mangotouch.sx;if(0!=Math.round(Math.sqrt(Math.pow(e,2)+Math.pow(g,2)))){var d=0>g?-1:1,f=0>e?-1:1,q=+new Date;a.mangotouch.lazy&&clearTimeout(a.mangotouch.lazy);80k?k=Math.round(k/2):k>a.page.maxh&&(k=a.page.maxh+Math.round((k-a.page.maxh)/2)):(0>k&&(q=k=0),k>a.page.maxh&&(k=a.page.maxh,q=0));var l;a.railh&&a.railh.scrollable&&(l=a.isrtlmode?u-a.rail.drag.sl:a.rail.drag.sl-u,a.ishwscroll&&a.opt.bouncescroll?0>l?l=Math.round(l/2):l>a.page.maxw&&(l=a.page.maxw+Math.round((l-a.page.maxw)/2)):(0>l&&(h=l=0),l>a.page.maxw&&(l=a.page.maxw,h=0)));g=!1;if(a.rail.drag.dl)g= +!0,"v"==a.rail.drag.dl?l=a.rail.drag.sl:"h"==a.rail.drag.dl&&(k=a.rail.drag.st);else{d=Math.abs(d);var u=Math.abs(u),z=a.opt.directionlockdeadzone;if("v"==a.rail.drag.ck){if(d>z&&u<=.3*d)return a.rail.drag=!1,!0;u>z&&(a.rail.drag.dl="f",f("body").scrollTop(f("body").scrollTop()))}else if("h"==a.rail.drag.ck){if(u>z&&d<=.3*u)return a.rail.drag=!1,!0;d>z&&(a.rail.drag.dl="f",f("body").scrollLeft(f("body").scrollLeft()))}}a.synched("touchmove",function(){a.rail.drag&&2==a.rail.drag.pt&&(a.prepareTransition&& +a.prepareTransition(0),a.rail.scrollable&&a.setScrollTop(k),a.scrollmom.update(h,q),a.railh&&a.railh.scrollable?(a.setScrollLeft(l),a.showCursor(k,l)):a.showCursor(k),e.isie10&&document.selection.clear())});e.ischrome&&a.istouchcapable&&(g=!1);if(g)return a.cancelEvent(b)}else if(1==a.rail.drag.pt)return a.onmousemove(b)}}a.onmousedown=function(b,c){if(!a.rail.drag||1==a.rail.drag.pt){if(a.railslocked)return a.cancelEvent(b);a.cancelScroll();a.rail.drag={x:b.clientX,y:b.clientY,sx:a.scroll.x,sy:a.scroll.y, +pt:1,hr:!!c};var g=a.getTarget(b);!a.ispage&&e.hasmousecapture&&g.setCapture();a.isiframe&&!e.hasmousecapture&&(a.saved.csspointerevents=a.doc.css("pointer-events"),a.css(a.doc,{"pointer-events":"none"}));a.hasmoving=!1;return a.cancelEvent(b)}};a.onmouseup=function(b){if(a.rail.drag){if(1!=a.rail.drag.pt)return!0;e.hasmousecapture&&document.releaseCapture();a.isiframe&&!e.hasmousecapture&&a.doc.css("pointer-events",a.saved.csspointerevents);a.rail.drag=!1;a.hasmoving&&a.triggerScrollEnd();return a.cancelEvent(b)}}; +a.onmousemove=function(b){if(a.rail.drag&&1==a.rail.drag.pt){if(e.ischrome&&0==b.which)return a.onmouseup(b);a.cursorfreezed=!0;a.hasmoving=!0;if(a.rail.drag.hr){a.scroll.x=a.rail.drag.sx+(b.clientX-a.rail.drag.x);0>a.scroll.x&&(a.scroll.x=0);var c=a.scrollvaluemaxw;a.scroll.x>c&&(a.scroll.x=c)}else a.scroll.y=a.rail.drag.sy+(b.clientY-a.rail.drag.y),0>a.scroll.y&&(a.scroll.y=0),c=a.scrollvaluemax,a.scroll.y>c&&(a.scroll.y=c);a.synched("mousemove",function(){a.rail.drag&&1==a.rail.drag.pt&&(a.showCursor(), +a.rail.drag.hr?a.hasreversehr?a.doScrollLeft(a.scrollvaluemaxw-Math.round(a.scroll.x*a.scrollratio.x),a.opt.cursordragspeed):a.doScrollLeft(Math.round(a.scroll.x*a.scrollratio.x),a.opt.cursordragspeed):a.doScrollTop(Math.round(a.scroll.y*a.scrollratio.y),a.opt.cursordragspeed))});return a.cancelEvent(b)}};if(e.cantouch||a.opt.touchbehavior)a.onpreventclick=function(b){if(a.preventclick)return a.preventclick.tg.onclick=a.preventclick.click,a.preventclick=!1,a.cancelEvent(b)},a.bind(a.win,"mousedown", +a.ontouchstart),a.onclick=e.isios?!1:function(b){return a.lastmouseup?(a.lastmouseup=!1,a.cancelEvent(b)):!0},a.opt.grabcursorenabled&&e.cursorgrabvalue&&(a.css(a.ispage?a.doc:a.win,{cursor:e.cursorgrabvalue}),a.css(a.rail,{cursor:e.cursorgrabvalue}));else{var p=function(b){if(a.selectiondrag){if(b){var c=a.win.outerHeight();b=b.pageY-a.selectiondrag.top;0=c&&(b-=c);a.selectiondrag.df=b}0!=a.selectiondrag.df&&(a.doScrollBy(2*-Math.floor(a.selectiondrag.df/6)),a.debounced("doselectionscroll", +function(){p()},50))}};a.hasTextSelected="getSelection"in document?function(){return 0a.page.maxh?a.doScrollTop(a.page.maxh):(a.scroll.y=Math.round(a.getScrollTop()*(1/a.scrollratio.y)),a.scroll.x=Math.round(a.getScrollLeft()*(1/a.scrollratio.x)),a.cursoractive&&a.noticeCursor());a.scroll.y&&0==a.getScrollTop()&&a.doScrollTo(Math.floor(a.scroll.y*a.scrollratio.y));return a};this.resize=a.onResize;this.lazyResize=function(b){b=isNaN(b)?30:b;a.debounced("resize",a.resize,b);return a};this.jqbind=function(b, +c,d){a.events.push({e:b,n:c,f:d,q:!0});f(b).bind(c,d)};this.bind=function(b,c,d,f){var h="jquery"in b?b[0]:b;"mousewheel"==c?window.addEventListener||"onwheel"in document?a._bind(h,"wheel",d,f||!1):(b="undefined"!=typeof document.onmousewheel?"mousewheel":"DOMMouseScroll",n(h,b,d,f||!1),"DOMMouseScroll"==b&&n(h,"MozMousePixelScroll",d,f||!1)):h.addEventListener?(e.cantouch&&/mouseup|mousedown|mousemove/.test(c)&&a._bind(h,"mousedown"==c?"touchstart":"mouseup"==c?"touchend":"touchmove",function(a){if(a.touches){if(2> +a.touches.length){var b=a.touches.length?a.touches[0]:a;b.original=a;d.call(this,b)}}else a.changedTouches&&(b=a.changedTouches[0],b.original=a,d.call(this,b))},f||!1),a._bind(h,c,d,f||!1),e.cantouch&&"mouseup"==c&&a._bind(h,"touchcancel",d,f||!1)):a._bind(h,c,function(b){(b=b||window.event||!1)&&b.srcElement&&(b.target=b.srcElement);"pageY"in b||(b.pageX=b.clientX+document.documentElement.scrollLeft,b.pageY=b.clientY+document.documentElement.scrollTop);return!1===d.call(h,b)||!1===f?a.cancelEvent(b): +!0})};e.haseventlistener?(this._bind=function(b,c,d,e){a.events.push({e:b,n:c,f:d,b:e,q:!1});b.addEventListener(c,d,e||!1)},this.cancelEvent=function(a){if(!a)return!1;a=a.original?a.original:a;a.preventDefault();a.stopPropagation();a.preventManipulation&&a.preventManipulation();return!1},this.stopPropagation=function(a){if(!a)return!1;a=a.original?a.original:a;a.stopPropagation();return!1},this._unbind=function(a,c,d,e){a.removeEventListener(c,d,e)}):(this._bind=function(b,c,d,e){a.events.push({e:b, +n:c,f:d,b:e,q:!1});b.attachEvent?b.attachEvent("on"+c,d):b["on"+c]=d},this.cancelEvent=function(a){a=window.event||!1;if(!a)return!1;a.cancelBubble=!0;a.cancel=!0;return a.returnValue=!1},this.stopPropagation=function(a){a=window.event||!1;if(!a)return!1;a.cancelBubble=!0;return!1},this._unbind=function(a,c,d,e){a.detachEvent?a.detachEvent("on"+c,d):a["on"+c]=!1});this.unbindAll=function(){for(var b=0;b(a.newscrolly- +f)*(c-f)||0>(a.newscrollx-h)*(b-h))&&a.cancelScroll();0==a.opt.bouncescroll&&(0>c?c=0:c>a.page.maxh&&(c=a.page.maxh),0>b?b=0:b>a.page.maxw&&(b=a.page.maxw));if(a.scrollrunning&&b==a.newscrollx&&c==a.newscrolly)return!1;a.newscrolly=c;a.newscrollx=b;a.newscrollspeed=d||!1;if(a.timer)return!1;a.timer=setTimeout(function(){var d=a.getScrollTop(),f=a.getScrollLeft(),h,k;h=b-f;k=c-d;h=Math.round(Math.sqrt(Math.pow(h,2)+Math.pow(k,2)));h=a.newscrollspeed&&1=a.newscrollspeed&&(h*=a.newscrollspeed);a.prepareTransition(h,!0);a.timerscroll&&a.timerscroll.tm&&clearInterval(a.timerscroll.tm);0b?b=0:b>a.page.maxh&&(b=a.page.maxh);0>c?c=0:c>a.page.maxw&&(c=a.page.maxw);if(b!=a.newscrolly||c!=a.newscrollx)return a.doScrollPos(c,b,a.opt.snapbackspeed);a.onscrollend&&a.scrollrunning&&a.triggerScrollEnd();a.scrollrunning=!1}):(this.doScrollLeft= +function(b,c){var d=a.scrollrunning?a.newscrolly:a.getScrollTop();a.doScrollPos(b,d,c)},this.doScrollTop=function(b,c){var d=a.scrollrunning?a.newscrollx:a.getScrollLeft();a.doScrollPos(d,b,c)},this.doScrollPos=function(b,c,d){function e(){if(a.cancelAnimationFrame)return!0;a.scrollrunning=!0;if(n=1-n)return a.timer=s(e)||1;var b=0,c,d,g=d=a.getScrollTop();if(a.dst.ay){g=a.bzscroll?a.dst.py+a.bzscroll.getNow()*a.dst.ay:a.newscrolly;c=g-d;if(0>c&&ga.newscrolly)g=a.newscrolly; +a.setScrollTop(g);g==a.newscrolly&&(b=1)}else b=1;d=c=a.getScrollLeft();if(a.dst.ax){d=a.bzscroll?a.dst.px+a.bzscroll.getNow()*a.dst.ax:a.newscrollx;c=d-c;if(0>c&&da.newscrollx)d=a.newscrollx;a.setScrollLeft(d);d==a.newscrollx&&(b+=1)}else b+=1;2==b?(a.timer=0,a.cursorfreezed=!1,a.bzscroll=!1,a.scrollrunning=!1,0>g?g=0:g>a.page.maxh&&(g=a.page.maxh),0>d?d=0:d>a.page.maxw&&(d=a.page.maxw),d!=a.newscrollx||g!=a.newscrolly?a.doScrollPos(d,g):a.onscrollend&&a.triggerScrollEnd()): +a.timer=s(e)||1}c="undefined"==typeof c||!1===c?a.getScrollTop(!0):c;if(a.timer&&a.newscrolly==c&&a.newscrollx==b)return!0;a.timer&&t(a.timer);a.timer=0;var f=a.getScrollTop(),h=a.getScrollLeft();(0>(a.newscrolly-f)*(c-f)||0>(a.newscrollx-h)*(b-h))&&a.cancelScroll();a.newscrolly=c;a.newscrollx=b;a.bouncescroll&&a.rail.visibility||(0>a.newscrolly?a.newscrolly=0:a.newscrolly>a.page.maxh&&(a.newscrolly=a.page.maxh));a.bouncescroll&&a.railh.visibility||(0>a.newscrollx?a.newscrollx=0:a.newscrollx>a.page.maxw&& +(a.newscrollx=a.page.maxw));a.dst={};a.dst.x=b-h;a.dst.y=c-f;a.dst.px=h;a.dst.py=f;var k=Math.round(Math.sqrt(Math.pow(a.dst.x,2)+Math.pow(a.dst.y,2)));a.dst.ax=a.dst.x/k;a.dst.ay=a.dst.y/k;var l=0,m=k;0==a.dst.x?(l=f,m=c,a.dst.ay=1,a.dst.py=0):0==a.dst.y&&(l=h,m=b,a.dst.ax=1,a.dst.px=0);k=a.getTransitionSpeed(k);d&&1>=d&&(k*=d);a.bzscroll=0=a.page.maxh||h==a.page.maxw&&b>=a.page.maxw)&&a.checkContentSize(); +var n=1;a.cancelAnimationFrame=!1;a.timer=1;a.onscrollstart&&!a.scrollrunning&&a.onscrollstart.call(a,{type:"scrollstart",current:{x:h,y:f},request:{x:b,y:c},end:{x:a.newscrollx,y:a.newscrolly},speed:k});e();(f==a.page.maxh&&c>=f||h==a.page.maxw&&b>=h)&&a.checkContentSize();a.noticeCursor()}},this.cancelScroll=function(){a.timer&&t(a.timer);a.timer=0;a.bzscroll=!1;a.scrollrunning=!1;return a}):(this.doScrollLeft=function(b,c){var d=a.getScrollTop();a.doScrollPos(b,d,c)},this.doScrollTop=function(b, +c){var d=a.getScrollLeft();a.doScrollPos(d,b,c)},this.doScrollPos=function(b,c,d){var e=b>a.page.maxw?a.page.maxw:b;0>e&&(e=0);var f=c>a.page.maxh?a.page.maxh:c;0>f&&(f=0);a.synched("scroll",function(){a.setScrollTop(f);a.setScrollLeft(e)})},this.cancelScroll=function(){});this.doScrollBy=function(b,c){var d=0,d=c?Math.floor((a.scroll.y-b)*a.scrollratio.y):(a.timer?a.newscrolly:a.getScrollTop(!0))-b;if(a.bouncescroll){var e=Math.round(a.view.h/2);d<-e?d=-e:d>a.page.maxh+e&&(d=a.page.maxh+e)}a.cursorfreezed= +!1;e=a.getScrollTop(!0);if(0>d&&0>=e)return a.noticeCursor();if(d>a.page.maxh&&e>=a.page.maxh)return a.checkContentSize(),a.noticeCursor();a.doScrollTop(d)};this.doScrollLeftBy=function(b,c){var d=0,d=c?Math.floor((a.scroll.x-b)*a.scrollratio.x):(a.timer?a.newscrollx:a.getScrollLeft(!0))-b;if(a.bouncescroll){var e=Math.round(a.view.w/2);d<-e?d=-e:d>a.page.maxw+e&&(d=a.page.maxw+e)}a.cursorfreezed=!1;e=a.getScrollLeft(!0);if(0>d&&0>=e||d>a.page.maxw&&e>=a.page.maxw)return a.noticeCursor();a.doScrollLeft(d)}; +this.doScrollTo=function(b,c){c&&Math.round(b*a.scrollratio.y);a.cursorfreezed=!1;a.doScrollTop(b)};this.checkContentSize=function(){var b=a.getContentSize();b.h==a.page.h&&b.w==a.page.w||a.resize(!1,b)};a.onscroll=function(b){a.rail.drag||a.cursorfreezed||a.synched("scroll",function(){a.scroll.y=Math.round(a.getScrollTop()*(1/a.scrollratio.y));a.railh&&(a.scroll.x=Math.round(a.getScrollLeft()*(1/a.scrollratio.x)));a.noticeCursor()})};a.bind(a.docscroll,"scroll",a.onscroll);this.doZoomIn=function(b){if(!a.zoomactive){a.zoomactive= +!0;a.zoomrestore={style:{}};var c="position top left zIndex backgroundColor marginTop marginBottom marginLeft marginRight".split(" "),d=a.win[0].style,h;for(h in c){var k=c[h];a.zoomrestore.style[k]="undefined"!=typeof d[k]?d[k]:""}a.zoomrestore.style.width=a.win.css("width");a.zoomrestore.style.height=a.win.css("height");a.zoomrestore.padding={w:a.win.outerWidth()-a.win.width(),h:a.win.outerHeight()-a.win.height()};e.isios4&&(a.zoomrestore.scrollTop=f(window).scrollTop(),f(window).scrollTop(0)); +a.win.css({position:e.isios4?"absolute":"fixed",top:0,left:0,"z-index":x+100,margin:"0px"});c=a.win.css("backgroundColor");(""==c||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(c))&&a.win.css("backgroundColor","#fff");a.rail.css({"z-index":x+101});a.zoom.css({"z-index":x+102});a.zoom.css("backgroundPosition","0px -18px");a.resizeZoom();a.onzoomin&&a.onzoomin.call(a);return a.cancelEvent(b)}};this.doZoomOut=function(b){if(a.zoomactive)return a.zoomactive=!1,a.win.css("margin",""),a.win.css(a.zoomrestore.style), +e.isios4&&f(window).scrollTop(a.zoomrestore.scrollTop),a.rail.css({"z-index":a.zindex}),a.zoom.css({"z-index":a.zindex}),a.zoomrestore=!1,a.zoom.css("backgroundPosition","0px 0px"),a.onResize(),a.onzoomout&&a.onzoomout.call(a),a.cancelEvent(b)};this.doZoom=function(b){return a.zoomactive?a.doZoomOut(b):a.doZoomIn(b)};this.resizeZoom=function(){if(a.zoomactive){var b=a.getScrollTop();a.win.css({width:f(window).width()-a.zoomrestore.padding.w+"px",height:f(window).height()-a.zoomrestore.padding.h+"px"}); +a.onResize();a.setScrollTop(Math.min(a.page.maxh,b))}};this.init();f.nicescroll.push(this)},L=function(f){var c=this;this.nc=f;this.steptime=this.lasttime=this.speedy=this.speedx=this.lasty=this.lastx=0;this.snapy=this.snapx=!1;this.demuly=this.demulx=0;this.lastscrolly=this.lastscrollx=-1;this.timer=this.chky=this.chkx=0;this.time=function(){return+new Date};this.reset=function(f,k){c.stop();var d=c.time();c.steptime=0;c.lasttime=d;c.speedx=0;c.speedy=0;c.lastx=f;c.lasty=k;c.lastscrollx=-1;c.lastscrolly= +-1};this.update=function(f,k){var d=c.time();c.steptime=d-c.lasttime;c.lasttime=d;var d=k-c.lasty,n=f-c.lastx,p=c.nc.getScrollTop(),a=c.nc.getScrollLeft(),p=p+d,a=a+n;c.snapx=0>a||a>c.nc.page.maxw;c.snapy=0>p||p>c.nc.page.maxh;c.speedx=n;c.speedy=d;c.lastx=f;c.lasty=k};this.stop=function(){c.nc.unsynched("domomentum2d");c.timer&&clearTimeout(c.timer);c.timer=0;c.lastscrollx=-1;c.lastscrolly=-1};this.doSnapy=function(f,k){var d=!1;0>k?(k=0,d=!0):k>c.nc.page.maxh&&(k=c.nc.page.maxh,d=!0);0>f?(f=0,d= +!0):f>c.nc.page.maxw&&(f=c.nc.page.maxw,d=!0);d?c.nc.doScrollPos(f,k,c.nc.opt.snapbackspeed):c.nc.triggerScrollEnd()};this.doMomentum=function(f){var k=c.time(),d=f?k+f:c.lasttime;f=c.nc.getScrollLeft();var n=c.nc.getScrollTop(),p=c.nc.page.maxh,a=c.nc.page.maxw;c.speedx=0=k-d;if(0>n||n>p||0>f||f>a)d=!1;f=c.speedx&&d?c.speedx:!1;if(c.speedy&&d&&c.speedy||f){var s=Math.max(16,c.steptime);50e||e>a)&&(d=.1);c.speedy&&(r=Math.floor(c.lastscrolly-c.speedy*(1-c.demulxy)),c.lastscrolly=r,0>r||r>p)&&(d=.1);c.demulxy=Math.min(1,c.demulxy+d);c.nc.synched("domomentum2d",function(){c.speedx&&(c.nc.getScrollLeft()!= +c.chkx&&c.stop(),c.chkx=e,c.nc.setScrollLeft(e));c.speedy&&(c.nc.getScrollTop()!=c.chky&&c.stop(),c.chky=r,c.nc.setScrollTop(r));c.timer||(c.nc.hideCursor(),c.doSnapy(e,r))});1>c.demulxy?c.timer=setTimeout(t,s):(c.stop(),c.nc.hideCursor(),c.doSnapy(e,r))};t()}else c.doSnapy(c.nc.getScrollLeft(),c.nc.getScrollTop())}},w=f.fn.scrollTop;f.cssHooks.pageYOffset={get:function(k,c,h){return(c=f.data(k,"__nicescroll")||!1)&&c.ishwscroll?c.getScrollTop():w.call(k)},set:function(k,c){var h=f.data(k,"__nicescroll")|| +!1;h&&h.ishwscroll?h.setScrollTop(parseInt(c)):w.call(k,c);return this}};f.fn.scrollTop=function(k){if("undefined"==typeof k){var c=this[0]?f.data(this[0],"__nicescroll")||!1:!1;return c&&c.ishwscroll?c.getScrollTop():w.call(this)}return this.each(function(){var c=f.data(this,"__nicescroll")||!1;c&&c.ishwscroll?c.setScrollTop(parseInt(k)):w.call(f(this),k)})};var B=f.fn.scrollLeft;f.cssHooks.pageXOffset={get:function(k,c,h){return(c=f.data(k,"__nicescroll")||!1)&&c.ishwscroll?c.getScrollLeft():B.call(k)}, +set:function(k,c){var h=f.data(k,"__nicescroll")||!1;h&&h.ishwscroll?h.setScrollLeft(parseInt(c)):B.call(k,c);return this}};f.fn.scrollLeft=function(k){if("undefined"==typeof k){var c=this[0]?f.data(this[0],"__nicescroll")||!1:!1;return c&&c.ishwscroll?c.getScrollLeft():B.call(this)}return this.each(function(){var c=f.data(this,"__nicescroll")||!1;c&&c.ishwscroll?c.setScrollLeft(parseInt(k)):B.call(f(this),k)})};var C=function(k){var c=this;this.length=0;this.name="nicescrollarray";this.each=function(d){for(var f= +0,h=0;f Date: Tue, 14 Jul 2015 17:59:36 +0200 Subject: Revert "Change default admin password from "5iveL!fe" to "password"" This reverts commit 8a01a1222875b190d32769f7a6e7a74720079d2a. --- README.md | 2 +- db/fixtures/development/01_admin.rb | 2 +- db/fixtures/production/001_admin.rb | 2 +- doc/install/installation.md | 2 +- docker/README.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7dc0ffb30ee..f8ce5f22ec2 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The recommended way to install GitLab is using the provided [Omnibus packages](h There are various other options to install GitLab, please refer to the [installation page on the GitLab website](https://about.gitlab.com/installation/) for more information. -You can access a new installation with the login **`root`** and password **`password`**, after login you are required to set a unique password. +You can access a new installation with the login **`root`** and password **`5iveL!fe`**, after login you are required to set a unique password. ## Third-party applications diff --git a/db/fixtures/development/01_admin.rb b/db/fixtures/development/01_admin.rb index b25d0dfc701..bba2fc4b186 100644 --- a/db/fixtures/development/01_admin.rb +++ b/db/fixtures/development/01_admin.rb @@ -5,7 +5,7 @@ Gitlab::Seeder.quiet do s.email = 'admin@example.com' s.notification_email = 'admin@example.com' s.username = 'root' - s.password = 'password' + s.password = '5iveL!fe' s.admin = true s.projects_limit = 100 s.confirmed_at = DateTime.now diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb index 1af8dfc0ef0..1c8740f6ba9 100644 --- a/db/fixtures/production/001_admin.rb +++ b/db/fixtures/production/001_admin.rb @@ -1,5 +1,5 @@ if ENV['GITLAB_ROOT_PASSWORD'].blank? - password = 'password' + password = '5iveL!fe' expire_time = Time.now else password = ENV['GITLAB_ROOT_PASSWORD'] diff --git a/doc/install/installation.md b/doc/install/installation.md index cf58abea4eb..8b918cba133 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -404,7 +404,7 @@ NOTE: Supply `SANITIZE=true` environment variable to `gitlab:check` to omit proj Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has created a default admin account for you. You can use it to log in: root - password + 5iveL!fe **Important Note:** On login you'll be prompted to change the password. diff --git a/docker/README.md b/docker/README.md index 293ca79f915..23093d35759 100644 --- a/docker/README.md +++ b/docker/README.md @@ -10,7 +10,7 @@ It might take a while before the docker container is responding to queries. You can check the status with something like `sudo docker logs -f gitlab`. -You can login to the web interface with username `root` and password `password`. +You can login to the web interface with username `root` and password `5iveL!fe`. Next time, you can just use docker start and stop to run the container. -- cgit v1.2.1 From 997a3b1d872f6b6b198582677acd67595bb15029 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Tue, 14 Jul 2015 18:02:41 +0200 Subject: Revert password change changelog entry. --- CHANGELOG | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 97d4671bd0d..12564b3bb56 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,7 +15,6 @@ v 7.13.0 (unreleased) - Add `two_factor_enabled` field to admin user API (Stan Hu) - Fix invalid timestamps in RSS feeds (Rowan Wookey) - Fix downloading of patches on public merge requests when user logged out (Stan Hu) - - The password for the default administrator (root) account has been changed from "5iveL!fe" to "password". - Fix Error 500 when relative submodule resolves to a namespace that has a different name from its path (Stan Hu) - Extract the longest-matching ref from a commit path when multiple matches occur (Stan Hu) - Update maintenance documentation to explain no need to recompile asssets for omnibus installations (Stan Hu) -- cgit v1.2.1 From 753f34c8fa91e0caa9a305d49c28ef6dd9447be2 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 14 Jul 2015 19:46:51 +0200 Subject: Fix docker image --- docker/Dockerfile | 4 +++- docker/assets/wrapper | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 86f6c896a6d..05521af6963 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -30,7 +30,9 @@ RUN ( \ echo "" && \ echo "# Docker options" && \ echo "# Prevent Postgres from trying to allocate 25% of total memory" && \ - echo "postgresql['shared_buffers'] = '1MB'" ) >> /etc/gitlab/gitlab.rb + echo "postgresql['shared_buffers'] = '1MB'" ) >> /etc/gitlab/gitlab.rb && \ + mkdir -p /assets/ && \ + cp /etc/gitlab/gitlab.rb /assets/gitlab.rb # Expose web & ssh EXPOSE 443 80 22 diff --git a/docker/assets/wrapper b/docker/assets/wrapper index 966b2cab4a1..8bc8370fbc9 100755 --- a/docker/assets/wrapper +++ b/docker/assets/wrapper @@ -13,4 +13,9 @@ function entrypoint() { gitlab-ctl tail # tail all logs } +if [[ ! -e /etc/gitlab/gitlab.rb ]]; then + cp /assets/gitlab.rb /etc/gitlab/gitlab.rb + chmod 0600 /etc/gitlab/gitlab.rb +fi + entrypoint -- cgit v1.2.1 From 82bb5c5e03858db094654a5ecced67a193be7931 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 15 Jul 2015 13:53:40 +0200 Subject: Expire Rails cache entries after two weeks This should help prevent endless Redis growth. --- CHANGELOG | 3 +++ config/application.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 12564b3bb56..3dcf76e23d0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ Please view this file on the master branch, on stable branches it's out of date. +v 7.14.0 (unreleased) + - Expire Rails cache entries after two weeks to prevent endless Redis growth + v 7.13.0 (unreleased) - Only enable HSTS header for HTTPS and port 443 (Stan Hu) - Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu) diff --git a/config/application.rb b/config/application.rb index 7e899cc3b5b..a96e22211e6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -96,6 +96,7 @@ module Gitlab end redis_config_hash[:namespace] = 'cache:gitlab' + redis_config_hash[:expires_in] = 2.weeks # Cache should not grow forever config.cache_store = :redis_store, redis_config_hash # This is needed for gitlab-shell -- cgit v1.2.1 From d2479a25c761f2517f94048e6da888186317142b Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Wed, 15 Jul 2015 16:59:31 +0300 Subject: Time ago fix for compare page --- app/views/projects/merge_requests/branch_from.js.haml | 1 + app/views/projects/merge_requests/branch_to.js.haml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/projects/merge_requests/branch_from.js.haml b/app/views/projects/merge_requests/branch_from.js.haml index 8372afa61b5..9210798f39c 100644 --- a/app/views/projects/merge_requests/branch_from.js.haml +++ b/app/views/projects/merge_requests/branch_from.js.haml @@ -1,2 +1,3 @@ :plain $(".mr_source_commit").html("#{commit_to_html(@commit, @source_project, false)}"); + $('.js-timeago').timeago() diff --git a/app/views/projects/merge_requests/branch_to.js.haml b/app/views/projects/merge_requests/branch_to.js.haml index f7ede0ded53..32fe2d535f3 100644 --- a/app/views/projects/merge_requests/branch_to.js.haml +++ b/app/views/projects/merge_requests/branch_to.js.haml @@ -1,2 +1,3 @@ :plain $(".mr_target_commit").html("#{commit_to_html(@commit, @target_project, false)}"); + $('.js-timeago').timeago() -- cgit v1.2.1 From 6096c0296d37287ca2612a7c88c120edc0e5dbb3 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Wed, 15 Jul 2015 11:13:40 -0700 Subject: added note about chef --- docker/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/README.md b/docker/README.md index 293ca79f915..d684f75dda0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -165,3 +165,4 @@ sudo docker push gitlab/gitlab-ce:latest Please see the [troubleshooting](troubleshooting.md) file in this directory. Note: We use `fig.yml` to have compatibility with fig and because docker-compose also supports it. +Our docker image runs chef at every start to generate GitLab configuration. -- cgit v1.2.1 From 4944df86fad5adc69451be519cf3a26407c718eb Mon Sep 17 00:00:00 2001 From: karen Carias Date: Wed, 15 Jul 2015 16:40:20 -0700 Subject: added additional space --- docker/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/README.md b/docker/README.md index d684f75dda0..dbd30682d37 100644 --- a/docker/README.md +++ b/docker/README.md @@ -165,4 +165,5 @@ sudo docker push gitlab/gitlab-ce:latest Please see the [troubleshooting](troubleshooting.md) file in this directory. Note: We use `fig.yml` to have compatibility with fig and because docker-compose also supports it. + Our docker image runs chef at every start to generate GitLab configuration. -- cgit v1.2.1 From c8758357b16c9b8d648c6be1bed9e002c73cd0de Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 16 Jul 2015 12:13:09 +0000 Subject: Document should start from h1 title. Also put badges on top for easier tracking --- README.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f8ce5f22ec2..8b14d6a6b16 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ +# GitLab + +[![build status](https://ci.gitlab.com/projects/1/status.png?ref=master)](https://ci.gitlab.com/projects/1?ref=master) +[![Build Status](https://semaphoreapp.com/api/v1/projects/2f1a5809-418b-4cc2-a1f4-819607579fe7/243338/badge.png)](https://semaphoreapp.com/gitlabhq/gitlabhq) +[![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.svg)](https://codeclimate.com/github/gitlabhq/gitlabhq) +[![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq?branch=master) + ## Canonical source The source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. -# ![logo](https://about.gitlab.com/images/gitlab_logo.png) GitLab - ## Open source software to collaborate on code To see how GitLab looks please see the [features page on our website](https://about.gitlab.com/features/). @@ -23,16 +28,6 @@ There are two editions of GitLab. *GitLab Enterprise Edition (EE)* includes [extra features](https://about.gitlab.com/features/#compare) that are most useful for organizations with more than 100 users. To use EE and get official support please [become a subscriber](https://about.gitlab.com/pricing/). -## Code status - -- [![build status](https://ci.gitlab.com/projects/1/status.png?ref=master)](https://ci.gitlab.com/projects/1?ref=master) on ci.gitlab.com (master branch) - -- [![Build Status](https://semaphoreapp.com/api/v1/projects/2f1a5809-418b-4cc2-a1f4-819607579fe7/243338/badge.png)](https://semaphoreapp.com/gitlabhq/gitlabhq) - -- [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.svg)](https://codeclimate.com/github/gitlabhq/gitlabhq) - -- [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq?branch=master) - ## Website On [about.gitlab.com](https://about.gitlab.com/) you can find more information about: -- cgit v1.2.1 From 53d40b8ab1275fa39e1ae4b82a228ccf731045f9 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Thu, 16 Jul 2015 11:18:10 -0700 Subject: changed some text --- doc/gitlab-basics/create-branch.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/gitlab-basics/create-branch.md b/doc/gitlab-basics/create-branch.md index 3521de6bea3..a8afbfe53d7 100644 --- a/doc/gitlab-basics/create-branch.md +++ b/doc/gitlab-basics/create-branch.md @@ -3,7 +3,7 @@ A branch is an independent line of development. New commits are recorded in the history for the current branch, which results in taking the source from someone’s repository (the place where the history of your work is stored) at certain point in time, and apply your own changes to it in the history of the project. -To add changes to your GitLab project, you should create a branch. You can do it in your [shell](basic-git-commands.md) or in [GitLab](https://gitlab.com). +To add changes to your GitLab project, you should create a branch. You can do it in your [shell](basic-git-commands.md) or in GitLab. To create a new branch in GitLab, sign in and then select a project on the right side of your screen: @@ -31,8 +31,8 @@ Fill out the information required: ![Branch info](basicsimages/branch_info.png) -After you created a new branch, click on the files on which you'll be working. - -You will be able to find and select the name of your branch in the white box next to the project's name: +### Note: + +You will be able to find and select the name of your branch in the white box next to a project's name: ![Branch name](basicsimages/branch_name.png) -- cgit v1.2.1 From 2590b16cb4c383221a7cef04a43802d43330ff1b Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 17 Jul 2015 09:50:37 +0000 Subject: Improve the layout of the readme. --- README.md | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 8b14d6a6b16..5034a5e0b48 100644 --- a/README.md +++ b/README.md @@ -41,14 +41,6 @@ On [about.gitlab.com](https://about.gitlab.com/) you can find more information a ## Requirements -GitLab requires the following software: - -- Ubuntu/Debian/CentOS/RHEL -- Ruby (MRI) 2.0 or 2.1 -- Git 1.7.10+ -- Redis 2.0+ -- MySQL or PostgreSQL - Please see the [requirements documentation](doc/install/requirements.md) for system requirements and more information about the supported operating systems. ## Installation @@ -59,6 +51,28 @@ There are various other options to install GitLab, please refer to the [installa You can access a new installation with the login **`root`** and password **`5iveL!fe`**, after login you are required to set a unique password. +## Install a development environment + +To work on GitLab itself, we recommend setting up your development environment with [the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit). +If you do not use the GitLab Development Kit you need to install and setup all the dependencies yourself, this is a lot of work and error prone. +One small thing you also have to do when installing it yourself is to copy the example development unicorn configuration file: + + cp config/unicorn.rb.example.development config/unicorn.rb + +Instructions on how to start GitLab and how to run the tests can be found in the [development section of the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit#development). + +## Software stack + +GitLab is a Ruby on Rails application that runs on the following software: + +- Ubuntu/Debian/CentOS/RHEL +- Ruby (MRI) 2.0 or 2.1 +- Git 1.7.10+ +- Redis 2.0+ +- MySQL or PostgreSQL + +For more information please see the [architecture documentation](http://doc.gitlab.com/ce/development/architecture.html). + ## Third-party applications There are a lot of [third-party applications integrating with GitLab](https://about.gitlab.com/applications/). These include GUI Git clients, mobile applications and API wrappers for various languages. @@ -71,16 +85,6 @@ Since 2011 a minor or major version of GitLab is released on the 22nd of every m For upgrading information please see our [update page](https://about.gitlab.com/update/). -## Install a development environment - -To work on GitLab itself, we recommend setting up your development environment with [the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit). -If you do not use the GitLab Development Kit you need to install and setup all the dependencies yourself, this is a lot of work and error prone. -One small thing you also have to do when installing it yourself is to copy the example development unicorn configuration file: - - cp config/unicorn.rb.example.development config/unicorn.rb - -Instructions on how to start GitLab and how to run the tests can be found in the [development section of the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit#development). - ## Documentation All documentation can be found on [doc.gitlab.com/ce/](http://doc.gitlab.com/ce/). -- cgit v1.2.1 From 5d168588c07b230f4698142e568b56b1938c56c5 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 17 Jul 2015 09:52:41 +0000 Subject: Update installation instructions. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5034a5e0b48..74520786165 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,9 @@ Please see the [requirements documentation](doc/install/requirements.md) for sys ## Installation -The recommended way to install GitLab is using the provided [Omnibus packages](https://about.gitlab.com/downloads/). Compared to an installation from source, this is faster and less error prone. Just select your operating system, download the respective package (Debian or RPM) and install it using the system's package manager. +The recommended way to install GitLab is with the [Omnibus packages](https://about.gitlab.com/downloads/) on our package server. +Compared to an installation from source, this is faster and less error prone. +Just select your operating system, download the respective package (Debian or RPM) and install it using the system's package manager. There are various other options to install GitLab, please refer to the [installation page on the GitLab website](https://about.gitlab.com/installation/) for more information. -- cgit v1.2.1 From 95400db9c8008a7abb3dd5f876710d855a7082a7 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Fri, 17 Jul 2015 09:56:34 +0000 Subject: Clean up editions paragraph --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 74520786165..bd663b30f3e 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,12 @@ To see how GitLab looks please see the [features page on our website](https://ab ## Editions -There are two editions of GitLab. -*GitLab [Community Edition](https://about.gitlab.com/features/) (CE)* is available without any costs under an MIT license. +There are two editions of GitLab: -*GitLab Enterprise Edition (EE)* includes [extra features](https://about.gitlab.com/features/#compare) that are most useful for organizations with more than 100 users. -To use EE and get official support please [become a subscriber](https://about.gitlab.com/pricing/). +- GitLab Community Edition (CE) is available freely under the MIT Expat license. +- GitLab Enterprise Edition (EE) includes [extra features](https://about.gitlab.com/features/#compare) that are more useful for organizations with more than 100 users. To use EE and get official support please [become a subscriber](https://about.gitlab.com/pricing/). + +Included with the GitLab Omnibus Packages is [GitLab CI](https://about.gitlab.com/gitlab-ci/) that can easily build, test and deploy code. ## Website -- cgit v1.2.1 From 881fbe5070331f934fff3441dbc0e65377b030bf Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 17 Jul 2015 13:59:40 +0200 Subject: Add more seed projects. Control amount with SIZE env variable Signed-off-by: Dmitriy Zaporozhets --- db/fixtures/development/04_project.rb | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb index 87839770924..8f71198e47f 100644 --- a/db/fixtures/development/04_project.rb +++ b/db/fixtures/development/04_project.rb @@ -11,9 +11,42 @@ Sidekiq::Testing.inline! do 'https://github.com/twitter/flight.git', 'https://github.com/twitter/typeahead.js.git', 'https://github.com/h5bp/html5-boilerplate.git', + 'https://github.com/google/material-design-lite.git', + 'https://github.com/jlevy/the-art-of-command-line.git', + 'https://github.com/FreeCodeCamp/freecodecamp.git', + 'https://github.com/google/deepdream.git', + 'https://github.com/jtleek/datasharing.git', + 'https://github.com/WebAssembly/design.git', + 'https://github.com/airbnb/javascript.git', + 'https://github.com/tessalt/echo-chamber-js.git', + 'https://github.com/atom/atom.git', + 'https://github.com/ipselon/react-ui-builder.git', + 'https://github.com/mattermost/platform.git', + 'https://github.com/purifycss/purifycss.git', + 'https://github.com/facebook/nuclide.git', + 'https://github.com/wbkd/awesome-d3.git', + 'https://github.com/kilimchoi/engineering-blogs.git', + 'https://github.com/gilbarbara/logos.git', + 'https://github.com/gaearon/redux.git', + 'https://github.com/awslabs/s2n.git', + 'https://github.com/arkency/reactjs_koans.git', + 'https://github.com/twbs/bootstrap.git', + 'https://github.com/chjj/ttystudio.git', + 'https://github.com/DrBoolean/mostly-adequate-guide.git', + 'https://github.com/octocat/Spoon-Knife.git', + 'https://github.com/opencontainers/runc.git', + 'https://github.com/googlesamples/android-topeka.git' ] - project_urls.each_with_index do |url, i| + # You can specify how many projects you need during seed execution + size = if ENV['SIZE'].present? + ENV['SIZE'].to_i + else + 8 + end + + + project_urls.first(size).each_with_index do |url, i| group_path, project_path = url.split('/')[-2..-1] group = Group.find_by(path: group_path) -- cgit v1.2.1 From 67ca5a53f6df0c3d0f2598c777491c0548d76e50 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 17 Jul 2015 14:50:03 +0200 Subject: Build missing cache items in background job after each push Signed-off-by: Dmitriy Zaporozhets --- app/models/repository.rb | 23 +++++++++++++++++++++-- app/services/git_push_service.rb | 1 + app/services/git_tag_push_service.rb | 6 +++--- app/workers/project_cache_worker.rb | 9 +++++++++ lib/repository_cache.rb | 4 ++++ 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 app/workers/project_cache_worker.rb diff --git a/app/models/repository.rb b/app/models/repository.rb index 6262b5c4c92..bca14aa1a33 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -130,10 +130,29 @@ class Repository cache.fetch(:size) { raw_repository.size } end - def expire_cache + def cache_keys %i(size branch_names tag_names commit_count graph_log - readme version contribution_guide changelog license).each do |key| + readme version contribution_guide changelog license) + end + + def build_cache + cache_keys.each do |key| + unless cache.exist?(key) + send(key) + end + end + end + + def expire_cache + cache_keys.each do |key| + cache.expire(key) + end + end + + def rebuild_cache + cache_keys.each do |key| cache.expire(key) + send(key) end end diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index 6135ae65007..c36113329ea 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -61,6 +61,7 @@ class GitPushService EventCreateService.new.push(project, user, @push_data) project.execute_hooks(@push_data.dup, :push_hooks) project.execute_services(@push_data.dup, :push_hooks) + ProjectCacheWorker.perform_async(project.id) end protected diff --git a/app/services/git_tag_push_service.rb b/app/services/git_tag_push_service.rb index 075a6118da2..1cc42b0b0ad 100644 --- a/app/services/git_tag_push_service.rb +++ b/app/services/git_tag_push_service.rb @@ -2,15 +2,15 @@ class GitTagPushService attr_accessor :project, :user, :push_data def execute(project, user, oldrev, newrev, ref) - @project, @user = project, user + project.repository.expire_cache + @project, @user = project, user @push_data = build_push_data(oldrev, newrev, ref) EventCreateService.new.push(project, user, @push_data) project.execute_hooks(@push_data.dup, :tag_push_hooks) project.execute_services(@push_data.dup, :tag_push_hooks) - - project.repository.expire_cache + ProjectCacheWorker.perform_async(project.id) true end diff --git a/app/workers/project_cache_worker.rb b/app/workers/project_cache_worker.rb new file mode 100644 index 00000000000..4c14565dce5 --- /dev/null +++ b/app/workers/project_cache_worker.rb @@ -0,0 +1,9 @@ +class ProjectCacheWorker + include Sidekiq::Worker + + sidekiq_options queue: :default + + def perform(project_id) + Project.find(project_id).repository.build_cache + end +end diff --git a/lib/repository_cache.rb b/lib/repository_cache.rb index fa016a170cd..639687067ec 100644 --- a/lib/repository_cache.rb +++ b/lib/repository_cache.rb @@ -18,4 +18,8 @@ class RepositoryCache def fetch(key, &block) backend.fetch(cache_key(key), &block) end + + def exist?(key) + backend.exist?(key) + end end -- cgit v1.2.1 From f0116f13354fa1e57e3ba8013ea67d3b0e193375 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 17 Jul 2015 15:22:56 +0200 Subject: Store commit count in project table Signed-off-by: Dmitriy Zaporozhets --- app/helpers/projects_helper.rb | 14 ++++++++++++++ app/models/project.rb | 4 ++++ app/models/repository.rb | 12 ------------ app/services/git_push_service.rb | 1 - app/views/explore/projects/_project.html.haml | 2 +- app/views/projects/show.html.haml | 2 +- app/workers/project_cache_worker.rb | 5 ++++- app/workers/repository_import_worker.rb | 2 +- db/migrate/20150717130904_add_commits_count_to_project.rb | 5 +++++ db/schema.rb | 3 ++- lib/repository_cache.rb | 6 +++++- 11 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 db/migrate/20150717130904_add_commits_count_to_project.rb diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 78f24dbd7ef..f61baf00525 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -276,4 +276,18 @@ module ProjectsHelper def readme_cache_key [@project.id, @project.commit.sha, "readme"].join('-') end + + def round_commit_count(project) + count = project.commit_count + + if count > 10000 + '10000+' + elsif count > 5000 + '5000+' + elsif count > 1000 + '1000+' + else + count + end + end end diff --git a/app/models/project.rb b/app/models/project.rb index b161cbe86b9..ff372ea9aa5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -683,6 +683,10 @@ class Project < ActiveRecord::Base update_attribute(:repository_size, repository.size) end + def update_commit_count + update_attribute(:commit_count, repository.commit_count) + end + def forks_count ForkedProjectLink.where(forked_from_project_id: self.id).count end diff --git a/app/models/repository.rb b/app/models/repository.rb index bca14aa1a33..2985619fd2e 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -94,18 +94,6 @@ class Repository gitlab_shell.rm_tag(path_with_namespace, tag_name) end - def round_commit_count - if commit_count > 10000 - '10000+' - elsif commit_count > 5000 - '5000+' - elsif commit_count > 1000 - '1000+' - else - commit_count - end - end - def branch_names cache.fetch(:branch_names) { raw_repository.branch_names } end diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index c36113329ea..3511392d1d8 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -21,7 +21,6 @@ class GitPushService project.ensure_satellite_exists project.repository.expire_cache - project.update_repository_size if push_remove_branch?(ref, newrev) @push_commits = [] diff --git a/app/views/explore/projects/_project.html.haml b/app/views/explore/projects/_project.html.haml index d65fb529373..d769c91545d 100644 --- a/app/views/explore/projects/_project.html.haml +++ b/app/views/explore/projects/_project.html.haml @@ -14,7 +14,7 @@ .repo-info - unless project.empty_repo? - = link_to pluralize(project.repository.round_commit_count, 'commit'), namespace_project_commits_path(project.namespace, project, project.default_branch) + = link_to pluralize(round_commit_count(project), 'commit'), namespace_project_commits_path(project.namespace, project, project.default_branch) · = link_to pluralize(project.repository.branch_names.count, 'branch'), namespace_project_branches_path(project.namespace, project) · diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 98d9053eb1d..b90cadfb1e2 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -13,7 +13,7 @@ %ul.nav.nav-pills %li = link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do - = pluralize(number_with_delimiter(@repository.commit_count), 'commit') + = pluralize(number_with_delimiter(@project.commit_count), 'commit') %li = link_to namespace_project_branches_path(@project.namespace, @project) do = pluralize(number_with_delimiter(@repository.branch_names.count), 'branch') diff --git a/app/workers/project_cache_worker.rb b/app/workers/project_cache_worker.rb index 4c14565dce5..61416d634bd 100644 --- a/app/workers/project_cache_worker.rb +++ b/app/workers/project_cache_worker.rb @@ -4,6 +4,9 @@ class ProjectCacheWorker sidekiq_options queue: :default def perform(project_id) - Project.find(project_id).repository.build_cache + project = Project.find(project_id) + project.update_repository_size + project.update_commit_count + project.repository.build_cache end end diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb index e6a50afedb1..94832872d13 100644 --- a/app/workers/repository_import_worker.rb +++ b/app/workers/repository_import_worker.rb @@ -28,7 +28,7 @@ class RepositoryImportWorker project.import_finish project.save project.satellite.create unless project.satellite.exists? - project.update_repository_size + ProjectCacheWorker.perform_async(project.id) Gitlab::BitbucketImport::KeyDeleter.new(project).execute if project.import_type == 'bitbucket' end end diff --git a/db/migrate/20150717130904_add_commits_count_to_project.rb b/db/migrate/20150717130904_add_commits_count_to_project.rb new file mode 100644 index 00000000000..9b46daa5933 --- /dev/null +++ b/db/migrate/20150717130904_add_commits_count_to_project.rb @@ -0,0 +1,5 @@ +class AddCommitsCountToProject < ActiveRecord::Migration + def change + add_column :projects, :commit_count, :integer, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index d6c34a77ee6..a63c2d05821 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150713160110) do +ActiveRecord::Schema.define(version: 20150717130904) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -374,6 +374,7 @@ ActiveRecord::Schema.define(version: 20150713160110) do t.integer "star_count", default: 0, null: false t.string "import_type" t.string "import_source" + t.integer "commit_count", default: 0 end add_index "projects", ["created_at", "id"], name: "index_projects_on_created_at_and_id", using: :btree diff --git a/lib/repository_cache.rb b/lib/repository_cache.rb index 639687067ec..8ddc3511293 100644 --- a/lib/repository_cache.rb +++ b/lib/repository_cache.rb @@ -20,6 +20,10 @@ class RepositoryCache end def exist?(key) - backend.exist?(key) + backend.exist?(cache_key(key)) + end + + def read(key) + backend.read(cache_key(key)) end end -- cgit v1.2.1 From c3e35917fbfbe64a068e387207aa510d76852e61 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 17 Jul 2015 15:26:09 +0200 Subject: Validate format of project_url and token for GitLab CI service. --- app/models/project_services/gitlab_ci_service.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb index c284e19fe50..5aaa4e85cbc 100644 --- a/app/models/project_services/gitlab_ci_service.rb +++ b/app/models/project_services/gitlab_ci_service.rb @@ -22,8 +22,12 @@ class GitlabCiService < CiService API_PREFIX = "api/v1" prop_accessor :project_url, :token - validates :project_url, presence: true, if: :activated? - validates :token, presence: true, if: :activated? + validates :project_url, + presence: true, + format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" }, if: :activated? + validates :token, + presence: true, + format: { with: /\A([A-Za-z0-9]+)\z/ }, if: :activated? after_save :compose_service_hook, if: :activated? -- cgit v1.2.1 From df2bb60f90315a77718b9122e9d06f5655750640 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 14 Jul 2015 15:20:38 -0700 Subject: Add support for destroying project milestones Closes https://github.com/gitlabhq/gitlabhq/issues/1504 --- CHANGELOG | 3 +++ app/controllers/projects/milestones_controller.rb | 7 +++++- app/views/projects/milestones/_milestone.html.haml | 4 ++++ app/views/projects/milestones/show.html.haml | 3 +++ config/routes.rb | 2 +- features/project/issues/milestones.feature | 4 ++++ features/steps/project/issues/milestones.rb | 8 +++++++ .../projects/milestones_controller_spec.rb | 28 ++++++++++++++++++++++ 8 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 spec/controllers/projects/milestones_controller_spec.rb diff --git a/CHANGELOG b/CHANGELOG index 12564b3bb56..e3b4ad130ba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ Please view this file on the master branch, on stable branches it's out of date. +v 7.14.0 (unreleased) + - Add support for destroying project milestones (Stan Hu) + v 7.13.0 (unreleased) - Only enable HSTS header for HTTPS and port 443 (Stan Hu) - Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu) diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index 61689488d13..9efe9704d1e 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -64,7 +64,12 @@ class Projects::MilestonesController < Projects::ApplicationController end def destroy - return access_denied! unless can?(current_user, :admin_milestone, @milestone) + return access_denied! unless can?(current_user, :admin_milestone, @project) + + update_params = { milestone: nil } + @milestone.issues.each do |issue| + Issues::UpdateService.new(@project, current_user, update_params).execute(issue) + end @milestone.destroy diff --git a/app/views/projects/milestones/_milestone.html.haml b/app/views/projects/milestones/_milestone.html.haml index 14a0580f966..2ce5358fa74 100644 --- a/app/views/projects/milestones/_milestone.html.haml +++ b/app/views/projects/milestones/_milestone.html.haml @@ -5,6 +5,10 @@ %i.fa.fa-pencil-square-o Edit = link_to 'Close Milestone', namespace_project_milestone_path(@project.namespace, @project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-sm btn-close" + = link_to namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone), data: { confirm: 'Are you sure?' }, method: :delete, class: "btn btn-sm btn-remove" do + %i.fa.fa-trash-o + Remove + %h4 = link_to_gfm truncate(milestone.title, length: 100), namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone) - if milestone.expired? and not milestone.closed? diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 5947498e379..7b1681df336 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -19,6 +19,9 @@ = link_to 'Close Milestone', namespace_project_milestone_path(@project.namespace, @project, @milestone, milestone: {state_event: :close }), method: :put, class: "btn btn-close btn-grouped" - else = link_to 'Reopen Milestone', namespace_project_milestone_path(@project.namespace, @project, @milestone, milestone: {state_event: :activate }), method: :put, class: "btn btn-reopen btn-grouped" + = link_to namespace_project_milestone_path(@project.namespace, @project, @milestone), data: { confirm: 'Are you sure?' }, method: :delete, class: "btn btn-grouped btn-remove" do + %i.fa.fa-trash-o + Remove %hr - if @milestone.issues.any? && @milestone.can_be_closed? diff --git a/config/routes.rb b/config/routes.rb index 055d59a0c93..2e16c3ecb39 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -481,7 +481,7 @@ Gitlab::Application.routes.draw do end end - resources :milestones, except: [:destroy], constraints: { id: /\d+/ } do + resources :milestones, constraints: { id: /\d+/ } do member do put :sort_issues put :sort_merge_requests diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature index 9ac65b1257c..bfbaaec5a35 100644 --- a/features/project/issues/milestones.feature +++ b/features/project/issues/milestones.feature @@ -17,6 +17,10 @@ Feature: Project Issues Milestones And I submit new milestone "v2.3" Then I should see milestone "v2.3" + Scenario: I delete new milestone + Given I click link to remove milestone "v2.2" + And I should see no milestones + @javascript Scenario: Listing closed issues Given the milestone has open and closed issues diff --git a/features/steps/project/issues/milestones.rb b/features/steps/project/issues/milestones.rb index 708c5243947..61e62c2adbd 100644 --- a/features/steps/project/issues/milestones.rb +++ b/features/steps/project/issues/milestones.rb @@ -56,4 +56,12 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps step 'I should see 3 issues' do expect(page).to have_selector('#tab-issues li.issue-row', count: 4) end + + step 'I click link to remove milestone "v2.2"' do + click_link 'Remove' + end + + step 'I should see no milestones' do + expect(page).to have_content('No milestones to show') + end end diff --git a/spec/controllers/projects/milestones_controller_spec.rb b/spec/controllers/projects/milestones_controller_spec.rb new file mode 100644 index 00000000000..d3868c13202 --- /dev/null +++ b/spec/controllers/projects/milestones_controller_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe Projects::MilestonesController do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:milestone) { create(:milestone, project: project) } + let(:issue) { create(:issue, project: project, milestone: milestone) } + + before do + sign_in(user) + project.team << [user, :master] + controller.instance_variable_set(:@project, project) + end + + describe "#destroy" do + it "should remove milestone" do + expect(issue.milestone_id).to eq(milestone.id) + delete :destroy, namespace_id: project.namespace.id, project_id: project.id, id: milestone.id, format: :js + expect(response).to be_success + expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound) + issue.reload + expect(issue.milestone_id).to eq(nil) + # Check system note left for milestone removal + last_note = project.issues.find(issue.id).notes[-1].note + expect(last_note).to eq('Milestone removed') + end + end +end -- cgit v1.2.1 From 302c52551a0155f3955144690f1b67ac4ef98282 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 17 Jul 2015 15:58:26 +0200 Subject: Fix failing specs after adding format verification for token and project url in gitlab ci service. --- spec/requests/api/projects_spec.rb | 2 +- spec/requests/api/services_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 4178bb2e836..5bd8206b890 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -89,7 +89,7 @@ describe API::API, api: true do it 'returns projects in the correct order when ci_enabled_first parameter is passed' do [project, project2, project3].each{ |project| project.build_missing_services } - project2.gitlab_ci_service.update(active: true, token: "token", project_url: "url") + project2.gitlab_ci_service.update(active: true, token: "token", project_url: "http://ci.example.com/projects/1") get api('/projects', user), { ci_enabled_first: 'true' } expect(response.status).to eq(200) expect(json_response).to be_an Array diff --git a/spec/requests/api/services_spec.rb b/spec/requests/api/services_spec.rb index 51c543578df..cedb5f15ead 100644 --- a/spec/requests/api/services_spec.rb +++ b/spec/requests/api/services_spec.rb @@ -7,7 +7,7 @@ describe API::API, api: true do describe "POST /projects/:id/services/gitlab-ci" do it "should update gitlab-ci settings" do - put api("/projects/#{project.id}/services/gitlab-ci", user), token: 'secret-token', project_url: "http://ci.example.com/projects/1" + put api("/projects/#{project.id}/services/gitlab-ci", user), token: 'secrettoken', project_url: "http://ci.example.com/projects/1" expect(response.status).to eq(200) end -- cgit v1.2.1 From 67654a44d13632e2bc8c5637baef4459a58d65b1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 17 Jul 2015 16:03:38 +0200 Subject: Avoid cache building for super-weird case when repository root_ref is nil Signed-off-by: Dmitriy Zaporozhets --- app/workers/project_cache_worker.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/workers/project_cache_worker.rb b/app/workers/project_cache_worker.rb index 61416d634bd..55cb6af232e 100644 --- a/app/workers/project_cache_worker.rb +++ b/app/workers/project_cache_worker.rb @@ -7,6 +7,9 @@ class ProjectCacheWorker project = Project.find(project_id) project.update_repository_size project.update_commit_count - project.repository.build_cache + + if project.repository.root_ref + project.repository.build_cache + end end end -- cgit v1.2.1 From 559c363b1e0063550cf97de4f737daed9e0f3005 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 17 Jul 2015 16:32:06 +0200 Subject: The release manager owns the stable branches I think this helps the release manager because it means they don't have to worry about others pushing commits at the last minute. --- doc/release/monthly.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 3bc92187218..ca9696e957e 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -6,6 +6,7 @@ It starts 7 working days before the release. The release manager doesn't have to perform all the work but must ensure someone is assigned. The current release manager must schedule the appointment of the next release manager. The new release manager should create overall issue to track the progress. +The release manager should be the only person pushing/merging commits to the x-y-stable branches. ## Release Manager -- cgit v1.2.1 From 5bac64552d7852691edb3fed80723bc74ee62e33 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 17 Jul 2015 07:32:17 -0700 Subject: Fix bug where clicking on the link icon on a file would result in "L#undefined" in the URL Closes #2002 --- app/assets/javascripts/line_highlighter.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/line_highlighter.js.coffee b/app/assets/javascripts/line_highlighter.js.coffee index a8b3c1fa33e..e604e6025c2 100644 --- a/app/assets/javascripts/line_highlighter.js.coffee +++ b/app/assets/javascripts/line_highlighter.js.coffee @@ -70,7 +70,7 @@ class @LineHighlighter @clearHighlight() - lineNumber = $(event.target).data('line-number') + lineNumber = $(event.target).closest('a').data('line-number') current = @hashToRange(@_hash) unless current[0] && event.shiftKey -- cgit v1.2.1 From c7daa5f17fdb45cb7acc058a3a418be19c42712a Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 17 Jul 2015 17:03:15 +0200 Subject: Add specs for gitlab ci service validity. --- .../project_services/gitlab_ci_service_spec.rb | 27 ++++++++++++++++++++++ spec/requests/api/services_spec.rb | 12 ++++++++++ 2 files changed, 39 insertions(+) diff --git a/spec/models/project_services/gitlab_ci_service_spec.rb b/spec/models/project_services/gitlab_ci_service_spec.rb index fedc37c9b94..4f8a1986995 100644 --- a/spec/models/project_services/gitlab_ci_service_spec.rb +++ b/spec/models/project_services/gitlab_ci_service_spec.rb @@ -26,6 +26,33 @@ describe GitlabCiService do it { is_expected.to have_one(:service_hook) } end + describe 'validations' do + context 'active' do + before { allow(subject).to receive(:activated?).and_return(true) } + + it { is_expected.to validate_presence_of(:token) } + it { is_expected.to validate_presence_of(:project_url) } + it { is_expected.to allow_value('ewf9843kdnfdfs89234n').for(:token) } + it { is_expected.to allow_value('http://ci.example.com/project/1').for(:project_url) } + it { is_expected.not_to allow_value('token with spaces').for(:token) } + it { is_expected.not_to allow_value('token/with%spaces').for(:token) } + it { is_expected.not_to allow_value('this is not url').for(:project_url) } + it { is_expected.not_to allow_value('http//noturl').for(:project_url) } + it { is_expected.not_to allow_value('ftp://ci.example.com/projects/3').for(:project_url) } + end + + context 'inactive' do + before { allow(subject).to receive(:activated?).and_return(false) } + + it { is_expected.not_to validate_presence_of(:token) } + it { is_expected.not_to validate_presence_of(:project_url) } + it { is_expected.to allow_value('ewf9843kdnfdfs89234n').for(:token) } + it { is_expected.to allow_value('http://ci.example.com/project/1').for(:project_url) } + it { is_expected.to allow_value('token with spaces').for(:token) } + it { is_expected.to allow_value('ftp://ci.example.com/projects/3').for(:project_url) } + end + end + describe 'commits methods' do before do @service = GitlabCiService.new diff --git a/spec/requests/api/services_spec.rb b/spec/requests/api/services_spec.rb index cedb5f15ead..6d29a28580a 100644 --- a/spec/requests/api/services_spec.rb +++ b/spec/requests/api/services_spec.rb @@ -17,6 +17,18 @@ describe API::API, api: true do expect(response.status).to eq(400) end + + it "should return if the format of token is invalid" do + put api("/projects/#{project.id}/services/gitlab-ci", user), token: 'token-with dashes and spaces%', project_url: "http://ci.example.com/projects/1", active: true + + expect(response.status).to eq(404) + end + + it "should return if the format of token is invalid" do + put api("/projects/#{project.id}/services/gitlab-ci", user), token: 'token-with dashes and spaces%', project_url: "ftp://ci.example/projects/1", active: true + + expect(response.status).to eq(404) + end end describe "DELETE /projects/:id/services/gitlab-ci" do -- cgit v1.2.1 From 77f325a49fd955f73197a6270c82d28053e2c19e Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 17 Jul 2015 17:17:33 +0200 Subject: Do not disappoint rubocop. --- spec/models/project_services/gitlab_ci_service_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/project_services/gitlab_ci_service_spec.rb b/spec/models/project_services/gitlab_ci_service_spec.rb index 4f8a1986995..a14384c87b4 100644 --- a/spec/models/project_services/gitlab_ci_service_spec.rb +++ b/spec/models/project_services/gitlab_ci_service_spec.rb @@ -26,7 +26,7 @@ describe GitlabCiService do it { is_expected.to have_one(:service_hook) } end - describe 'validations' do + describe 'validations' do context 'active' do before { allow(subject).to receive(:activated?).and_return(true) } -- cgit v1.2.1 From 53d9f78043b9743e45cf170baca21d56d92af052 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 17 Jul 2015 18:21:47 +0200 Subject: Update changelog Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 3dcf76e23d0..1ae1f57b7a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -49,6 +49,8 @@ v 7.13.0 (unreleased) - Faster code search in repository and wiki. Fixes search page timeout for big repositories - Allow administrators to disable 2FA for a specific user - Add error message for SSH key linebreaks + - Store commits count in database (will populate with valid values only after first push) + - Rebuild cache after push to repository in background job v 7.12.2 - Correctly show anonymous authorized applications under Profile > Applications. -- cgit v1.2.1 From 782500158608eba36e27f53e1d8822d25710fe80 Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt Date: Fri, 10 Jul 2015 16:41:43 +0200 Subject: Fix file upload dialog for comment editing This fixes the file upload dialog which currently works for new comments but not for comment editing. The cause for this is a missing DOM class which causes traversal to the dropzone to fail. This is fixed by adding the expected `gfm-form` class to the edit form. It has to be added dynamically since adding it to the form template would break the form's layout and comment saving. --- CHANGELOG | 1 + app/assets/javascripts/notes.js.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 001d5350bad..c4877042fed 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Fix file upload dialog for comment editing (Daniel Gerhardt) - Expire Rails cache entries after two weeks to prevent endless Redis growth - Add support for destroying project milestones (Stan Hu) diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 1c05a2b9fe8..bcff7bcc49e 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -298,7 +298,7 @@ class @Notes note.find(".note-header").hide() base_form = note.find(".note-edit-form") form = base_form.clone().insertAfter(base_form) - form.addClass('current-note-edit-form') + form.addClass('current-note-edit-form gfm-form') form.find('.div-dropzone').remove() # Show the attachment delete link -- cgit v1.2.1 From 5f4dcbf8be36e7c87afdc28afd7f2d663a9abf28 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 17 Jul 2015 16:17:04 -0700 Subject: Set OmniAuth full_host parameter to ensure redirect URIs are correct Closes #1967 --- CHANGELOG | 1 + config/initializers/7_omniauth.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 001d5350bad..38c56e91e1a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Set OmniAuth full_host parameter to ensure redirect URIs are correct (Stan Hu) - Expire Rails cache entries after two weeks to prevent endless Redis growth - Add support for destroying project milestones (Stan Hu) diff --git a/config/initializers/7_omniauth.rb b/config/initializers/7_omniauth.rb index df73ec1304a..7f73546ac89 100644 --- a/config/initializers/7_omniauth.rb +++ b/config/initializers/7_omniauth.rb @@ -11,6 +11,7 @@ if Gitlab::LDAP::Config.enabled? end end +OmniAuth.config.full_host = Settings.gitlab['url'] OmniAuth.config.allowed_request_methods = [:post] #In case of auto sign-in, the GET method is used (users don't get to click on a button) OmniAuth.config.allowed_request_methods << :get if Gitlab.config.omniauth.auto_sign_in_with_provider.present? -- cgit v1.2.1 From dd6daf465624d0a4ec2bc232f647c0d484a82351 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 17 Jul 2015 20:40:56 -0400 Subject: Add test case for clicking line number anchor icon --- spec/javascripts/fixtures/line_highlighter.html.haml | 4 +++- spec/javascripts/line_highlighter_spec.js.coffee | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/spec/javascripts/fixtures/line_highlighter.html.haml b/spec/javascripts/fixtures/line_highlighter.html.haml index 15ad1d8968f..da1ebcdb23c 100644 --- a/spec/javascripts/fixtures/line_highlighter.html.haml +++ b/spec/javascripts/fixtures/line_highlighter.html.haml @@ -2,7 +2,9 @@ .file-content .line-numbers - 1.upto(25) do |i| - %a{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i}= i + %a{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i} + %i.fa.fa-link + = i %pre.code.highlight %code - 1.upto(25) do |i| diff --git a/spec/javascripts/line_highlighter_spec.js.coffee b/spec/javascripts/line_highlighter_spec.js.coffee index 14fa487ff7f..57453c716a5 100644 --- a/spec/javascripts/line_highlighter_spec.js.coffee +++ b/spec/javascripts/line_highlighter_spec.js.coffee @@ -48,6 +48,14 @@ describe 'LineHighlighter', -> clickLine(13) expect(spy).toHaveBeenPrevented() + it 'handles clicking on a child icon element', -> + spy = spyOn(@class, 'setHash').and.callThrough() + + $('#L13 i').mousedown().click() + + expect(spy).toHaveBeenCalledWith(13) + expect($('#LC13')).toHaveClass(@css) + describe 'without shiftKey', -> it 'highlights one line when clicked', -> clickLine(13) -- cgit v1.2.1 From 58b94be9a7e97112755041e30559ebc2ca0a8b1d Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Sun, 12 Jul 2015 22:46:51 +0200 Subject: Only load byebug on MRI This Gem relies on MRI specific debugging APIs. This at least allows installation on Rubinius/JRuby. --- Gemfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 9b7fd18ab19..ba32feba3e7 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,7 @@ gem "gitlab_git", '~> 7.2.5' gem 'gitlab-grack', '~> 2.0.2', require: 'grack' # LDAP Auth -# GitLab fork with several improvements to original library. For full list of changes +# GitLab fork with several improvements to original library. For full list of changes # see https://github.com/intridea/omniauth-ldap/compare/master...gitlabhq:master gem 'gitlab_omniauth-ldap', '1.2.1', require: "omniauth-ldap" @@ -54,9 +54,9 @@ gem 'gitlab_omniauth-ldap', '1.2.1', require: "omniauth-ldap" gem 'gollum-lib', '~> 4.0.2' # Language detection -# GitLab fork of linguist does not require pygments/python dependency. -# New version of original gem also dropped pygments support but it has strict -# dependency to unstable rugged version. We have internal issue for replacing +# GitLab fork of linguist does not require pygments/python dependency. +# New version of original gem also dropped pygments support but it has strict +# dependency to unstable rugged version. We have internal issue for replacing # fork with original gem when we meet on same rugged version - https://dev.gitlab.org/gitlab/gitlabhq/issues/2052. gem "gitlab-linguist", "~> 3.0.1", require: "linguist" @@ -227,7 +227,7 @@ end group :development, :test do gem 'awesome_print' - gem 'byebug' + gem 'byebug', platform: :mri gem 'fuubar', '~> 2.0.0' gem 'pry-rails' -- cgit v1.2.1 From 875d8e7f31db88443c3c573473b496945d7673a0 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 18 Jul 2015 07:32:18 -0700 Subject: Fix bug where notes were being rendered with wrong color preferences due to caching Closes #2008 --- app/views/projects/notes/_note.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index 5478a887f91..c8d705687da 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -56,7 +56,7 @@ .note-body{class: note_editable?(note) ? 'js-task-list-container' : ''} - = cache [note, 'markdown'] do + = cache [note, 'markdown', user_color_scheme_class] do .note-text = preserve do = markdown(note.note, {no_header_anchors: true}) -- cgit v1.2.1 From 682c0deffe4e1849a2dd5bd61d90aa08e4209681 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 18 Jul 2015 08:02:38 -0700 Subject: Remove redundant last push event if activity feed is set to main page Closes #2009 --- app/views/projects/show.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index b90cadfb1e2..769dd68f089 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -6,7 +6,9 @@ = render 'shared/no_ssh' = render 'shared/no_password' -= render 'projects/last_push' +- if prefer_readme? + = render 'projects/last_push' + = render "home_panel" .project-stats -- cgit v1.2.1 From f92bbd2f284530b0c05bc179a60ceb9751556026 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 18 Jul 2015 18:05:07 -0400 Subject: Show the first tab automatically on MergeRequests#new Closes #2013 --- app/assets/javascripts/merge_request.js.coffee | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee index 7462975bd3d..b21cb7904b5 100644 --- a/app/assets/javascripts/merge_request.js.coffee +++ b/app/assets/javascripts/merge_request.js.coffee @@ -15,9 +15,7 @@ class @MergeRequest this.$('.show-all-commits').on 'click', => this.showAllCommits() - # `MergeRequests#new` has no tab-persisting or lazy-loading behavior - unless @opts.action == 'new' - new MergeRequestTabs(@opts) + @initTabs() # Prevent duplicate event bindings @disableTaskList() @@ -29,6 +27,14 @@ class @MergeRequest $: (selector) -> this.$el.find(selector) + initTabs: -> + if @opts.action != 'new' + # `MergeRequests#new` has no tab-persisting or lazy-loading behavior + new MergeRequestTabs(@opts) + else + # Show the first tab (Commits) + $('.merge-request-tabs a[data-toggle="tab"]:first').tab('show') + showAllCommits: -> this.$('.first-commits').remove() this.$('.all-commits').removeClass 'hide' -- cgit v1.2.1 From 19163f84fbec0e1798300c62745d1f747259eb61 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 18 Jul 2015 15:57:11 -0700 Subject: Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in Closes #1612 --- CHANGELOG | 1 + config/initializers/doorkeeper.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index c4877042fed..9fe1e8c90c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in (Stan Hu) - Fix file upload dialog for comment editing (Daniel Gerhardt) - Expire Rails cache entries after two weeks to prevent endless Redis growth - Add support for destroying project milestones (Stan Hu) diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index d422acb31d6..6139ddbe6cd 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -6,7 +6,8 @@ Doorkeeper.configure do # This block will be called to check whether the resource owner is authenticated or not. resource_owner_authenticator do # Put your resource owner authentication logic here. - # Example implementation: + # Ensure user is redirected to redirect_uri after login + session[:user_return_to] = request.fullpath current_user || redirect_to(new_user_session_url) end -- cgit v1.2.1 From 69417d36b2fa4dfbe2205c4df1428eb17ebd061e Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt Date: Sun, 19 Jul 2015 20:58:59 +0200 Subject: Fix label read access for unauthenticated users The label page was added to navigation for unauthorized users because the previously used milestone read permission was still checked. This has been fixed and read access to labels is now granted (again) for public projects. This regression has been introduced in 07efb17e10fe26a01b60d8441868f9fbda0768f2 (7.12). See also 9bcd36396b9b71467f66dd4ed79ab709bb5d027a. Refs !836, !842. --- CHANGELOG | 1 + app/helpers/projects_helper.rb | 6 +++++- app/models/ability.rb | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 9fe1e8c90c7..b1d079ef207 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Fix label read access for unauthenticated users (Daniel Gerhardt) - Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in (Stan Hu) - Fix file upload dialog for comment editing (Daniel Gerhardt) - Expire Rails cache entries after two weeks to prevent endless Redis growth diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index f61baf00525..3cd52b381bd 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -131,8 +131,12 @@ module ProjectsHelper nav_tabs << :snippets end + if can?(current_user, :read_label, project) + nav_tabs << :labels + end + if can?(current_user, :read_milestone, project) - nav_tabs << [:milestones, :labels] + nav_tabs << :milestones end nav_tabs.flatten diff --git a/app/models/ability.rb b/app/models/ability.rb index d3631d49ec6..7dab50d47d4 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -35,6 +35,7 @@ class Ability :read_project, :read_wiki, :read_issue, + :read_label, :read_milestone, :read_project_snippet, :read_project_member, -- cgit v1.2.1 From e65b08106282015955fce52e818b7431d5cb2e83 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sun, 19 Jul 2015 16:48:33 -0400 Subject: Dynamically check `:admin_*` ability in issuable context Closes #2001 --- app/views/shared/issuable/_context.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/shared/issuable/_context.html.haml b/app/views/shared/issuable/_context.html.haml index 46990895d33..d1bd5ef968d 100644 --- a/app/views/shared/issuable/_context.html.haml +++ b/app/views/shared/issuable/_context.html.haml @@ -8,7 +8,7 @@ - else none .issuable-context-selectbox - - if can?(current_user, :admin_issue, @project) + - if can?(current_user, :"admin_#{issuable.class.to_s.underscore}", @project) = users_select_tag("#{issuable.class.table_name.singularize}[assignee_id]", placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: issuable.assignee_id, project: @target_project, null_user: true) %div.prepend-top-20.clearfix @@ -24,7 +24,7 @@ - else none .issuable-context-selectbox - - if can?(current_user, :admin_issue, @project) + - if can?(current_user, :"admin_#{issuable.class.to_s.underscore}", @project) = f.select(:milestone_id, milestone_options(issuable), { include_blank: 'Select milestone' }, {class: 'select2 select2-compact js-select2 js-milestone'}) = hidden_field_tag :issuable_context = f.submit class: 'btn hide' -- cgit v1.2.1 From 5eeab9f0a62f4843dcef2a7fb2f7f67610bef22d Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 20 Jul 2015 00:53:43 +0200 Subject: GoogleCode importer: Do not care about casing of image file extensions Signed-off-by: Sven Strickroth --- lib/gitlab/google_code_import/importer.rb | 2 +- spec/fixtures/GoogleCodeProjectHosting.json | 5 +++++ spec/lib/gitlab/google_code_import/importer_spec.rb | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/google_code_import/importer.rb b/lib/gitlab/google_code_import/importer.rb index 70bfe059776..03c410726a5 100644 --- a/lib/gitlab/google_code_import/importer.rb +++ b/lib/gitlab/google_code_import/importer.rb @@ -327,7 +327,7 @@ module Gitlab link = "https://storage.googleapis.com/google-code-attachments/#{@repo.name}/issue-#{issue_id}/comment-#{comment_id}/#{filename}" text = "[#{filename}](#{link})" - text = "!#{text}" if filename =~ /\.(png|jpg|jpeg|gif|bmp|tiff)\z/ + text = "!#{text}" if filename =~ /\.(png|jpg|jpeg|gif|bmp|tiff)\z/i text end.compact end diff --git a/spec/fixtures/GoogleCodeProjectHosting.json b/spec/fixtures/GoogleCodeProjectHosting.json index d05e77271ae..67bb3bae5b7 100644 --- a/spec/fixtures/GoogleCodeProjectHosting.json +++ b/spec/fixtures/GoogleCodeProjectHosting.json @@ -382,6 +382,11 @@ "fileName" : "screenshot.png", "fileSize" : 0, "mimetype" : "image/png" + }, { + "attachmentId" : "001", + "fileName" : "screenshot1.PNG", + "fileSize" : 0, + "mimetype" : "image/x-png" } ] }, { "id" : 1, diff --git a/spec/lib/gitlab/google_code_import/importer_spec.rb b/spec/lib/gitlab/google_code_import/importer_spec.rb index c53ddeb87b5..f49cbb7f532 100644 --- a/spec/lib/gitlab/google_code_import/importer_spec.rb +++ b/spec/lib/gitlab/google_code_import/importer_spec.rb @@ -65,6 +65,7 @@ describe Gitlab::GoogleCodeImport::Importer do expect(issue.description).to include('all the best!') expect(issue.description).to include('[tint2_task_scrolling.diff](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/tint2_task_scrolling.diff)') expect(issue.description).to include('![screenshot.png](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/screenshot.png)') + expect(issue.description).to include('![screenshot1.PNG](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/screenshot1.PNG)') end it "imports issue comments" do -- cgit v1.2.1 From e1811316d73ea0b240d7f47e1de557b712ed4cee Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 19 Jul 2015 22:53:14 -0700 Subject: Remove repository graph log to fix slow cache updates after push event Recalculating graph_log took minutes on a large repository since each of the 6000 commits would need to calculate the diff. Since graph_log does not appear to be used, remove it from the list of things to update. For the Linux kernel repository, this reduced the ProjectCacheWorker time from 8+ minutes to 16 seconds. Closes #2016 --- CHANGELOG | 1 + app/models/repository.rb | 20 +------------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b1d079ef207..ed23ee4a90c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Remove repository graph log to fix slow cache updates after push event (Stan Hu) - Fix label read access for unauthenticated users (Daniel Gerhardt) - Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in (Stan Hu) - Fix file upload dialog for comment editing (Daniel Gerhardt) diff --git a/app/models/repository.rb b/app/models/repository.rb index 1d208aa71c4..807b33b2a3e 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -119,7 +119,7 @@ class Repository end def cache_keys - %i(size branch_names tag_names commit_count graph_log + %i(size branch_names tag_names commit_count readme version contribution_guide changelog license) end @@ -144,24 +144,6 @@ class Repository end end - def graph_log - cache.fetch(:graph_log) do - commits = raw_repository.log(limit: 6000, skip_merges: true, - ref: root_ref) - - commits.map do |rugged_commit| - commit = Gitlab::Git::Commit.new(rugged_commit) - - { - author_name: commit.author_name, - author_email: commit.author_email, - additions: commit.stats.additions, - deletions: commit.stats.deletions, - } - end - end - end - def lookup_cache @lookup_cache ||= {} end -- cgit v1.2.1 From 4a0e4c857f799d2e3cc5d5dc37de6da784661965 Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt Date: Sun, 19 Jul 2015 23:21:33 +0200 Subject: Fix access to disabled features for unauthenticated users Unauthenticated users had access to disabled features of public projects. The code has been slightly refactored so that feature checks are done in a separate method and can also be applied for public access. --- CHANGELOG | 1 + app/models/ability.rb | 54 +++++++++++++++++++++++++++++---------------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9fe1e8c90c7..cc39373fd44 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Fix access to disabled features for unauthenticated users (Daniel Gerhardt) - Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in (Stan Hu) - Fix file upload dialog for comment editing (Daniel Gerhardt) - Expire Rails cache entries after two weeks to prevent endless Redis growth diff --git a/app/models/ability.rb b/app/models/ability.rb index d3631d49ec6..6cffc46cec3 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -31,7 +31,7 @@ class Ability end if project && project.public? - [ + rules = [ :read_project, :read_wiki, :read_issue, @@ -42,6 +42,8 @@ class Ability :read_note, :download_code ] + + rules - project_disabled_features_rules(project) else group = if subject.kind_of?(Group) subject @@ -102,28 +104,7 @@ class Ability rules -= project_archived_rules end - unless project.issues_enabled - rules -= named_abilities('issue') - end - - unless project.merge_requests_enabled - rules -= named_abilities('merge_request') - end - - unless project.issues_enabled or project.merge_requests_enabled - rules -= named_abilities('label') - rules -= named_abilities('milestone') - end - - unless project.snippets_enabled - rules -= named_abilities('project_snippet') - end - - unless project.wiki_enabled - rules -= named_abilities('wiki') - end - - rules + rules - project_disabled_features_rules(project) end end @@ -205,6 +186,33 @@ class Ability ] end + def project_disabled_features_rules(project) + rules = [] + + unless project.issues_enabled + rules += named_abilities('issue') + end + + unless project.merge_requests_enabled + rules += named_abilities('merge_request') + end + + unless project.issues_enabled or project.merge_requests_enabled + rules += named_abilities('label') + rules += named_abilities('milestone') + end + + unless project.snippets_enabled + rules += named_abilities('project_snippet') + end + + unless project.wiki_enabled + rules += named_abilities('wiki') + end + + rules + end + def group_abilities(user, group) rules = [] -- cgit v1.2.1 From c61e7dd4ac76b23a1089041ba4a41fd7b56166e0 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 20 Jul 2015 13:54:56 +0300 Subject: Public project activity page asks for sign-in --- app/controllers/projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b191819a117..586359f3080 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,6 +1,6 @@ class ProjectsController < ApplicationController prepend_before_filter :render_go_import, only: [:show] - skip_before_action :authenticate_user!, only: [:show] + skip_before_action :authenticate_user!, only: [:show, :activity] before_action :project, except: [:new, :create] before_action :repository, except: [:new, :create] -- cgit v1.2.1 From 374b95c38e2b178d0a0b006c41ed12cd272bdb9f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 19 Mar 2015 09:36:07 -0400 Subject: merge_requests: add fetch command to the MR page --- CHANGELOG | 1 + app/views/projects/merge_requests/_show.html.haml | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 0db3dfc04a5..881b2705274 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ v 7.14.0 (unreleased) - Set OmniAuth full_host parameter to ensure redirect URIs are correct (Stan Hu) - Expire Rails cache entries after two weeks to prevent endless Redis growth - Add support for destroying project milestones (Stan Hu) + - Add fetch command to the MR page. v 7.13.0 (unreleased) - Only enable HSTS header for HTTPS and port 443 (Stan Hu) diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml index b6d9b135c70..faaa85896cf 100644 --- a/app/views/projects/merge_requests/_show.html.haml +++ b/app/views/projects/merge_requests/_show.html.haml @@ -31,6 +31,16 @@ %li= link_to "Email Patches", merge_request_path(@merge_request, format: :patch) %li= link_to "Plain Diff", merge_request_path(@merge_request, format: :diff) + - if @merge_request.open? and @merge_request.source_branch_exists? + .append-bottom-20 + .slead + %span + Fetch the branch with + %strong.label-branch< + git fetch + \ #{@merge_request.source_project.http_url_to_repo} + \ #{@merge_request.source_branch} + = render "projects/merge_requests/show/how_to_merge" = render "projects/merge_requests/widget/show.html.haml" -- cgit v1.2.1 From e252410058a5aab0cb0427aeb0768b19b0fce4de Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt Date: Mon, 20 Jul 2015 18:56:49 +0200 Subject: Fix change log for 7.11 and move entry to 7.12 The change log for 7.11 was accidentally split in 3865a1d92585cb31864b5d0f1b325c3585b5c681. Additionally, the change added with this commit did not make it into 7.11 according to `git branch --contains` and it has not been cherry picked to 7-11-stable so the entry is moved to 7.12. Refs GH-5625, GH-9318. [ci skip] --- CHANGELOG | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d249a014802..052f4865d69 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -134,6 +134,7 @@ v 7.12.0 - Improve group removing logic - Trigger create-hooks on backup restore task - Add option to automatically link omniauth and LDAP identities + - Allow special character in users bio. I.e.: I <3 GitLab v 7.11.4 - Fix missing bullets when creating lists @@ -152,9 +153,6 @@ v 7.11.1 v 7.11.0 - Fall back to Plaintext when Syntaxhighlighting doesn't work. Fixes some buggy lexers (Hannes Rosenögger) - Get editing comments to work in Chrome 43 again. - - Allow special character in users bio. I.e.: I <3 GitLab - -v 7.11.0 - Fix broken view when viewing history of a file that includes a path that used to be another file (Stan Hu) - Don't show duplicate deploy keys - Fix commit time being displayed in the wrong timezone in some cases (Hannes Rosenögger) -- cgit v1.2.1 From 346b07497989c824b201e501dfa24b8af630da8a Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 21 Jul 2015 10:37:27 +0200 Subject: Don't stop if database.sql.gz already exists The existing behavior of the backups is to overwrite whatever data was still there in the scratch directories. This broke when we added a 'gzip' step because 'gzip database.sql' will fail if 'database.sql.gz' already exists. Doing 'rm -f database.sql.gz' before the 'gzip' avoids this failure. --- lib/backup/database.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/backup/database.rb b/lib/backup/database.rb index b8aa6b9ff2f..c5a5396cbbf 100644 --- a/lib/backup/database.rb +++ b/lib/backup/database.rb @@ -25,6 +25,7 @@ module Backup abort 'Backup failed' unless success $progress.print 'Compressing database ... ' + FileUtils.rm_f db_file_name_gz success = system('gzip', db_file_name) report_success(success) abort 'Backup failed: compress error' unless success -- cgit v1.2.1 From 280576a2d5a4d1167504ee48e1d4d00a8339a5be Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Tue, 21 Jul 2015 10:40:05 +0000 Subject: Update changelog --- CHANGELOG | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 052f4865d69..6920adeaf16 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,6 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) - - Remove repository graph log to fix slow cache updates after push event (Stan Hu) - Fix label read access for unauthenticated users (Daniel Gerhardt) - Fix access to disabled features for unauthenticated users (Daniel Gerhardt) - Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in (Stan Hu) @@ -12,6 +11,7 @@ v 7.14.0 (unreleased) - Add fetch command to the MR page. v 7.13.0 (unreleased) + - Remove repository graph log to fix slow cache updates after push event (Stan Hu) - Only enable HSTS header for HTTPS and port 443 (Stan Hu) - Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu) - Fix redirection to home page URL for unauthorized users (Daniel Gerhardt) @@ -1587,4 +1587,4 @@ v 0.8.0 - stability - security fixes - increased test coverage - - email notification + - email notification \ No newline at end of file -- cgit v1.2.1 From 96819d2fb42b65066f4adcc5e48daf65a58449ec Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 21 Jul 2015 14:35:58 +0200 Subject: You need to store your DB encryption key --- doc/profile/two_factor_authentication.md | 5 +++++ doc/raketasks/backup_restore.md | 35 ++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/doc/profile/two_factor_authentication.md b/doc/profile/two_factor_authentication.md index fb215c8b269..f60ce35d3e2 100644 --- a/doc/profile/two_factor_authentication.md +++ b/doc/profile/two_factor_authentication.md @@ -63,5 +63,10 @@ your phone's application or a recovery code to log in. 1. Go to **Account**. 1. Click **Disable Two-factor Authentication**. +## Note to GitLab administrators + +You need to take special care to that 2FA keeps working after +[restoring a GitLab backup](../raketasks/backup_restore.md). + [Google Authenticator]: https://support.google.com/accounts/answer/1066447?hl=en [FreeOTP]: https://fedorahosted.org/freeotp/ diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index 39a13b14fba..36ab2b91959 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -9,6 +9,13 @@ This archive will be saved in backup_path (see `config/gitlab.yml`). The filename will be `[TIMESTAMP]_gitlab_backup.tar`. This timestamp can be used to restore an specific backup. You can only restore a backup to exactly the same version of GitLab that you created it on, for example 7.2.1. +You need to keep a separate copy of `/etc/gitlab/gitlab-secrets.json` +(for omnibus packages) or `/home/git/gitlab/.secret` (for installations +from source). This file contains the database encryption key used +for two-factor authentication. If you restore a GitLab backup without +restoring the database encryption key, users who have two-factor +authentication enabled will loose access to your GitLab server. + If you are interested in GitLab CI backup please follow to the [CI backup documentation](https://gitlab.com/gitlab-org/gitlab-ci/blob/master/doc/raketasks/backup_restore.md)* ``` @@ -143,15 +150,39 @@ with the name of your bucket: ## Storing configuration files -Please be informed that a backup does not store your configuration files. +Please be informed that a backup does not store your configuration +files. One reason for this is that your database contains encrypted +information for two-factor authentication. Storing encrypted +information along with its key in the same place defeats the purpose +of using encryption in the first place! + If you use an Omnibus package please see the [instructions in the readme to backup your configuration](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#backup-and-restore-omnibus-gitlab-configuration). If you have a cookbook installation there should be a copy of your configuration in Chef. -If you have an installation from source, please consider backing up your `gitlab.yml` file, any SSL keys and certificates, and your [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079). +If you have an installation from source, please consider backing up your `.secret` file, `gitlab.yml` file, any SSL keys and certificates, and your [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079). + +At the very **minimum** you should backup `/etc/gitlab/gitlab-secrets.json` +(Omnibus) or `/home/git/gitlab/.secret` (source) to preserve your +database encryption key. ## Restore a previously created backup You can only restore a backup to exactly the same version of GitLab that you created it on, for example 7.2.1. +### Prerequisites + +You need to have a working GitLab installation before you can perform +a restore. This is mainly because the system user performing the +restore actions ('git') is usually not allowed to create or delete +the SQL database it needs to import data into ('gitlabhq_production'). +All existing data will be either erased (SQL) or moved to a separate +directory (repositories, uploads). + +If some or all of your GitLab users are using two-factor authentication +(2FA) then you must also make sure to restore +`/etc/gitlab/gitlab-secrets.json` (Omnibus) or `/home/git/gitlab/.secret` +(installations from source). Note that you need to run `gitlab-ctl +reconfigure` after changing `gitlab-secrets.json`. + ### Installation from source ``` -- cgit v1.2.1 From 65bd871be7112c32065ddd01b166d309c6efe06c Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt Date: Tue, 21 Jul 2015 19:15:52 +0200 Subject: Fix full screen mode for snippet comments ZenMode is now initialized for snippet pages. Fixes #2036. --- CHANGELOG | 1 + app/assets/javascripts/dispatcher.js.coffee | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 6920adeaf16..dab74b654b0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Fix full screen mode for snippet comments (Daniel Gerhardt) - Fix label read access for unauthenticated users (Daniel Gerhardt) - Fix access to disabled features for unauthenticated users (Daniel Gerhardt) - Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in (Stan Hu) diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index 2ab148bc296..81e73799271 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -128,7 +128,10 @@ class Dispatcher shortcut_handler = new ShortcutsNavigation() new ZenMode() new DropzoneInput($('.wiki-form')) - when 'snippets', 'labels', 'graphs' + when 'snippets' + shortcut_handler = new ShortcutsNavigation() + new ZenMode() if path[2] == 'show' + when 'labels', 'graphs' shortcut_handler = new ShortcutsNavigation() when 'project_members', 'deploy_keys', 'hooks', 'services', 'protected_branches' shortcut_handler = new ShortcutsNavigation() -- cgit v1.2.1 From 643557dabccbb3a503b0867ae44ec5701759d2a8 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 20 Jul 2015 16:55:45 -0700 Subject: Fix 404 error in files view after deleting the last file in a repository Closes #1362 --- CHANGELOG | 1 + app/controllers/projects/tree_controller.rb | 4 +- spec/controllers/projects/tree_controller_spec.rb | 91 +++++++++++++++++++++++ spec/controllers/tree_controller_spec.rb | 68 ----------------- spec/requests/api/branches_spec.rb | 9 ++- spec/support/test_env.rb | 11 ++- 6 files changed, 111 insertions(+), 73 deletions(-) create mode 100644 spec/controllers/projects/tree_controller_spec.rb delete mode 100644 spec/controllers/tree_controller_spec.rb diff --git a/CHANGELOG b/CHANGELOG index 052f4865d69..038a4d95d7e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) + - Fix 404 error in files view after deleting the last file in a repository (Stan Hu) - Remove repository graph log to fix slow cache updates after push event (Stan Hu) - Fix label read access for unauthenticated users (Daniel Gerhardt) - Fix access to disabled features for unauthenticated users (Daniel Gerhardt) diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index b659e15f242..92e4bc16d9d 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -7,13 +7,15 @@ class Projects::TreeController < Projects::ApplicationController before_action :authorize_download_code! def show + return not_found! unless @repository.commit(@ref) + if tree.entries.empty? if @repository.blob_at(@commit.id, @path) redirect_to( namespace_project_blob_path(@project.namespace, @project, File.join(@ref, @path)) ) and return - else + elsif @path.present? return not_found! end end diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb new file mode 100644 index 00000000000..53915856357 --- /dev/null +++ b/spec/controllers/projects/tree_controller_spec.rb @@ -0,0 +1,91 @@ +require 'spec_helper' + +describe Projects::TreeController do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + sign_in(user) + + project.team << [user, :master] + controller.instance_variable_set(:@project, project) + end + + describe "GET show" do + # Make sure any errors accessing the tree in our views bubble up to this spec + render_views + + before do + get(:show, + namespace_id: project.namespace.to_param, + project_id: project.to_param, + id: id) + end + + context "valid branch, no path" do + let(:id) { 'master' } + it { is_expected.to respond_with(:success) } + end + + context "valid branch, valid path" do + let(:id) { 'master/encoding/' } + it { is_expected.to respond_with(:success) } + end + + context "valid branch, invalid path" do + let(:id) { 'master/invalid-path/' } + it { is_expected.to respond_with(:not_found) } + end + + context "invalid branch, valid path" do + let(:id) { 'invalid-branch/encoding/' } + it { is_expected.to respond_with(:not_found) } + end + + context "valid empty branch, invalid path" do + let(:id) { 'empty-branch/invalid-path/' } + it { is_expected.to respond_with(:not_found) } + end + + context "valid empty branch" do + let(:id) { 'empty-branch' } + it { is_expected.to respond_with(:success) } + end + + context "invalid SHA commit ID" do + let(:id) { 'ff39438/.gitignore' } + it { is_expected.to respond_with(:not_found) } + end + + context "valid SHA commit ID" do + let(:id) { '6d39438' } + it { is_expected.to respond_with(:success) } + end + + context "valid SHA commit ID with path" do + let(:id) { '6d39438/.gitignore' } + it { expect(response.status).to eq(302) } + end + + end + + describe 'GET show with blob path' do + render_views + + before do + get(:show, + namespace_id: project.namespace.to_param, + project_id: project.to_param, + id: id) + end + + context 'redirect to blob' do + let(:id) { 'master/README.md' } + it 'redirects' do + redirect_url = "/#{project.path_with_namespace}/blob/master/README.md" + expect(subject). + to redirect_to(redirect_url) + end + end + end +end diff --git a/spec/controllers/tree_controller_spec.rb b/spec/controllers/tree_controller_spec.rb deleted file mode 100644 index e09caf5df13..00000000000 --- a/spec/controllers/tree_controller_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'spec_helper' - -describe Projects::TreeController do - let(:project) { create(:project) } - let(:user) { create(:user) } - - before do - sign_in(user) - - project.team << [user, :master] - - allow(project).to receive(:branches).and_return(['master', 'foo/bar/baz']) - allow(project).to receive(:tags).and_return(['v1.0.0', 'v2.0.0']) - controller.instance_variable_set(:@project, project) - end - - describe "GET show" do - # Make sure any errors accessing the tree in our views bubble up to this spec - render_views - - before do - get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, - id: id) - end - - context "valid branch, no path" do - let(:id) { 'master' } - it { is_expected.to respond_with(:success) } - end - - context "valid branch, valid path" do - let(:id) { 'master/encoding/' } - it { is_expected.to respond_with(:success) } - end - - context "valid branch, invalid path" do - let(:id) { 'master/invalid-path/' } - it { is_expected.to respond_with(:not_found) } - end - - context "invalid branch, valid path" do - let(:id) { 'invalid-branch/encoding/' } - it { is_expected.to respond_with(:not_found) } - end - end - - describe 'GET show with blob path' do - render_views - - before do - get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, - id: id) - end - - context 'redirect to blob' do - let(:id) { 'master/README.md' } - it 'redirects' do - redirect_url = "/#{project.path_with_namespace}/blob/master/README.md" - expect(subject). - to redirect_to(redirect_url) - end - end - end -end diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index cb6e5e89625..bb3862c9eb2 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -13,11 +13,18 @@ describe API::API, api: true do let!(:branch_sha) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } describe "GET /projects/:id/repository/branches" do + before do + # Ensure that repository.branch_names is cleared from the cache at start to ensure + # the list matches reality + Rails.cache.clear + end + it "should return an array of project branches" do get api("/projects/#{project.id}/repository/branches", user) expect(response.status).to eq(200) expect(json_response).to be_an Array - expect(json_response.first['name']).to eq(project.repository.branch_names.first) + branch_names = json_response.map { |x| x['name'] } + expect(branch_names).to match_array(project.repository.branch_names) end end diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 8bdd6b43cdd..dcf2a9e2ce5 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -5,6 +5,7 @@ module TestEnv # When developing the seed repository, comment out the branch you will modify. BRANCH_SHA = { + 'empty-branch' => '7efb185', 'flatten-dir' => 'e56497b', 'feature' => '0b4bc9a', 'feature_conflict' => 'bb5206f', @@ -14,9 +15,13 @@ module TestEnv 'master' => '5937ac0' } - FORKED_BRANCH_SHA = BRANCH_SHA.merge({ - 'add-submodule-version-bump' => '3f547c08' - }) + # gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily + # need to keep all the branches in sync. + # We currently only need a subset of the branches + FORKED_BRANCH_SHA = { + 'add-submodule-version-bump' => '3f547c08', + 'master' => '5937ac0' + } # Test environment # -- cgit v1.2.1 From 42130a97e992f608bf5deaf2afbe203f21d2e2b3 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Tue, 21 Jul 2015 15:45:12 -0700 Subject: added Fork Project document --- doc/gitlab-basics/README.md | 2 ++ doc/gitlab-basics/create-branch.md | 3 ++- doc/gitlab-basics/fork-project.md | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 doc/gitlab-basics/fork-project.md diff --git a/doc/gitlab-basics/README.md b/doc/gitlab-basics/README.md index 63fa7a90a26..d6272cd5912 100644 --- a/doc/gitlab-basics/README.md +++ b/doc/gitlab-basics/README.md @@ -15,3 +15,5 @@ Step-by-step guides on the basics of working with Git and GitLab. * [Create a group](create-group.md) * [Create a branch](create-branch.md) + +* [Fork a project](fork-project.md) diff --git a/doc/gitlab-basics/create-branch.md b/doc/gitlab-basics/create-branch.md index a8afbfe53d7..7556b0f663e 100644 --- a/doc/gitlab-basics/create-branch.md +++ b/doc/gitlab-basics/create-branch.md @@ -1,6 +1,7 @@ # How to create a branch A branch is an independent line of development. + New commits are recorded in the history for the current branch, which results in taking the source from someone’s repository (the place where the history of your work is stored) at certain point in time, and apply your own changes to it in the history of the project. To add changes to your GitLab project, you should create a branch. You can do it in your [shell](basic-git-commands.md) or in GitLab. @@ -32,7 +33,7 @@ Fill out the information required: ![Branch info](basicsimages/branch_info.png) ### Note: - + You will be able to find and select the name of your branch in the white box next to a project's name: ![Branch name](basicsimages/branch_name.png) diff --git a/doc/gitlab-basics/fork-project.md b/doc/gitlab-basics/fork-project.md new file mode 100644 index 00000000000..e97ec0959a4 --- /dev/null +++ b/doc/gitlab-basics/fork-project.md @@ -0,0 +1,19 @@ +# How to fork a project + +A fork is a copy of an original repository that you can put somewhere else +or where you can experiment and apply changes that you can later decide if +publishing or not, without affecting your original project. + +It takes just a few steps to fork a project in GitLab. + +Sign in to [gitlab.com](https://gitlab.com). + +Select a project on the right side of your screen: + +![Select a project](basicsimages/select_project.png) + +Click on the "fork" button on the right side of your screen: + +![Fork](simple_guide_images/fork.png) + +Click on the user or group to where you'd like to add the forked project. -- cgit v1.2.1 From afc8e922238e9d6146926b88fa94f18700bb64e1 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Tue, 21 Jul 2015 15:47:17 -0700 Subject: fixed image --- doc/gitlab-basics/fork-project.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/gitlab-basics/fork-project.md b/doc/gitlab-basics/fork-project.md index e97ec0959a4..5173aae2c0f 100644 --- a/doc/gitlab-basics/fork-project.md +++ b/doc/gitlab-basics/fork-project.md @@ -14,6 +14,6 @@ Select a project on the right side of your screen: Click on the "fork" button on the right side of your screen: -![Fork](simple_guide_images/fork.png) +![Fork](basicsimages/fork.png) Click on the user or group to where you'd like to add the forked project. -- cgit v1.2.1 From 913e1b217ec2d4c3cdb22e4b336ea11c0213cb97 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 21 Jul 2015 18:09:06 -0700 Subject: Remove 7.14 entry that was pushed to 7.13 --- CHANGELOG | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d26ac5bbfab..2765923124f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,7 +3,6 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.14.0 (unreleased) - Fix full screen mode for snippet comments (Daniel Gerhardt) - Fix 404 error in files view after deleting the last file in a repository (Stan Hu) - - Remove repository graph log to fix slow cache updates after push event (Stan Hu) - Fix label read access for unauthenticated users (Daniel Gerhardt) - Fix access to disabled features for unauthenticated users (Daniel Gerhardt) - Fix OAuth provider bug where GitLab would not go return to the redirect_uri after sign-in (Stan Hu) @@ -1590,4 +1589,4 @@ v 0.8.0 - stability - security fixes - increased test coverage - - email notification \ No newline at end of file + - email notification -- cgit v1.2.1 From 5aff5223d4ba675beae2673fe5ed204531f5b42c Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 21 Jul 2015 18:52:56 -0700 Subject: Clearing the entire Redis cache may be too expensive; just use the repository expire_cache method --- spec/requests/api/branches_spec.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index bb3862c9eb2..5c1b58535cc 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -13,13 +13,9 @@ describe API::API, api: true do let!(:branch_sha) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } describe "GET /projects/:id/repository/branches" do - before do - # Ensure that repository.branch_names is cleared from the cache at start to ensure - # the list matches reality - Rails.cache.clear - end - it "should return an array of project branches" do + project.repository.expire_cache + get api("/projects/#{project.id}/repository/branches", user) expect(response.status).to eq(200) expect(json_response).to be_an Array -- cgit v1.2.1 From 9a7645c8a4336ac592fb159ea5d39e6397ad56d9 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Thu, 23 Jul 2015 12:30:05 -0700 Subject: added note about labels in MR --- doc/workflow/labels.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/workflow/labels.md b/doc/workflow/labels.md index 085b7baf5ce..6e4840ca5ae 100644 --- a/doc/workflow/labels.md +++ b/doc/workflow/labels.md @@ -1,6 +1,6 @@ # Labels -In GitLab, you can easily tag issues and merge requests. If you have permission level `Developer` or higher, you can manage labels. To create, edit or delete a label, go to a project and then to `Issues` and then `Labels`. +In GitLab, you can easily tag issues and Merge Requests. If you have permission level `Developer` or higher, you can manage labels. To create, edit or delete a label, go to a project and then to `Issues` and then `Labels`. Here you can create a new label. @@ -14,3 +14,5 @@ If you want to change an existing label, press edit next to the listed label. You will be presented with the same form as when creating a new label. ![edit label](labels/label3.png) + +You can add labels to Merge Requests when you create or edit them. -- cgit v1.2.1 From f8471cd1872aec5141cab4e1dce715741f9eb9d3 Mon Sep 17 00:00:00 2001 From: karen Carias Date: Fri, 24 Jul 2015 18:05:52 -0700 Subject: added note about unique SSH keys --- doc/ssh/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/ssh/README.md b/doc/ssh/README.md index 5f44f9351dd..7cdcd11c04c 100644 --- a/doc/ssh/README.md +++ b/doc/ssh/README.md @@ -105,3 +105,6 @@ IdentityFile ~/my-ssh-key-directory/company-com-private-key-filename Note in the gitlab.com example above a username was specified to override the default chosen by OpenSSH (your local username). This is only required if your local and remote usernames differ. Due to the wide variety of SSH clients and their very large number of configuration options, further explanation of these topics is beyond the scope of this document. + +Public SSH keys need to be unique, as they will bind to your account. Your SSH key is the only identifier you'll +have when pushing code via SSH. That's why it needs to uniquely map to a single user. -- cgit v1.2.1