Rename admin/debates and admin/comments to hidden
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,4 +38,3 @@
|
|||||||
public/sitemap.xml
|
public/sitemap.xml
|
||||||
public/system/
|
public/system/
|
||||||
/public/ckeditor_assets/
|
/public/ckeditor_assets/
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Admin::CommentsController < Admin::BaseController
|
class Admin::HiddenCommentsController < Admin::BaseController
|
||||||
has_filters %w{without_confirmed_hide all with_confirmed_hide}
|
has_filters %w{without_confirmed_hide all with_confirmed_hide}
|
||||||
|
|
||||||
before_action :load_comment, only: [:confirm_hide, :restore]
|
before_action :load_comment, only: [:confirm_hide, :restore]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
class Admin::DebatesController < Admin::BaseController
|
class Admin::HiddenDebatesController < Admin::BaseController
|
||||||
include FeatureFlags
|
include FeatureFlags
|
||||||
|
|
||||||
feature_flag :debates
|
feature_flag :debates
|
||||||
@@ -29,4 +29,4 @@ class Admin::DebatesController < Admin::BaseController
|
|||||||
@debate = Debate.with_hidden.find(params[:id])
|
@debate = Debate.with_hidden.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -45,5 +45,4 @@ class Officing::BaseController < ApplicationController
|
|||||||
def current_booth
|
def current_booth
|
||||||
Poll::Booth.where(id: session[:booth_id]).first
|
Poll::Booth.where(id: session[:booth_id]).first
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module AdminHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def moderated_sections
|
def moderated_sections
|
||||||
["hidden_proposals", "debates", "comments", "hidden_users", "activity",
|
["hidden_proposals", "hidden_debates", "hidden_comments", "hidden_users", "activity",
|
||||||
"hidden_budget_investments"]
|
"hidden_budget_investments"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -155,8 +155,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if feature?(:debates) %>
|
<% if feature?(:debates) %>
|
||||||
<li <%= "class=is-active" if controller_name == "debates" %>>
|
<li <%= "class=is-active" if controller_name == "hidden_debates" %>>
|
||||||
<%= link_to t("admin.menu.hidden_debates"), admin_debates_path %>
|
<%= link_to t("admin.menu.hidden_debates"), admin_hidden_debates_path %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -166,8 +166,8 @@
|
|||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<li <%= "class=is-active" if controller_name == "comments" %>>
|
<li <%= "class=is-active" if controller_name == "hidden_comments" %>>
|
||||||
<%= link_to t("admin.menu.hidden_comments"), admin_comments_path %>
|
<%= link_to t("admin.menu.hidden_comments"), admin_hidden_comments_path %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li <%= "class=is-active" if controller_name == "proposal_notifications" %>>
|
<li <%= "class=is-active" if controller_name == "proposal_notifications" %>>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
admin_budget_budget_investments_path(csv_params),
|
admin_budget_budget_investments_path(csv_params),
|
||||||
class: "float-right small clear" %>
|
class: "float-right small clear" %>
|
||||||
|
|
||||||
|
|
||||||
<% if params[:advanced_filters].include?("winners") %>
|
<% if params[:advanced_filters].include?("winners") %>
|
||||||
<% if display_calculate_winners_button?(@budget) %>
|
<% if display_calculate_winners_button?(@budget) %>
|
||||||
<%= link_to calculate_winner_button_text(@budget),
|
<%= link_to calculate_winner_button_text(@budget),
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<h2><%= t("admin.comments.index.title") %></h2>
|
<h2><%= t("admin.hidden_comments.index.title") %></h2>
|
||||||
<p><%= t("admin.shared.moderated_content") %></p>
|
<p><%= t("admin.shared.moderated_content") %></p>
|
||||||
|
|
||||||
<%= render "shared/filter_subnav", i18n_namespace: "admin.comments.index" %>
|
|
||||||
|
<%= render "shared/filter_subnav", i18n_namespace: "admin.hidden_comments.index" %>
|
||||||
|
|
||||||
<% if @comments.any? %>
|
<% if @comments.any? %>
|
||||||
<h3 class="margin"><%= page_entries_info @comments %></h3>
|
<h3 class="margin"><%= page_entries_info @comments %></h3>
|
||||||
@@ -17,20 +18,20 @@
|
|||||||
<td>
|
<td>
|
||||||
<%= text_with_links comment.body %><br>
|
<%= text_with_links comment.body %><br>
|
||||||
<% if comment.commentable.hidden? %>
|
<% if comment.commentable.hidden? %>
|
||||||
(<%= t("admin.comments.index.hidden_#{comment.commentable_type.downcase}") %>: <%= comment.commentable.title %>)
|
(<%= t("admin.hidden_comments.index.hidden_#{comment.commentable_type.downcase}") %>: <%= comment.commentable.title %>)
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to comment.commentable.title, commentable_path(comment) %>
|
<%= link_to comment.commentable.title, commentable_path(comment) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to t("admin.actions.restore"),
|
<%= link_to t("admin.actions.restore"),
|
||||||
restore_admin_comment_path(comment, request.query_parameters),
|
restore_admin_hidden_comment_path(comment, request.query_parameters),
|
||||||
method: :put,
|
method: :put,
|
||||||
data: { confirm: t("admin.actions.confirm") },
|
data: { confirm: t("admin.actions.confirm") },
|
||||||
class: "button hollow warning" %>
|
class: "button hollow warning" %>
|
||||||
<% unless comment.confirmed_hide? %>
|
<% unless comment.confirmed_hide? %>
|
||||||
<%= link_to t("admin.actions.confirm_hide"),
|
<%= link_to t("admin.actions.confirm_hide"),
|
||||||
confirm_hide_admin_comment_path(comment, request.query_parameters),
|
confirm_hide_admin_hidden_comment_path(comment, request.query_parameters),
|
||||||
method: :put,
|
method: :put,
|
||||||
class: "button" %>
|
class: "button" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -43,6 +44,6 @@
|
|||||||
<%= paginate @comments %>
|
<%= paginate @comments %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="callout primary margin">
|
<div class="callout primary margin">
|
||||||
<%= t("admin.comments.index.no_hidden_comments") %>
|
<%= t("admin.hidden_comments.index.no_hidden_comments") %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
<h2><%= t("admin.debates.index.title") %></h2>
|
<h2><%= t("admin.hidden_debates.index.title") %></h2>
|
||||||
<p><%= t("admin.shared.moderated_content") %></p>
|
<p><%= t("admin.shared.moderated_content") %></p>
|
||||||
|
|
||||||
<%= render "shared/filter_subnav", i18n_namespace: "admin.debates.index" %>
|
|
||||||
|
<%= render "shared/filter_subnav", i18n_namespace: "admin.hidden_debates.index" %>
|
||||||
|
|
||||||
<% if @debates.any? %>
|
<% if @debates.any? %>
|
||||||
<h3 class="margin"><%= page_entries_info @debates %></h3>
|
<h3 class="margin"><%= page_entries_info @debates %></h3>
|
||||||
@@ -25,13 +26,13 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="align-top">
|
<td class="align-top">
|
||||||
<%= link_to t("admin.actions.restore"),
|
<%= link_to t("admin.actions.restore"),
|
||||||
restore_admin_debate_path(debate, request.query_parameters),
|
restore_admin_hidden_debate_path(debate, request.query_parameters),
|
||||||
method: :put,
|
method: :put,
|
||||||
data: { confirm: t("admin.actions.confirm") },
|
data: { confirm: t("admin.actions.confirm") },
|
||||||
class: "button hollow warning" %>
|
class: "button hollow warning" %>
|
||||||
<% unless debate.confirmed_hide? %>
|
<% unless debate.confirmed_hide? %>
|
||||||
<%= link_to t("admin.actions.confirm_hide"),
|
<%= link_to t("admin.actions.confirm_hide"),
|
||||||
confirm_hide_admin_debate_path(debate, request.query_parameters),
|
confirm_hide_admin_hidden_debate_path(debate, request.query_parameters),
|
||||||
method: :put,
|
method: :put,
|
||||||
class: "button" %>
|
class: "button" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -44,6 +45,6 @@
|
|||||||
<%= paginate @debates %>
|
<%= paginate @debates %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="callout primary margin">
|
<div class="callout primary margin">
|
||||||
<%= t("admin.debates.index.no_hidden_debates") %>
|
<%= t("admin.hidden_debates.index.no_hidden_debates") %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -2,5 +2,5 @@
|
|||||||
<h2 class="sidebar-title"><%= t("shared.tags_cloud.districts") %></h2>
|
<h2 class="sidebar-title"><%= t("shared.tags_cloud.districts") %></h2>
|
||||||
<br>
|
<br>
|
||||||
<%= link_to map_proposals_path, id: "map", title: t("shared.tags_cloud.districts_list") do %>
|
<%= link_to map_proposals_path, id: "map", title: t("shared.tags_cloud.districts_list") do %>
|
||||||
<%= image_tag(image_path_for("map.jpg", alt: t("shared.tags_cloud.districts_list")) %>
|
<%= image_tag(image_path_for("map.jpg", alt: t("shared.tags_cloud.districts_list"))) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"<%= t("stats.index.visits") %>" : "<%= number_with_delimiter(@visits) %>",
|
"<%= t("stats.index.visits") %>" : "<%= number_with_delimiter(@visits) %>",
|
||||||
"<%= t("stats.index.debates") %>" : <%= number_with_delimiter(@debates) %>",
|
"<%= t("stats.index.debates") %>" : "<%= number_with_delimiter(@debates) %>",
|
||||||
"<%= t("stats.index.proposals") %>" : "<%= number_with_delimiter(@proposals) %>",
|
"<%= t("stats.index.proposals") %>" : "<%= number_with_delimiter(@proposals) %>",
|
||||||
"<%= t("stats.index.comments") %>" : "<%= number_with_delimiter(@comments) %>",
|
"<%= t("stats.index.comments") %>" : "<%= number_with_delimiter(@comments) %>",
|
||||||
"<%= t("stats.index.proposal_votes") %>" : "<%= number_with_delimiter(@proposal_votes) %>",
|
"<%= t("stats.index.proposal_votes") %>" : "<%= number_with_delimiter(@proposal_votes) %>",
|
||||||
@@ -9,4 +9,4 @@
|
|||||||
"<%= t("stats.index.votes") %>" : "<%= number_with_delimiter(@votes) %>",
|
"<%= t("stats.index.votes") %>" : "<%= number_with_delimiter(@votes) %>",
|
||||||
"<%= t("stats.index.verified_users") %>" : "<%= number_with_delimiter(@verified_users) %>",
|
"<%= t("stats.index.verified_users") %>" : "<%= number_with_delimiter(@verified_users) %>",
|
||||||
"<%= t("stats.index.unverified_users") %>" : "<%= number_with_delimiter(@unverified_users) %>"
|
"<%= t("stats.index.unverified_users") %>" : "<%= number_with_delimiter(@unverified_users) %>"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ Rails.application.configure do
|
|||||||
# config.action_cable.url = 'wss://example.com/cable'
|
# config.action_cable.url = 'wss://example.com/cable'
|
||||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||||
|
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
config.force_ssl = true
|
config.force_ssl = true
|
||||||
|
|
||||||
|
|||||||
@@ -131,9 +131,9 @@ ignore_unused:
|
|||||||
- "date.order"
|
- "date.order"
|
||||||
- "unauthorized.*"
|
- "unauthorized.*"
|
||||||
- "admin.officials.level_*"
|
- "admin.officials.level_*"
|
||||||
- "admin.comments.index.filter*"
|
- "admin.hidden_comments.index.filter*"
|
||||||
- "admin.banners.index.filters.*"
|
- "admin.banners.index.filters.*"
|
||||||
- "admin.debates.index.filter*"
|
- "admin.hidden_debates.index.filter*"
|
||||||
- "admin.hidden_proposals.index.filter*"
|
- "admin.hidden_proposals.index.filter*"
|
||||||
- "admin.proposal_notifications.index.filter*"
|
- "admin.proposal_notifications.index.filter*"
|
||||||
- "admin.budgets.index.filter*"
|
- "admin.budgets.index.filter*"
|
||||||
@@ -149,7 +149,7 @@ ignore_unused:
|
|||||||
- "admin.legislation.processes.proposals.select_order"
|
- "admin.legislation.processes.proposals.select_order"
|
||||||
- "admin.legislation.draft_versions.*.submit_button"
|
- "admin.legislation.draft_versions.*.submit_button"
|
||||||
- "admin.legislation.questions.*.submit_button"
|
- "admin.legislation.questions.*.submit_button"
|
||||||
- "admin.comments.index.hidden_*"
|
- "admin.hidden_comments.index.hidden_*"
|
||||||
- "admin.settings.index.features.*"
|
- "admin.settings.index.features.*"
|
||||||
- "admin.polls.*.submit_button"
|
- "admin.polls.*.submit_button"
|
||||||
- "admin.booths.*.submit_button"
|
- "admin.booths.*.submit_button"
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ en:
|
|||||||
notice: "Progress bar updated successfully"
|
notice: "Progress bar updated successfully"
|
||||||
delete:
|
delete:
|
||||||
notice: "Progress bar deleted successfully"
|
notice: "Progress bar deleted successfully"
|
||||||
comments:
|
hidden_comments:
|
||||||
index:
|
index:
|
||||||
filter: Filter
|
filter: Filter
|
||||||
filters:
|
filters:
|
||||||
@@ -430,7 +430,7 @@ en:
|
|||||||
request: Requested resource
|
request: Requested resource
|
||||||
update:
|
update:
|
||||||
success: The task has been marked as solved.
|
success: The task has been marked as solved.
|
||||||
debates:
|
hidden_debates:
|
||||||
index:
|
index:
|
||||||
filter: Filter
|
filter: Filter
|
||||||
filters:
|
filters:
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ es:
|
|||||||
notice: "Barra de progreso actualizada"
|
notice: "Barra de progreso actualizada"
|
||||||
delete:
|
delete:
|
||||||
notice: "Barra de progreso eliminada correctamente"
|
notice: "Barra de progreso eliminada correctamente"
|
||||||
comments:
|
hidden_comments:
|
||||||
index:
|
index:
|
||||||
filter: Filtro
|
filter: Filtro
|
||||||
filters:
|
filters:
|
||||||
@@ -430,7 +430,7 @@ es:
|
|||||||
request: Recurso solicitado
|
request: Recurso solicitado
|
||||||
update:
|
update:
|
||||||
success: La tarea ha sido marcada como resuelta
|
success: La tarea ha sido marcada como resuelta
|
||||||
debates:
|
hidden_debates:
|
||||||
index:
|
index:
|
||||||
filter: Filtro
|
filter: Filtro
|
||||||
filters:
|
filters:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace :admin do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :debates, only: :index do
|
resources :hidden_debates, only: :index do
|
||||||
member do
|
member do
|
||||||
put :restore
|
put :restore
|
||||||
put :confirm_hide
|
put :confirm_hide
|
||||||
@@ -83,7 +83,7 @@ namespace :admin do
|
|||||||
collection { get :search }
|
collection { get :search }
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :comments, only: :index do
|
resources :hidden_comments, only: :index do
|
||||||
member do
|
member do
|
||||||
put :restore
|
put :restore
|
||||||
put :confirm_hide
|
put :confirm_hide
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ FactoryBot.define do
|
|||||||
transient { budget nil }
|
transient { budget nil }
|
||||||
|
|
||||||
poll { budget&.poll || association(:poll, budget: budget) }
|
poll { budget&.poll || association(:poll, budget: budget) }
|
||||||
|
|
||||||
trait :from_web do
|
trait :from_web do
|
||||||
origin "web"
|
origin "web"
|
||||||
token SecureRandom.hex(32)
|
token SecureRandom.hex(32)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ describe "Admin activity" do
|
|||||||
scenario "Shows admin restores" do
|
scenario "Shows admin restores" do
|
||||||
debate = create(:debate, :hidden)
|
debate = create(:debate, :hidden)
|
||||||
|
|
||||||
visit admin_debates_path
|
visit admin_hidden_debates_path
|
||||||
|
|
||||||
within("#debate_#{debate.id}") do
|
within("#debate_#{debate.id}") do
|
||||||
click_on "Restore"
|
click_on "Restore"
|
||||||
@@ -181,7 +181,7 @@ describe "Admin activity" do
|
|||||||
scenario "Shows admin restores" do
|
scenario "Shows admin restores" do
|
||||||
comment = create(:comment, :hidden)
|
comment = create(:comment, :hidden)
|
||||||
|
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
|
|
||||||
within("#comment_#{comment.id}") do
|
within("#comment_#{comment.id}") do
|
||||||
click_on "Restore"
|
click_on "Restore"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ describe "Admin comments" do
|
|||||||
proposal = create(:proposal, author: comment.author)
|
proposal = create(:proposal, author: comment.author)
|
||||||
create(:comment, commentable: proposal, user: comment.author, body: "Good Proposal!")
|
create(:comment, commentable: proposal, user: comment.author, body: "Good Proposal!")
|
||||||
|
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
expect(page).to have_content("SPAM from SPAMMER")
|
expect(page).to have_content("SPAM from SPAMMER")
|
||||||
expect(page).not_to have_content("Good Proposal!")
|
expect(page).not_to have_content("Good Proposal!")
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ describe "Admin comments" do
|
|||||||
click_link "Hide author"
|
click_link "Hide author"
|
||||||
end
|
end
|
||||||
|
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
expect(page).not_to have_content("SPAM from SPAMMER")
|
expect(page).not_to have_content("SPAM from SPAMMER")
|
||||||
expect(page).not_to have_content("Good Proposal!")
|
expect(page).not_to have_content("Good Proposal!")
|
||||||
end
|
end
|
||||||
@@ -32,7 +32,7 @@ describe "Admin comments" do
|
|||||||
create(:comment, :hidden, commentable: debate, body: "This is SPAM comment on debate")
|
create(:comment, :hidden, commentable: debate, body: "This is SPAM comment on debate")
|
||||||
create(:comment, :hidden, commentable: proposal, body: "This is SPAM comment on proposal")
|
create(:comment, :hidden, commentable: proposal, body: "This is SPAM comment on proposal")
|
||||||
|
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
|
|
||||||
expect(page).to have_content("Debate with spam comment")
|
expect(page).to have_content("Debate with spam comment")
|
||||||
expect(page).to have_content("Proposal with spam comment")
|
expect(page).to have_content("Proposal with spam comment")
|
||||||
@@ -43,7 +43,7 @@ describe "Admin comments" do
|
|||||||
expect(page).to have_content("Debate with spam comment")
|
expect(page).to have_content("Debate with spam comment")
|
||||||
expect(page).not_to have_content("This is SPAM comment on debate")
|
expect(page).not_to have_content("This is SPAM comment on debate")
|
||||||
|
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
|
|
||||||
click_link "Proposal with spam comment"
|
click_link "Proposal with spam comment"
|
||||||
expect(page).to have_content("Proposal with spam comment")
|
expect(page).to have_content("Proposal with spam comment")
|
||||||
@@ -56,7 +56,7 @@ describe "Admin comments" do
|
|||||||
create(:comment, :hidden, commentable: debate, body: "This is SPAM comment on debate")
|
create(:comment, :hidden, commentable: debate, body: "This is SPAM comment on debate")
|
||||||
create(:comment, :hidden, commentable: proposal, body: "This is SPAM comment on proposal")
|
create(:comment, :hidden, commentable: proposal, body: "This is SPAM comment on proposal")
|
||||||
|
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
|
|
||||||
expect(page).to have_content("(Hidden proposal: Hidden proposal title)")
|
expect(page).to have_content("(Hidden proposal: Hidden proposal title)")
|
||||||
expect(page).to have_content("(Hidden debate: Hidden debate title)")
|
expect(page).to have_content("(Hidden debate: Hidden debate title)")
|
||||||
@@ -67,7 +67,7 @@ describe "Admin comments" do
|
|||||||
|
|
||||||
scenario "Restore" do
|
scenario "Restore" do
|
||||||
comment = create(:comment, :hidden, body: "Not really SPAM")
|
comment = create(:comment, :hidden, body: "Not really SPAM")
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
|
|
||||||
click_link "Restore"
|
click_link "Restore"
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ describe "Admin comments" do
|
|||||||
|
|
||||||
scenario "Confirm hide" do
|
scenario "Confirm hide" do
|
||||||
comment = create(:comment, :hidden, body: "SPAM")
|
comment = create(:comment, :hidden, body: "SPAM")
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
|
|
||||||
click_link "Confirm moderation"
|
click_link "Confirm moderation"
|
||||||
|
|
||||||
@@ -91,22 +91,22 @@ describe "Admin comments" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Current filter is properly highlighted" do
|
scenario "Current filter is properly highlighted" do
|
||||||
visit admin_comments_path
|
visit admin_hidden_comments_path
|
||||||
expect(page).not_to have_link("Pending")
|
expect(page).not_to have_link("Pending")
|
||||||
expect(page).to have_link("All")
|
expect(page).to have_link("All")
|
||||||
expect(page).to have_link("Confirmed")
|
expect(page).to have_link("Confirmed")
|
||||||
|
|
||||||
visit admin_comments_path(filter: "Pending")
|
visit admin_hidden_comments_path(filter: "Pending")
|
||||||
expect(page).not_to have_link("Pending")
|
expect(page).not_to have_link("Pending")
|
||||||
expect(page).to have_link("All")
|
expect(page).to have_link("All")
|
||||||
expect(page).to have_link("Confirmed")
|
expect(page).to have_link("Confirmed")
|
||||||
|
|
||||||
visit admin_comments_path(filter: "all")
|
visit admin_hidden_comments_path(filter: "all")
|
||||||
expect(page).to have_link("Pending")
|
expect(page).to have_link("Pending")
|
||||||
expect(page).not_to have_link("All")
|
expect(page).not_to have_link("All")
|
||||||
expect(page).to have_link("Confirmed")
|
expect(page).to have_link("Confirmed")
|
||||||
|
|
||||||
visit admin_comments_path(filter: "with_confirmed_hide")
|
visit admin_hidden_comments_path(filter: "with_confirmed_hide")
|
||||||
expect(page).to have_link("Pending")
|
expect(page).to have_link("Pending")
|
||||||
expect(page).to have_link("All")
|
expect(page).to have_link("All")
|
||||||
expect(page).not_to have_link("Confirmed")
|
expect(page).not_to have_link("Confirmed")
|
||||||
@@ -116,11 +116,11 @@ describe "Admin comments" do
|
|||||||
create(:comment, :hidden, body: "Unconfirmed comment")
|
create(:comment, :hidden, body: "Unconfirmed comment")
|
||||||
create(:comment, :hidden, :with_confirmed_hide, body: "Confirmed comment")
|
create(:comment, :hidden, :with_confirmed_hide, body: "Confirmed comment")
|
||||||
|
|
||||||
visit admin_comments_path(filter: "all")
|
visit admin_hidden_comments_path(filter: "all")
|
||||||
expect(page).to have_content("Unconfirmed comment")
|
expect(page).to have_content("Unconfirmed comment")
|
||||||
expect(page).to have_content("Confirmed comment")
|
expect(page).to have_content("Confirmed comment")
|
||||||
|
|
||||||
visit admin_comments_path(filter: "with_confirmed_hide")
|
visit admin_hidden_comments_path(filter: "with_confirmed_hide")
|
||||||
expect(page).not_to have_content("Unconfirmed comment")
|
expect(page).not_to have_content("Unconfirmed comment")
|
||||||
expect(page).to have_content("Confirmed comment")
|
expect(page).to have_content("Confirmed comment")
|
||||||
end
|
end
|
||||||
@@ -129,7 +129,7 @@ describe "Admin comments" do
|
|||||||
per_page = Kaminari.config.default_per_page
|
per_page = Kaminari.config.default_per_page
|
||||||
(per_page + 2).times { create(:comment, :hidden, :with_confirmed_hide) }
|
(per_page + 2).times { create(:comment, :hidden, :with_confirmed_hide) }
|
||||||
|
|
||||||
visit admin_comments_path(filter: "with_confirmed_hide", page: 2)
|
visit admin_hidden_comments_path(filter: "with_confirmed_hide", page: 2)
|
||||||
|
|
||||||
click_on("Restore", match: :first, exact: true)
|
click_on("Restore", match: :first, exact: true)
|
||||||
|
|
||||||
@@ -137,4 +137,4 @@ describe "Admin comments" do
|
|||||||
expect(current_url).to include("page=2")
|
expect(current_url).to include("page=2")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ describe "Admin debates" do
|
|||||||
admin = create(:administrator)
|
admin = create(:administrator)
|
||||||
login_as(admin.user)
|
login_as(admin.user)
|
||||||
|
|
||||||
expect{ visit admin_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
expect{ visit admin_hidden_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||||
|
|
||||||
Setting["process.debates"] = true
|
Setting["process.debates"] = true
|
||||||
end
|
end
|
||||||
@@ -19,7 +19,7 @@ describe "Admin debates" do
|
|||||||
|
|
||||||
scenario "Restore" do
|
scenario "Restore" do
|
||||||
debate = create(:debate, :hidden)
|
debate = create(:debate, :hidden)
|
||||||
visit admin_debates_path
|
visit admin_hidden_debates_path
|
||||||
|
|
||||||
click_link "Restore"
|
click_link "Restore"
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ describe "Admin debates" do
|
|||||||
|
|
||||||
scenario "Confirm hide" do
|
scenario "Confirm hide" do
|
||||||
debate = create(:debate, :hidden)
|
debate = create(:debate, :hidden)
|
||||||
visit admin_debates_path
|
visit admin_hidden_debates_path
|
||||||
|
|
||||||
click_link "Confirm moderation"
|
click_link "Confirm moderation"
|
||||||
|
|
||||||
@@ -43,22 +43,22 @@ describe "Admin debates" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Current filter is properly highlighted" do
|
scenario "Current filter is properly highlighted" do
|
||||||
visit admin_debates_path
|
visit admin_hidden_debates_path
|
||||||
expect(page).not_to have_link("Pending")
|
expect(page).not_to have_link("Pending")
|
||||||
expect(page).to have_link("All")
|
expect(page).to have_link("All")
|
||||||
expect(page).to have_link("Confirmed")
|
expect(page).to have_link("Confirmed")
|
||||||
|
|
||||||
visit admin_debates_path(filter: "Pending")
|
visit admin_hidden_debates_path(filter: "Pending")
|
||||||
expect(page).not_to have_link("Pending")
|
expect(page).not_to have_link("Pending")
|
||||||
expect(page).to have_link("All")
|
expect(page).to have_link("All")
|
||||||
expect(page).to have_link("Confirmed")
|
expect(page).to have_link("Confirmed")
|
||||||
|
|
||||||
visit admin_debates_path(filter: "all")
|
visit admin_hidden_debates_path(filter: "all")
|
||||||
expect(page).to have_link("Pending")
|
expect(page).to have_link("Pending")
|
||||||
expect(page).not_to have_link("All")
|
expect(page).not_to have_link("All")
|
||||||
expect(page).to have_link("Confirmed")
|
expect(page).to have_link("Confirmed")
|
||||||
|
|
||||||
visit admin_debates_path(filter: "with_confirmed_hide")
|
visit admin_hidden_debates_path(filter: "with_confirmed_hide")
|
||||||
expect(page).to have_link("All")
|
expect(page).to have_link("All")
|
||||||
expect(page).to have_link("Pending")
|
expect(page).to have_link("Pending")
|
||||||
expect(page).not_to have_link("Confirmed")
|
expect(page).not_to have_link("Confirmed")
|
||||||
@@ -68,15 +68,15 @@ describe "Admin debates" do
|
|||||||
create(:debate, :hidden, title: "Unconfirmed debate")
|
create(:debate, :hidden, title: "Unconfirmed debate")
|
||||||
create(:debate, :hidden, :with_confirmed_hide, title: "Confirmed debate")
|
create(:debate, :hidden, :with_confirmed_hide, title: "Confirmed debate")
|
||||||
|
|
||||||
visit admin_debates_path(filter: "pending")
|
visit admin_hidden_debates_path(filter: "pending")
|
||||||
expect(page).to have_content("Unconfirmed debate")
|
expect(page).to have_content("Unconfirmed debate")
|
||||||
expect(page).not_to have_content("Confirmed debate")
|
expect(page).not_to have_content("Confirmed debate")
|
||||||
|
|
||||||
visit admin_debates_path(filter: "all")
|
visit admin_hidden_debates_path(filter: "all")
|
||||||
expect(page).to have_content("Unconfirmed debate")
|
expect(page).to have_content("Unconfirmed debate")
|
||||||
expect(page).to have_content("Confirmed debate")
|
expect(page).to have_content("Confirmed debate")
|
||||||
|
|
||||||
visit admin_debates_path(filter: "with_confirmed_hide")
|
visit admin_hidden_debates_path(filter: "with_confirmed_hide")
|
||||||
expect(page).not_to have_content("Unconfirmed debate")
|
expect(page).not_to have_content("Unconfirmed debate")
|
||||||
expect(page).to have_content("Confirmed debate")
|
expect(page).to have_content("Confirmed debate")
|
||||||
end
|
end
|
||||||
@@ -85,7 +85,7 @@ describe "Admin debates" do
|
|||||||
per_page = Kaminari.config.default_per_page
|
per_page = Kaminari.config.default_per_page
|
||||||
(per_page + 2).times { create(:debate, :hidden, :with_confirmed_hide) }
|
(per_page + 2).times { create(:debate, :hidden, :with_confirmed_hide) }
|
||||||
|
|
||||||
visit admin_debates_path(filter: "with_confirmed_hide", page: 2)
|
visit admin_hidden_debates_path(filter: "with_confirmed_hide", page: 2)
|
||||||
|
|
||||||
click_on("Restore", match: :first, exact: true)
|
click_on("Restore", match: :first, exact: true)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user