-
-
-

<%= t("debates.index.showing") %>

-
- -
-
-
- +
- -
-
- <% if @tag_filter %> -

- <%= t("debates.index.filter_topic", - number: @debates.size, - # TODO translation - topic: @tag_filter).html_safe %> -

- <% else %> -

Filtrar por tema:

+
+ <% if @tag_filter %> +

+ <%= t("debates.index.filter_topic", + number: @debates.size, + topic: @tag_filter).html_safe %> +

+ <% else %> +

<%= t("debates.index.select_topic") %>

+
+ +
+ <% end %> +
+ +
+
<%= t("debates.index.select_order") %>
- + <%= available_options_for_order_selector(@valid_orders, @order) %>
- <% end %> +
+
-
diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 9018777d3..c4d4d4487 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -410,16 +410,15 @@ feature 'Debates' do feature 'Debates can be filtered by tags', :js do let!(:debate1) { create(:debate, tag_list: ["Deporte", "Corrupción"]) } - let!(:debate2) { create(:debate, tag_list: ["Deporte", "Corrupción", "Fiestas populares"]) } + let!(:debate2) { create(:debate, tag_list: ["Deporte", "Fiestas populares"]) } let!(:debate3) { create(:debate, tag_list: ["Corrupción", "Fiestas populares"]) } scenario 'By default no tag filter is applied' do visit debates_path - expect(page).to have_content('Filtrar por tema') - expect(page).not_to have_content('con el tema') + expect(page).to have_content('Filter by topic') + expect(page).not_to have_content('with the topic') expect(page).to have_selector('#debates .debate', count: 3) - expect(current_url).to_not include('tag=') end scenario 'Debates are filtered by single tag' do @@ -427,17 +426,15 @@ feature 'Debates' do select('Deporte', from: 'tag-filter') - expect(page).not_to have_content('Filtrar por tema') - expect(page).to have_content('with the topic') + expect(page).not_to have_content('Filter by topic') expect(page).not_to have_select('tag-filter') + expect(page).to have_content('with the topic') expect(current_url).to include('tag=Deporte') - expect(page).to have_selector('#debates .debate', count: 2) + expect(page).to have_selector('#debates .debate', count: 2) expect(page).to_not have_content(debate3.title) expect(page).to have_content(debate1.title) expect(page).to have_content(debate2.title) end - end - end From fe9586bc29795e3b7bf0f95046c6ce3ae1c95244 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 28 Aug 2015 17:27:14 +0200 Subject: [PATCH 09/12] adds password protection for staging and production servers --- app/controllers/application_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4b9e75c56..9df8c4874 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ require "application_responder" class ApplicationController < ActionController::Base + before_filter :authenticate check_authorization unless: :devise_controller? include SimpleCaptcha::ControllerHelpers self.responder = ApplicationResponder @@ -15,6 +16,14 @@ class ApplicationController < ActionController::Base before_action :ensure_signup_complete + def authenticate + if Rails.env.staging? || Rails.env.production? + authenticate_or_request_with_http_basic do |username, password| + username == Rails.application.secrets.username && password == Rails.application.secrets.password + end + end + end + rescue_from CanCan::AccessDenied do |exception| redirect_to main_app.root_url, alert: exception.message end From a52d79cebdaf20b82e8156b080c8cb0c24a959b9 Mon Sep 17 00:00:00 2001 From: Marko Lovic Date: Fri, 28 Aug 2015 17:31:53 +0200 Subject: [PATCH 10/12] Remove unused I18n keys --- config/locales/en.yml | 1 - config/locales/es.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 9648c018e..5ef265900 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -32,7 +32,6 @@ en: debates: index: create_debate: Create a debate - showing: You are seeing debates select_order: Order by orders: created_at: newest diff --git a/config/locales/es.yml b/config/locales/es.yml index 126b5d8ed..b4bd0e050 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -32,7 +32,6 @@ es: debates: index: create_debate: Crea un debate - showing: "Estás viendo los debates" select_order: Ordenar por orders: created_at: "más nuevos" From b872d9a46d7ec67637d0ce3b4d8648e95df55053 Mon Sep 17 00:00:00 2001 From: kikito Date: Fri, 28 Aug 2015 19:19:18 +0200 Subject: [PATCH 11/12] fixes failing specs --- .rspec | 1 + app/models/comment.rb | 4 ---- app/views/comments/_comment.html.erb | 11 ++++++----- spec/features/moderation/comments_spec.rb | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.rspec b/.rspec index f26ef5abe..3525ac0b2 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,3 @@ --color +--format Fuubar diff --git a/app/models/comment.rb b/app/models/comment.rb index fa5f72164..c23c5c993 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -61,10 +61,6 @@ class Comment < ActiveRecord::Base cached_votes_down end - def not_visible? - hidden? || user.hidden? - end - def ignored_flag? ignored_flag_at.present? end diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 9052bc7cd..e21b148bc 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,12 +1,13 @@
- <% if comment.not_visible? && comment.children_count > 0 %> -
-

<%= t("debates.comment.deleted") %>

-
+ <% if comment.hidden? || comment.user.hidden? %> + <% if comment.children_count > 0 %> +
+

<%= t("debates.comment.deleted") %>

+
+ <% end %> <% else %> - <% if comment.as_administrator? %> <%= image_tag("admin_avatar.png", size: 32, class: "admin-avatar left") %> <% elsif comment.as_moderator? %> diff --git a/spec/features/moderation/comments_spec.rb b/spec/features/moderation/comments_spec.rb index 6c2689f0e..4fdef5c10 100644 --- a/spec/features/moderation/comments_spec.rb +++ b/spec/features/moderation/comments_spec.rb @@ -4,7 +4,7 @@ feature 'Moderate Comments' do feature 'Hiding Comments' do - scenario 'Hide', :js do + scenario 'Hide without children hides the comment completely', :js do citizen = create(:user) moderator = create(:moderator) @@ -23,7 +23,7 @@ feature 'Moderate Comments' do visit debate_path(debate) expect(page).to have_css('.comment', count: 1) - expect(page).to have_content('This comment has been deleted') + expect(page).to_not have_content('This comment has been deleted') expect(page).to_not have_content('SPAM') end From 9ca71929cfde38a435cee4e0a0897d813eebcd50 Mon Sep 17 00:00:00 2001 From: kikito Date: Fri, 28 Aug 2015 19:26:03 +0200 Subject: [PATCH 12/12] do not include foobar in rspec by default --- .rspec | 1 - 1 file changed, 1 deletion(-) diff --git a/.rspec b/.rspec index 3525ac0b2..f26ef5abe 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,2 @@ --color ---format Fuubar