diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss
index 5afa088d1..08f95cd41 100644
--- a/app/assets/stylesheets/admin.scss
+++ b/app/assets/stylesheets/admin.scss
@@ -164,6 +164,11 @@ body.admin {
font-size: rem-calc(12);
}
+.ignored {
+ color: $text-medium;
+ font-size: rem-calc(12);
+}
+
.rejected {
color: $delete;
}
diff --git a/app/controllers/moderation/comments_controller.rb b/app/controllers/moderation/comments_controller.rb
index 0570ab5d3..3622d02ac 100644
--- a/app/controllers/moderation/comments_controller.rb
+++ b/app/controllers/moderation/comments_controller.rb
@@ -19,8 +19,8 @@ class Moderation::CommentsController < Moderation::BaseController
redirect_to request.query_parameters.merge(action: :index)
end
- def archive
- @comment.archive
+ def ignore_flag
+ @comment.ignore_flag
redirect_to request.query_parameters.merge(action: :index)
end
@@ -31,7 +31,7 @@ class Moderation::CommentsController < Moderation::BaseController
end
def set_valid_filters
- @valid_filters = %w{all pending archived}
+ @valid_filters = %w{all pending_flag_review with_ignored_flag}
end
def parse_filter
diff --git a/app/controllers/moderation/debates_controller.rb b/app/controllers/moderation/debates_controller.rb
index fdc09b61d..abb8e964b 100644
--- a/app/controllers/moderation/debates_controller.rb
+++ b/app/controllers/moderation/debates_controller.rb
@@ -19,8 +19,8 @@ class Moderation::DebatesController < Moderation::BaseController
redirect_to request.query_parameters.merge(action: :index)
end
- def archive
- @debate.archive
+ def ignore_flag
+ @debate.ignore_flag
redirect_to request.query_parameters.merge(action: :index)
end
@@ -31,7 +31,7 @@ class Moderation::DebatesController < Moderation::BaseController
end
def set_valid_filters
- @valid_filters = %w{all pending archived}
+ @valid_filters = %w{all pending_flag_review with_ignored_flag}
end
def parse_filter
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 7a682de5a..3f209d626 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -53,14 +53,14 @@ class Ability
can :hide, Comment, hidden_at: nil
cannot :hide, Comment, user_id: user.id
- can :archive, Comment, archived_at: nil, hidden_at: nil
- cannot :archive, Comment, user_id: user.id
+ can :ignore_flag, Comment, ignored_flag_at: nil, hidden_at: nil
+ cannot :ignore_flag, Comment, user_id: user.id
can :hide, Debate, hidden_at: nil
cannot :hide, Debate, author_id: user.id
- can :archive, Debate, archived_at: nil, hidden_at: nil
- cannot :archive, Debate, author_id: user.id
+ can :ignore_flag, Debate, ignored_flag_at: nil, hidden_at: nil
+ cannot :ignore_flag, Debate, author_id: user.id
can :hide, User
cannot :hide, User, id: user.id
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 9df42b700..58888719f 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -17,8 +17,8 @@ class Comment < ActiveRecord::Base
scope :recent, -> { order(id: :desc) }
scope :sorted_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
- scope :pending, -> { where(archived_at: nil, hidden_at: nil) }
- scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") }
+ scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
+ scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
scope :flagged, -> { where("flags_count > 0") }
scope :for_render, -> { with_hidden.includes(user: :organization) }
@@ -65,8 +65,12 @@ class Comment < ActiveRecord::Base
hidden? || user.hidden?
end
- def archived?
- archived_at.present?
+ def ignored_flag?
+ ignored_flag_at.present?
+ end
+
+ def ignore_flag
+ update(ignored_flag_at: Time.now)
end
def as_administrator?
@@ -77,10 +81,6 @@ class Comment < ActiveRecord::Base
moderator_id.present?
end
- def archive
- update(archived_at: Time.now)
- end
-
# TODO: faking counter cache since there is a bug with acts_as_nested_set :counter_cache
# Remove when https://github.com/collectiveidea/awesome_nested_set/issues/294 is fixed
# and reset counters using
diff --git a/app/models/debate.rb b/app/models/debate.rb
index 1c3b63370..eed3fb7b5 100644
--- a/app/models/debate.rb
+++ b/app/models/debate.rb
@@ -24,8 +24,8 @@ class Debate < ActiveRecord::Base
before_validation :sanitize_tag_list
scope :sorted_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
- scope :pending, -> { where(archived_at: nil, hidden_at: nil) }
- scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") }
+ scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
+ scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
scope :flagged, -> { where("flags_count > 0") }
scope :for_render, -> { includes(:tags) }
@@ -75,12 +75,12 @@ class Debate < ActiveRecord::Base
count < 0 ? 0 : count
end
- def archived?
- archived_at.present?
+ def ignored_flag?
+ ignored_flag_at.present?
end
- def archive
- update(archived_at: Time.now)
+ def ignore_flag
+ update(ignored_flag_at: Time.now)
end
protected
diff --git a/app/views/moderation/comments/index.html.erb b/app/views/moderation/comments/index.html.erb
index c4b9d3ee0..f9c95e9be 100644
--- a/app/views/moderation/comments/index.html.erb
+++ b/app/views/moderation/comments/index.html.erb
@@ -39,14 +39,14 @@
<%= link_to t("moderation.comments.index.hide"), hide_in_moderation_screen_moderation_comment_path(comment, request.query_parameters), method: :put, class: "delete" %>
|
- <% if can? :archive, comment %>
+ <% if can? :ignore_flag, comment %>
- <%= link_to t("moderation.comments.index.archive"), archive_moderation_comment_path(comment, request.query_parameters), method: :put, class: "button radius tiny warning" %>
+ <%= link_to t("moderation.comments.index.ignore_flag"), ignore_flag_moderation_comment_path(comment, request.query_parameters), method: :put, class: "button radius tiny warning" %>
|
<% end %>
- <% if comment.archived? %>
-
- <%= t("moderation.comments.index.archived") %>
+ <% if comment.ignored_flag? %>
+ |
+ <%= t("moderation.comments.index.ignored_flag") %>
|
<% end %>
diff --git a/app/views/moderation/debates/index.html.erb b/app/views/moderation/debates/index.html.erb
index 30cd14669..cbd6baa5d 100644
--- a/app/views/moderation/debates/index.html.erb
+++ b/app/views/moderation/debates/index.html.erb
@@ -38,14 +38,14 @@
<%= link_to t("moderation.debates.index.hide"), hide_in_moderation_screen_moderation_debate_path(debate, request.query_parameters), method: :put, class: "delete" %>
|
- <% if can? :archive, debate %>
+ <% if can? :ignore_flag, debate %>
- <%= link_to t("moderation.debates.index.archive"), archive_moderation_debate_path(debate, request.query_parameters), method: :put, class: "button radius tiny warning" %>
+ <%= link_to t("moderation.debates.index.ignore_flag"), ignore_flag_moderation_debate_path(debate, request.query_parameters), method: :put, class: "button radius tiny warning" %>
|
<% end %>
- <% if debate.archived? %>
-
- <%= t("moderation.debates.index.archived") %>
+ <% if debate.ignored_flag? %>
+ |
+ <%= t("moderation.debates.index.ignored_flag") %>
|
<% end %>
diff --git a/config/locales/moderation.en.yml b/config/locales/moderation.en.yml
index 3d61c93a2..6e04e8765 100644
--- a/config/locales/moderation.en.yml
+++ b/config/locales/moderation.en.yml
@@ -16,13 +16,13 @@ en:
commentable: Root
comment: Comment
hide: Hide
- archive: Archive
- archived: Archived
+ ignore_flag: Ignore
+ ignored_flag: Ignored
filter: Filter
filters:
all: All
- pending: Pending
- archived: Archived
+ pending_flag_review: Pending
+ with_ignored_flag: Ignored
debates:
index:
title: Debates flagged as inappropriate
@@ -33,10 +33,10 @@ en:
description: Description
actions: Actions
hide: Hide
- archive: Archive
- archived: Archived
+ ignore_flag: Ignore
+ ignored_flag: Ignored
filter: Filter
filters:
all: All
- pending: Pending
- archived: Archived
+ pending_flag_review: Pending
+ with_ignored_flag: Ignored
diff --git a/config/locales/moderation.es.yml b/config/locales/moderation.es.yml
index 73886ddb0..04889d214 100644
--- a/config/locales/moderation.es.yml
+++ b/config/locales/moderation.es.yml
@@ -16,13 +16,13 @@ es:
commentable: Raíz
comment: Comentario
hide: Ocultar
- archive: Archivar
- archived: Archivado
+ ignore_flag: Ignorar
+ ignored_flag: Ignorado
filter: Filtrar
filters:
all: Todos
- pending: Pendientes
- archived: Archivados
+ pending_flag_review: Pendientes
+ with_ignored_flag: Ignorados
debates:
index:
title: Debates denunciados como inapropiados
@@ -33,10 +33,10 @@ es:
description: Descripción
actions: Acciones
hide: Ocultar
- archive: Archivar
- archived: Archivado
+ ignore_flag: Ignorar
+ ignored_flag: Ignorado
filter: Filtrar
filters:
all: Todos
- pending: Pendientes
- archived: Archivados
+ pending_flag_review: Pendientes
+ with_ignored_flag: Ignorados
diff --git a/config/routes.rb b/config/routes.rb
index c6db2acd9..6d2170ffd 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -88,7 +88,7 @@ Rails.application.routes.draw do
member do
put :hide
put :hide_in_moderation_screen
- put :archive
+ put :ignore_flag
end
end
@@ -96,7 +96,7 @@ Rails.application.routes.draw do
member do
put :hide
put :hide_in_moderation_screen
- put :archive
+ put :ignore_flag
end
end
end
diff --git a/spec/factories.rb b/spec/factories.rb
index ed77770a4..38ba6fd16 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -22,8 +22,8 @@ FactoryGirl.define do
hidden_at Time.now
end
- trait :archived do
- archived_at Time.now
+ trait :with_ignored_flag do
+ ignored_flag_at Time.now
end
trait :flagged do
@@ -51,8 +51,8 @@ FactoryGirl.define do
hidden_at Time.now
end
- trait :archived do
- archived_at Time.now
+ trait :with_ignored_flag do
+ ignored_flag_at Time.now
end
trait :flagged do
diff --git a/spec/features/moderation/comments_spec.rb b/spec/features/moderation/comments_spec.rb
index efc37fc72..b78be6967 100644
--- a/spec/features/moderation/comments_spec.rb
+++ b/spec/features/moderation/comments_spec.rb
@@ -104,57 +104,57 @@ feature 'Moderate Comments' do
visit moderation_comments_path
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
- expect(page).to have_link('Archived')
+ expect(page).to have_link('Ignored')
visit moderation_comments_path(filter: 'all')
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
- expect(page).to have_link('Archived')
+ expect(page).to have_link('Ignored')
- visit moderation_comments_path(filter: 'pending')
+ visit moderation_comments_path(filter: 'pending_flag_review')
expect(page).to have_link('All')
expect(page).to_not have_link('Pending')
- expect(page).to have_link('Archived')
+ expect(page).to have_link('Ignored')
- visit moderation_comments_path(filter: 'archived')
+ visit moderation_comments_path(filter: 'with_ignored_flag')
expect(page).to have_link('All')
expect(page).to have_link('Pending')
- expect(page).to_not have_link('Archived')
+ expect(page).to_not have_link('Ignored')
end
scenario "Filtering comments" do
create(:comment, :flagged, body: "Pending comment")
create(:comment, :flagged, :hidden, body: "Hidden comment")
- create(:comment, :flagged, :archived, body: "Archived comment")
+ create(:comment, :flagged, :with_ignored_flag, body: "Ignored comment")
visit moderation_comments_path(filter: 'all')
expect(page).to have_content('Pending comment')
expect(page).to_not have_content('Hidden comment')
- expect(page).to have_content('Archived comment')
+ expect(page).to have_content('Ignored comment')
- visit moderation_comments_path(filter: 'pending')
+ visit moderation_comments_path(filter: 'pending_flag_review')
expect(page).to have_content('Pending comment')
expect(page).to_not have_content('Hidden comment')
- expect(page).to_not have_content('Archived comment')
+ expect(page).to_not have_content('Ignored comment')
- visit moderation_comments_path(filter: 'archived')
+ visit moderation_comments_path(filter: 'with_ignored_flag')
expect(page).to_not have_content('Pending comment')
expect(page).to_not have_content('Hidden comment')
- expect(page).to have_content('Archived comment')
+ expect(page).to have_content('Ignored comment')
end
scenario "Reviewing links remember the pagination setting and the filter" do
per_page = Kaminari.config.default_per_page
(per_page + 2).times { create(:comment, :flagged) }
- visit moderation_comments_path(filter: 'pending', page: 2)
+ visit moderation_comments_path(filter: 'pending_flag_review', page: 2)
- click_link('Archive', match: :first, exact: true)
+ click_link('Ignore', match: :first, exact: true)
uri = URI.parse(current_url)
query_params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys
- expect(query_params[:filter]).to eq('pending')
+ expect(query_params[:filter]).to eq('pending_flag_review')
expect(query_params[:page]).to eq('2')
end
@@ -172,7 +172,7 @@ feature 'Moderate Comments' do
expect(page).to have_content('spammy spam')
expect(page).to have_content('1')
expect(page).to have_link('Hide')
- expect(page).to have_link('Archive')
+ expect(page).to have_link('Ignore')
end
end
@@ -187,18 +187,18 @@ feature 'Moderate Comments' do
expect(@comment.reload).to be_hidden
end
- scenario 'Marking the comment as archived' do
+ scenario 'Marking the comment as ignored' do
within("#comment_#{@comment.id}") do
- click_link('Archive')
+ click_link('Ignore')
end
expect(current_path).to eq(moderation_comments_path)
within("#comment_#{@comment.id}") do
- expect(page).to have_content('Archived')
+ expect(page).to have_content('Ignored')
end
- expect(@comment.reload).to be_archived
+ expect(@comment.reload).to be_ignored_flag
end
end
end
diff --git a/spec/features/moderation/debates_spec.rb b/spec/features/moderation/debates_spec.rb
index ee9f53b7e..8e3e105b5 100644
--- a/spec/features/moderation/debates_spec.rb
+++ b/spec/features/moderation/debates_spec.rb
@@ -47,57 +47,57 @@ feature 'Moderate debates' do
visit moderation_debates_path
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
- expect(page).to have_link('Archived')
+ expect(page).to have_link('Ignored')
visit moderation_debates_path(filter: 'all')
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
- expect(page).to have_link('Archived')
+ expect(page).to have_link('Ignored')
- visit moderation_debates_path(filter: 'pending')
+ visit moderation_debates_path(filter: 'pending_flag_review')
expect(page).to have_link('All')
expect(page).to_not have_link('Pending')
- expect(page).to have_link('Archived')
+ expect(page).to have_link('Ignored')
- visit moderation_debates_path(filter: 'archived')
+ visit moderation_debates_path(filter: 'with_ignored_flag')
expect(page).to have_link('All')
expect(page).to have_link('Pending')
- expect(page).to_not have_link('Archived')
+ expect(page).to_not have_link('Ignored')
end
scenario "Filtering debates" do
create(:debate, :flagged, title: "Pending debate")
create(:debate, :flagged, :hidden, title: "Hidden debate")
- create(:debate, :flagged, :archived, title: "Archived debate")
+ create(:debate, :flagged, :with_ignored_flag, title: "Ignored debate")
visit moderation_debates_path(filter: 'all')
expect(page).to have_content('Pending debate')
expect(page).to_not have_content('Hidden debate')
- expect(page).to have_content('Archived debate')
+ expect(page).to have_content('Ignored debate')
- visit moderation_debates_path(filter: 'pending')
+ visit moderation_debates_path(filter: 'pending_flag_review')
expect(page).to have_content('Pending debate')
expect(page).to_not have_content('Hidden debate')
- expect(page).to_not have_content('Archived debate')
+ expect(page).to_not have_content('Ignored debate')
- visit moderation_debates_path(filter: 'archived')
+ visit moderation_debates_path(filter: 'with_ignored_flag')
expect(page).to_not have_content('Pending debate')
expect(page).to_not have_content('Hidden debate')
- expect(page).to have_content('Archived debate')
+ expect(page).to have_content('Ignored debate')
end
scenario "Reviewing links remember the pagination setting and the filter" do
per_page = Kaminari.config.default_per_page
(per_page + 2).times { create(:debate, :flagged) }
- visit moderation_debates_path(filter: 'pending', page: 2)
+ visit moderation_debates_path(filter: 'pending_flag_review', page: 2)
- click_link('Archive', match: :first, exact: true)
+ click_link('Ignore', match: :first, exact: true)
uri = URI.parse(current_url)
query_params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys
- expect(query_params[:filter]).to eq('pending')
+ expect(query_params[:filter]).to eq('pending_flag_review')
expect(query_params[:page]).to eq('2')
end
@@ -114,7 +114,7 @@ feature 'Moderate debates' do
expect(page).to have_content('buy buy buy')
expect(page).to have_content('1')
expect(page).to have_link('Hide')
- expect(page).to have_link('Archive')
+ expect(page).to have_link('Ignore')
end
end
@@ -129,18 +129,18 @@ feature 'Moderate debates' do
expect(@debate.reload).to be_hidden
end
- scenario 'Marking the debate as archived' do
+ scenario 'Marking the debate as ignored' do
within("#debate_#{@debate.id}") do
- click_link('Archive')
+ click_link('Ignore')
end
expect(current_path).to eq(moderation_debates_path)
within("#debate_#{@debate.id}") do
- expect(page).to have_content('Archived')
+ expect(page).to have_content('Ignored')
end
- expect(@debate.reload).to be_archived
+ expect(@debate.reload).to be_ignored_flag
end
end
end
diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb
index 440807603..088516d1a 100644
--- a/spec/models/ability_spec.rb
+++ b/spec/models/ability_spec.rb
@@ -131,8 +131,8 @@ describe Ability do
let(:own_debate) { create(:debate, author: user) }
let(:hidden_comment) { create(:comment, :hidden) }
let(:hidden_debate) { create(:debate, :hidden) }
- let(:archived_comment) { create(:comment, :archived) }
- let(:archived_debate) { create(:debate, :archived) }
+ let(:ignored_comment) { create(:comment, :with_ignored_flag) }
+ let(:ignored_debate) { create(:debate, :with_ignored_flag) }
it { should be_able_to(:hide, comment) }
it { should be_able_to(:hide_in_moderation_screen, comment) }
@@ -144,15 +144,15 @@ describe Ability do
it { should_not be_able_to(:hide, hidden_debate) }
it { should_not be_able_to(:hide, own_debate) }
- it { should be_able_to(:archive, comment) }
- it { should_not be_able_to(:archive, hidden_comment) }
- it { should_not be_able_to(:archive, archived_comment) }
- it { should_not be_able_to(:archive, own_comment) }
+ it { should be_able_to(:ignore_flag, comment) }
+ it { should_not be_able_to(:ignore_flag, hidden_comment) }
+ it { should_not be_able_to(:ignore_flag, ignored_comment) }
+ it { should_not be_able_to(:ignore_flag, own_comment) }
- it { should be_able_to(:archive, debate) }
- it { should_not be_able_to(:archive, hidden_debate) }
- it { should_not be_able_to(:archive, archived_debate) }
- it { should_not be_able_to(:archive, own_debate) }
+ it { should be_able_to(:ignore_flag, debate) }
+ it { should_not be_able_to(:ignore_flag, hidden_debate) }
+ it { should_not be_able_to(:ignore_flag, ignored_debate) }
+ it { should_not be_able_to(:ignore_flag, own_debate) }
it { should_not be_able_to(:hide, user) }
it { should be_able_to(:hide, other_user) }