Commit 784a2efa authored by Steve Azzopardi's avatar Steve Azzopardi

Merge branch 'ce-to-ee-2018-11-23' into 'master'

CE upstream - 2018-11-23 13:21 UTC

See merge request gitlab-org/gitlab-ee!8569
parents f1c10b7f aab56454
...@@ -233,7 +233,7 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -233,7 +233,7 @@ class Projects::BlobController < Projects::ApplicationController
def validate_diff_params def validate_diff_params
if [:since, :to, :offset].any? { |key| params[key].blank? } if [:since, :to, :offset].any? { |key| params[key].blank? }
render nothing: true head :ok
end end
end end
......
...@@ -105,7 +105,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -105,7 +105,7 @@ class Projects::BranchesController < Projects::ApplicationController
redirect_to project_branches_path(@project), status: :see_other redirect_to project_branches_path(@project), status: :see_other
end end
format.js { render nothing: true, status: result[:return_code] } format.js { head result[:return_code] }
format.json { render json: { message: result[:message] }, status: result[:return_code] } format.json { render json: { message: result[:message] }, status: result[:return_code] }
end end
end end
......
...@@ -215,7 +215,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -215,7 +215,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
def rebase def rebase
RebaseWorker.perform_async(@merge_request.id, current_user.id) RebaseWorker.perform_async(@merge_request.id, current_user.id)
render nothing: true, status: :ok head :ok
end end
protected protected
......
...@@ -362,6 +362,10 @@ module IssuablesHelper ...@@ -362,6 +362,10 @@ module IssuablesHelper
end end
end end
def has_filter_bar_param?
finder.class.scalar_params.any? { |p| params[p].present? }
end
private private
def sidebar_gutter_collapsed? def sidebar_gutter_collapsed?
......
...@@ -8,7 +8,12 @@ ...@@ -8,7 +8,12 @@
= image_tag 'illustrations/issues.svg' = image_tag 'illustrations/issues.svg'
.col-12 .col-12
.text-content .text-content
- if current_user - if has_filter_bar_param?
%h4.text-center
= _("Sorry, your filter produced no results")
%p.text-center
= _("To widen your search, change or remove filters above")
- elsif current_user
%h4 %h4
= _("The Issue Tracker is the place to add things that need to be improved or solved in a project") = _("The Issue Tracker is the place to add things that need to be improved or solved in a project")
%p %p
......
...@@ -8,16 +8,19 @@ ...@@ -8,16 +8,19 @@
= image_tag 'illustrations/merge_requests.svg' = image_tag 'illustrations/merge_requests.svg'
.col-12 .col-12
.text-content .text-content
- if has_button - if has_filter_bar_param?
%h4.text-center
= _("Sorry, your filter produced no results")
%p.text-center
= _("To widen your search, change or remove filters above")
- else
%h4 %h4
= _("Merge requests are a place to propose changes you've made to a project and discuss those changes with others") = _("Merge requests are a place to propose changes you've made to a project and discuss those changes with others")
%p %p
= _("Interested parties can even contribute by pushing commits if they want to.") = _("Interested parties can even contribute by pushing commits if they want to.")
.text-center - if has_button
- if project_select_button .text-center
= render 'shared/new_project_item_select', path: 'merge_requests/new', label: _('New merge request'), type: :merge_requests, with_feature_enabled: 'merge_requests' - if project_select_button
- else = render 'shared/new_project_item_select', path: 'merge_requests/new', label: _('New merge request'), type: :merge_requests, with_feature_enabled: 'merge_requests'
= link_to _('New merge request'), button_path, class: 'btn btn-success', title: _('New merge request'), id: 'new_merge_request_link' - else
- else = link_to _('New merge request'), button_path, class: 'btn btn-success', title: _('New merge request'), id: 'new_merge_request_link'
%h4.text-center
= _("There are no merge requests to show")
---
title: Show different empty state for filtered issues and MRs
merge_request: 22775
author: Heinrich Lee Yu
type: changed
---
title: render :nothing option is deprecated, Use head method to respond with empty
response body.
merge_request: 23311
author: Jasper Maes
type: other
...@@ -83,6 +83,12 @@ module Gitlab ...@@ -83,6 +83,12 @@ module Gitlab
# config.i18n.default_locale = :de # config.i18n.default_locale = :de
config.i18n.enforce_available_locales = false config.i18n.enforce_available_locales = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
# We have to explicitly set default locale since 1.1.0 - see:
# https://github.com/svenfuchs/i18n/pull/415
config.i18n.fallbacks = [:en]
# Translation for AR attrs is not working well for POROs like WikiPage # Translation for AR attrs is not working well for POROs like WikiPage
config.gettext_i18n_rails.use_for_active_record_attributes = false config.gettext_i18n_rails.use_for_active_record_attributes = false
......
...@@ -65,10 +65,6 @@ Rails.application.configure do ...@@ -65,10 +65,6 @@ Rails.application.configure do
# Enable threaded mode # Enable threaded mode
# config.threadsafe! unless $rails_rake_task # config.threadsafe! unless $rails_rake_task
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners # Send deprecation notices to registered listeners
config.active_support.deprecation = :notify config.active_support.deprecation = :notify
......
...@@ -7645,6 +7645,9 @@ msgstr "" ...@@ -7645,6 +7645,9 @@ msgstr ""
msgid "Sorry, no projects matched your search" msgid "Sorry, no projects matched your search"
msgstr "" msgstr ""
msgid "Sorry, your filter produced no results"
msgstr ""
msgid "Sort by" msgid "Sort by"
msgstr "" msgstr ""
...@@ -8160,9 +8163,6 @@ msgstr "" ...@@ -8160,9 +8163,6 @@ msgstr ""
msgid "There are no labels yet" msgid "There are no labels yet"
msgstr "" msgstr ""
msgid "There are no merge requests to show"
msgstr ""
msgid "There are no projects shared with this group yet" msgid "There are no projects shared with this group yet"
msgstr "" msgstr ""
...@@ -8641,6 +8641,9 @@ msgstr "" ...@@ -8641,6 +8641,9 @@ msgstr ""
msgid "To view the roadmap, add a start or due date to one of your epics in this group or its subgroups. In the months view, only epics in the past month, current month, and next 5 months are shown." msgid "To view the roadmap, add a start or due date to one of your epics in this group or its subgroups. In the months view, only epics in the past month, current month, and next 5 months are shown."
msgstr "" msgstr ""
msgid "To widen your search, change or remove filters above"
msgstr ""
msgid "To widen your search, change or remove filters." msgid "To widen your search, change or remove filters."
msgstr "" msgstr ""
......
...@@ -27,11 +27,11 @@ describe ControllerWithCrossProjectAccessCheck do ...@@ -27,11 +27,11 @@ describe ControllerWithCrossProjectAccessCheck do
if: -> { if_condition } if: -> { if_condition }
def index def index
render nothing: true head :ok
end end
def show def show
render nothing: true head :ok
end end
def unless_condition def unless_condition
...@@ -88,15 +88,15 @@ describe ControllerWithCrossProjectAccessCheck do ...@@ -88,15 +88,15 @@ describe ControllerWithCrossProjectAccessCheck do
if: -> { if_condition } if: -> { if_condition }
def index def index
render nothing: true head :ok
end end
def show def show
render nothing: true head :ok
end end
def edit def edit
render nothing: true head :ok
end end
def unless_condition def unless_condition
......
...@@ -10,7 +10,7 @@ describe LfsRequest do ...@@ -10,7 +10,7 @@ describe LfsRequest do
def show def show
storage_project storage_project
render nothing: true head :ok
end end
def project def project
......
...@@ -8,6 +8,17 @@ describe 'Issues' do ...@@ -8,6 +8,17 @@ describe 'Issues' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public) }
shared_examples_for 'empty state with filters' do
it 'user sees empty state with filters' do
create(:issue, author: user, project: project)
visit project_issues_path(project, milestone_title: "1.0")
expect(page).to have_content('Sorry, your filter produced no results')
expect(page).to have_content('To widen your search, change or remove filters above')
end
end
describe 'while user is signed out' do describe 'while user is signed out' do
describe 'empty state' do describe 'empty state' do
it 'user sees empty state' do it 'user sees empty state' do
...@@ -17,6 +28,8 @@ describe 'Issues' do ...@@ -17,6 +28,8 @@ describe 'Issues' do
expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project.') expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project.')
expect(page).to have_content('You can register or sign in to create issues for this project.') expect(page).to have_content('You can register or sign in to create issues for this project.')
end end
it_behaves_like 'empty state with filters'
end end
end end
...@@ -37,6 +50,8 @@ describe 'Issues' do ...@@ -37,6 +50,8 @@ describe 'Issues' do
expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.') expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')
expect(page).to have_content('New issue') expect(page).to have_content('New issue')
end end
it_behaves_like 'empty state with filters'
end end
describe 'Edit issue' do describe 'Edit issue' do
......
...@@ -19,12 +19,20 @@ describe 'Merge request > User sees empty state' do ...@@ -19,12 +19,20 @@ describe 'Merge request > User sees empty state' do
context 'if there are merge requests' do context 'if there are merge requests' do
before do before do
create(:merge_request, source_project: project) create(:merge_request, source_project: project)
visit project_merge_requests_path(project)
end end
it 'does not show an empty state' do it 'does not show an empty state' do
visit project_merge_requests_path(project)
expect(page).not_to have_selector('.empty-state') expect(page).not_to have_selector('.empty-state')
end end
it 'shows empty state when filter results empty' do
visit project_merge_requests_path(project, milestone_title: "1.0")
expect(page).to have_selector('.empty-state')
expect(page).to have_content('Sorry, your filter produced no results')
expect(page).to have_content('To widen your search, change or remove filters above')
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment