Merge branch 'master' into moderator_comments
This commit is contained in:
@@ -4,4 +4,4 @@ App.ModeratorComments =
|
||||
$("##{id} .comment-body:first").addClass("faded")
|
||||
|
||||
hide_moderator_actions: (id) ->
|
||||
$("##{id} #moderator-comment-actions:first").hide()
|
||||
$("##{id} .js-moderator-comment-actions").hide()
|
||||
|
||||
@@ -5,4 +5,4 @@ App.ModeratorDebates =
|
||||
$("#comments").addClass("faded")
|
||||
|
||||
hide_moderator_actions: (id) ->
|
||||
$("##{id} #moderator-debate-actions:first").hide()
|
||||
$("##{id} .js-moderator-debate-actions:first").hide()
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<span id="moderator-comment-actions">
|
||||
|
|
||||
<%= link_to t("admin.actions.hide").capitalize, hide_moderation_comment_path(comment),
|
||||
method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %>
|
||||
<% unless comment.user.hidden? %>
|
||||
<span class='js-moderation-actions'>
|
||||
<% if can? :hide, comment %>
|
||||
|
|
||||
<%= link_to t("admin.actions.hide").capitalize, hide_moderation_comment_path(comment),
|
||||
method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %>
|
||||
<% end %>
|
||||
|
||||
<% if can? :hide, comment.user %>
|
||||
|
|
||||
<%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(comment.user_id, debate_id: @debate.id),
|
||||
method: :put, data: { confirm: t('admin.actions.confirm') } %>
|
||||
|
||||
@@ -89,9 +89,7 @@
|
||||
<%= link_to(comment_link_text(comment), "",
|
||||
class: "js-add-comment-link", data: {'id': dom_id(comment)}) %>
|
||||
|
||||
<% if moderator? %>
|
||||
<%= render 'comments/actions', comment: comment %>
|
||||
<% end %>
|
||||
<%= render 'comments/actions', comment: comment %>
|
||||
|
||||
<%= render 'comments/form', {parent: comment, toggeable: true} %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<%= link_to t("admin.actions.hide").capitalize, hide_moderation_debate_path(debate),
|
||||
method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %>
|
||||
<% if can? :hide, debate %>
|
||||
<%= link_to t("admin.actions.hide").capitalize, hide_moderation_debate_path(debate),
|
||||
method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %>
|
||||
<% end %>
|
||||
|
||||
<% unless debate.author.hidden? %>
|
||||
<% if can? :hide, debate.author %>
|
||||
|
|
||||
<%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(debate.author_id),
|
||||
method: :put, data: { confirm: t('admin.actions.confirm') } %>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<%= render 'shared/tags', debate: @debate %>
|
||||
|
||||
<% if moderator? %>
|
||||
<div id='moderator-debate-actions'>
|
||||
<div class='js-moderator-debate-actions'>
|
||||
<%= render 'actions', debate: @debate %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -42,4 +42,6 @@ Rails.application.configure do
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ Rails.application.configure do
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
config.cache_store = :null_store
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
@@ -55,7 +55,7 @@ Rails.application.configure do
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
config.cache_store = :null_store
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
@@ -43,4 +43,6 @@ Rails.application.configure do
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
@@ -147,4 +147,4 @@ es:
|
||||
manage:
|
||||
all: "No tienes permiso para realizar la acción '%{action}' sobre %{subject}."
|
||||
welcome:
|
||||
last_debates: Úlitmos debates
|
||||
last_debates: Últimos debates
|
||||
|
||||
@@ -59,17 +59,38 @@ feature 'Moderate Comments' do
|
||||
moderator = create(:moderator)
|
||||
|
||||
debate = create(:debate)
|
||||
create(:comment, commentable: debate)
|
||||
comment = create(:comment, commentable: debate)
|
||||
|
||||
login_as(moderator.user)
|
||||
visit debate_path(debate)
|
||||
|
||||
expect(page).to have_css("#moderator-comment-actions")
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link("Hide")
|
||||
expect(page).to have_link("Ban author")
|
||||
end
|
||||
|
||||
login_as(citizen)
|
||||
visit debate_path(debate)
|
||||
|
||||
expect(page).to_not have_css("#moderator-comment-actions")
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to_not have_link("Hide")
|
||||
expect(page).to_not have_link("Ban author")
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Moderator actions do not appear in own comments' do
|
||||
moderator = create(:moderator)
|
||||
|
||||
debate = create(:debate)
|
||||
comment = create(:comment, commentable: debate, user: moderator.user)
|
||||
|
||||
login_as(moderator.user)
|
||||
visit debate_path(debate)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to_not have_link("Hide")
|
||||
expect(page).to_not have_link("Ban author")
|
||||
end
|
||||
end
|
||||
|
||||
feature '/moderation/ menu' do
|
||||
|
||||
@@ -23,6 +23,19 @@ feature 'Moderate debates' do
|
||||
expect(page).to have_css('.debate', count: 0)
|
||||
end
|
||||
|
||||
scenario 'Can not hide own debate' do
|
||||
moderator = create(:moderator)
|
||||
debate = create(:debate, author: moderator.user)
|
||||
|
||||
login_as(moderator.user)
|
||||
visit debate_path(debate)
|
||||
|
||||
within("#debate_#{debate.id}") do
|
||||
expect(page).to_not have_link('Hide')
|
||||
expect(page).to_not have_link('Block author')
|
||||
end
|
||||
end
|
||||
|
||||
feature '/moderation/ menu' do
|
||||
|
||||
background do
|
||||
|
||||
Reference in New Issue
Block a user