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 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 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 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 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 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 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 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 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