Merge pull request #251 from AyuntamientoMadrid/flag_inappropriate
Flag as inappropriate styles
This commit is contained in:
Binary file not shown.
@@ -29,4 +29,5 @@
|
||||
<glyph unicode="u" d="M165 384c0 10-4 19-11 26-7 7-16 11-26 11-10 0-19-4-26-11-7-7-11-16-11-26 0-10 4-19 11-26 7-7 16-11 26-11 10 0 19 4 26 11 7 7 11 16 11 26z m304-165c0-10-3-18-10-25l-140-141c-8-7-17-10-26-10-11 0-19 3-26 10l-204 205c-8 7-14 16-19 29-5 12-7 23-7 33l0 119c0 10 3 18 10 26 8 7 16 10 26 10l119 0c10 0 21-2 33-7 13-5 22-11 30-19l204-204c7-7 10-16 10-26z"/>
|
||||
<glyph unicode="p" d="M475 238c-29 45-65 78-108 101 11-20 17-42 17-65 0-35-13-65-38-90-25-25-55-38-90-38-35 0-65 13-90 38-25 25-38 55-38 90 0 23 6 45 17 65-43-23-79-56-108-101 25-39 57-70 95-94 38-23 79-34 124-34 45 0 86 11 124 34 38 24 70 55 95 94z m-205 109c0 4-2 7-4 10-3 3-6 4-10 4-24 0-44-8-61-25-17-17-26-38-26-62 0-4 1-7 4-9 3-3 6-4 10-4 4 0 7 1 10 4 2 2 4 5 4 9 0 17 5 31 17 42 12 12 26 18 42 18 4 0 7 1 10 4 2 2 4 6 4 9z m242-109c0-7-2-13-6-20-26-44-62-79-107-105-45-27-93-40-143-40-50 0-98 13-143 40-45 26-81 61-107 105-4 7-6 13-6 20 0 6 2 13 6 19 26 44 62 79 107 106 45 26 93 39 143 39 50 0 98-13 143-39 45-27 81-62 107-106 4-6 6-13 6-19z"/>
|
||||
<glyph unicode="v" d="M426 134c0-7-3-14-8-19l-39-39c-5-5-12-8-20-8-7 0-14 3-19 8l-84 84-84-84c-5-5-12-8-19-8-8 0-15 3-20 8l-39 39c-5 5-8 12-8 19 0 8 3 14 8 20l84 84-84 84c-5 5-8 12-8 19 0 8 3 14 8 20l39 38c5 6 12 8 20 8 7 0 14-2 19-8l84-84 84 84c5 6 12 8 19 8 8 0 15-2 20-8l39-38c5-6 8-12 8-20 0-7-3-14-8-19l-84-84 84-84c5-6 8-12 8-20z"/>
|
||||
<glyph unicode="w" d="M434 389c-1 0-2 0-3 0l0 0c-17-9-37-14-58-14-38 0-73 17-95 45-21 19-49 31-80 31-29 0-56-11-77-29-4 9-13 15-24 15-15 0-27-12-27-27l0-322c0-15 12-27 27-27 15 0 27 12 27 27l0 145c17 9 36 13 56 13 39 0 73-17 96-45 21-19 49-31 79-31 33 0 63 14 84 36 2 2 3 4 3 6l0 169c0 5-4 8-8 8z"/>
|
||||
</font></defs></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Binary file not shown.
@@ -140,7 +140,7 @@ body.admin {
|
||||
|
||||
.delete {
|
||||
border-bottom: 1px dotted #CF2A0E;
|
||||
color: #F04124;
|
||||
color: $delete;
|
||||
font-size: rem-calc(12);
|
||||
|
||||
&:hover, &:active, &:focus {
|
||||
@@ -151,16 +151,27 @@ body.admin {
|
||||
|
||||
.verified {
|
||||
color: $check;
|
||||
|
||||
a {
|
||||
border-bottom: 1px dotted $check;
|
||||
color: $check;
|
||||
font-size: rem-calc(12);
|
||||
}
|
||||
}
|
||||
|
||||
.verified a {
|
||||
border-bottom: 1px dotted $check;
|
||||
color: $check;
|
||||
.archived {
|
||||
color: $text-medium;
|
||||
font-size: rem-calc(12);
|
||||
}
|
||||
|
||||
.rejected {
|
||||
color: #F04124;
|
||||
color: $delete;
|
||||
}
|
||||
|
||||
.date {
|
||||
color: $text-medium;
|
||||
font-size: rem-calc(12);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.level {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// 03. Show
|
||||
// 04. New
|
||||
// 05. Comments
|
||||
// 06. Flags
|
||||
//
|
||||
|
||||
// 01. Debates
|
||||
@@ -541,6 +542,10 @@
|
||||
font-size: rem-calc(12);
|
||||
margin: rem-calc(6) 0;
|
||||
padding: rem-calc(6);
|
||||
|
||||
.divider {
|
||||
color: $text-light;
|
||||
}
|
||||
}
|
||||
|
||||
.comment-user {
|
||||
@@ -608,3 +613,17 @@
|
||||
.faded {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
// 06. Flags
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
.flag-disable {
|
||||
color: $text-medium;
|
||||
line-height: rem-calc(24);
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.flag-active {
|
||||
@extend .flag-disable;
|
||||
color: $delete;
|
||||
}
|
||||
|
||||
@@ -103,3 +103,7 @@
|
||||
.icon-x:before {
|
||||
content: "v";
|
||||
}
|
||||
.icon-flag:before {
|
||||
content: "w";
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ h1, h2, h3, h4, h5, h6 {
|
||||
}
|
||||
|
||||
.sub-nav dt, .sub-nav dd, .sub-nav li {
|
||||
padding: rem-calc(3) 0;
|
||||
|
||||
&.active {
|
||||
background: #008CBA;
|
||||
@@ -142,7 +143,7 @@ h1, h2, h3, h4, h5, h6 {
|
||||
color: white;
|
||||
cursor: default;
|
||||
font-weight: normal;
|
||||
padding: 0.16667rem 0.88889rem;
|
||||
padding: rem-calc(3) rem-calc(14);
|
||||
|
||||
a:hover {
|
||||
color: #737373;
|
||||
@@ -150,6 +151,24 @@ h1, h2, h3, h4, h5, h6 {
|
||||
}
|
||||
}
|
||||
|
||||
.f-dropdown {
|
||||
li a {
|
||||
font-size: rem-calc(12);
|
||||
|
||||
&:hover {
|
||||
color: $link-hover;
|
||||
}
|
||||
}
|
||||
|
||||
li:hover, .f-dropdown li:focus {
|
||||
background: white;
|
||||
}
|
||||
|
||||
&.open {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.margin {
|
||||
margin-top: $line-height;
|
||||
margin-bottom: $line-height;
|
||||
@@ -710,13 +729,13 @@ form {
|
||||
}
|
||||
}
|
||||
|
||||
img.admin-avatar, img.moderator-avatar {
|
||||
img.avatar, img.admin-avatar, img.moderator-avatar {
|
||||
border-radius: rem-calc(1000);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
img.initialjs-avatar {
|
||||
@extend .moderator-avatar;
|
||||
@extend .avatar;
|
||||
}
|
||||
|
||||
.author-deleted {
|
||||
|
||||
@@ -38,6 +38,7 @@ $votes-like-act: #5D9E7F;
|
||||
$votes-unlike: #EF8585;
|
||||
$votes-unlike-act: #BD6A6A;
|
||||
|
||||
$delete: #F04124;
|
||||
$check: #46DB91;
|
||||
|
||||
// 03. Forms
|
||||
|
||||
@@ -19,8 +19,8 @@ class Moderation::CommentsController < Moderation::BaseController
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
def mark_as_reviewed
|
||||
@comment.mark_as_reviewed
|
||||
def archive
|
||||
@comment.archive
|
||||
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_review reviewed}
|
||||
@valid_filters = %w{all pending archived}
|
||||
end
|
||||
|
||||
def parse_filter
|
||||
|
||||
@@ -19,8 +19,8 @@ class Moderation::DebatesController < Moderation::BaseController
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
def mark_as_reviewed
|
||||
@debate.mark_as_reviewed
|
||||
def archive
|
||||
@debate.archive
|
||||
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_review reviewed}
|
||||
@valid_filters = %w{all pending archived}
|
||||
end
|
||||
|
||||
def parse_filter
|
||||
|
||||
@@ -53,14 +53,14 @@ class Ability
|
||||
can :hide, Comment, hidden_at: nil
|
||||
cannot :hide, Comment, user_id: user.id
|
||||
|
||||
can :mark_as_reviewed, Comment, reviewed_at: nil, hidden_at: nil
|
||||
cannot :mark_as_reviewed, Comment, user_id: user.id
|
||||
can :archive, Comment, archived_at: nil, hidden_at: nil
|
||||
cannot :archive, Comment, user_id: user.id
|
||||
|
||||
can :hide, Debate, hidden_at: nil
|
||||
cannot :hide, Debate, author_id: user.id
|
||||
|
||||
can :mark_as_reviewed, Debate, reviewed_at: nil, hidden_at: nil
|
||||
cannot :mark_as_reviewed, Debate, author_id: user.id
|
||||
can :archive, Debate, archived_at: nil, hidden_at: nil
|
||||
cannot :archive, Debate, author_id: user.id
|
||||
|
||||
can :hide, User
|
||||
cannot :hide, User, id: user.id
|
||||
|
||||
@@ -18,8 +18,8 @@ class Comment < ActiveRecord::Base
|
||||
scope :recent, -> { order(id: :desc) }
|
||||
|
||||
scope :sorted_for_moderation, -> { order(inappropiate_flags_count: :desc, updated_at: :desc) }
|
||||
scope :pending_review, -> { where(reviewed_at: nil, hidden_at: nil) }
|
||||
scope :reviewed, -> { where("reviewed_at IS NOT NULL AND hidden_at IS NULL") }
|
||||
scope :pending, -> { where(archived_at: nil, hidden_at: nil) }
|
||||
scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") }
|
||||
scope :flagged_as_inappropiate, -> { where("inappropiate_flags_count > 0") }
|
||||
|
||||
def self.build(commentable, user, body)
|
||||
@@ -56,8 +56,8 @@ class Comment < ActiveRecord::Base
|
||||
hidden? || user.hidden?
|
||||
end
|
||||
|
||||
def reviewed?
|
||||
reviewed_at.present?
|
||||
def archived?
|
||||
archived_at.present?
|
||||
end
|
||||
|
||||
def as_administrator?
|
||||
@@ -68,8 +68,8 @@ class Comment < ActiveRecord::Base
|
||||
moderator_id.present?
|
||||
end
|
||||
|
||||
def mark_as_reviewed
|
||||
update(reviewed_at: Time.now)
|
||||
def archive
|
||||
update(archived_at: Time.now)
|
||||
end
|
||||
|
||||
# TODO: faking counter cache since there is a bug with acts_as_nested_set :counter_cache
|
||||
|
||||
@@ -24,8 +24,8 @@ class Debate < ActiveRecord::Base
|
||||
before_validation :sanitize_tag_list
|
||||
|
||||
scope :sorted_for_moderation, -> { order(inappropiate_flags_count: :desc, updated_at: :desc) }
|
||||
scope :pending_review, -> { where(reviewed_at: nil, hidden_at: nil) }
|
||||
scope :reviewed, -> { where("reviewed_at IS NOT NULL AND hidden_at IS NULL") }
|
||||
scope :pending, -> { where(archived_at: nil, hidden_at: nil) }
|
||||
scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") }
|
||||
scope :flagged_as_inappropiate, -> { where("inappropiate_flags_count > 0") }
|
||||
|
||||
# Ahoy setup
|
||||
@@ -74,12 +74,12 @@ class Debate < ActiveRecord::Base
|
||||
count < 0 ? 0 : count
|
||||
end
|
||||
|
||||
def reviewed?
|
||||
reviewed_at.present?
|
||||
def archived?
|
||||
archived_at.present?
|
||||
end
|
||||
|
||||
def mark_as_reviewed
|
||||
update(reviewed_at: Time.now)
|
||||
def archive
|
||||
update(archived_at: Time.now)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<span class="js-flag-as-inappropiate-actions">
|
||||
<%= render 'comments/flag_as_inappropiate_actions', comment: comment %>
|
||||
</span>
|
||||
|
||||
<span class='js-moderation-actions'>
|
||||
<% if can? :hide, comment %>
|
||||
|
|
||||
<span class="divider"> • </span>
|
||||
<%= 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 %>
|
||||
|
|
||||
<span class="divider"> • </span>
|
||||
<%= 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') } %>
|
||||
<% end %>
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
<% end %>
|
||||
|
||||
• <%= time_ago_in_words(comment.created_at) %>
|
||||
|
||||
<span class="right js-flag-as-inappropiate-actions">
|
||||
<%= render 'comments/flag_as_inappropiate_actions', comment: comment %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<% if comment.as_administrator? %>
|
||||
@@ -81,11 +77,11 @@
|
||||
<%= render 'comments/votes', comment: comment %>
|
||||
</span>
|
||||
|
||||
<p class="reply">
|
||||
<div class="reply">
|
||||
<%= t("debates.comment.responses", count: comment.children_count) %>
|
||||
|
||||
<% if user_signed_in? %>
|
||||
|
|
||||
<span class="divider"> | </span>
|
||||
<%= link_to(comment_link_text(comment), "",
|
||||
class: "js-add-comment-link", data: {'id': dom_id(comment)}) %>
|
||||
|
||||
@@ -93,7 +89,7 @@
|
||||
|
||||
<%= render 'comments/form', {parent: comment, toggeable: true} %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
<% if can? :flag_as_inappropiate, comment %>
|
||||
<%= link_to t('shared.flag_as_inappropiate'), flag_as_inappropiate_comment_path(comment), method: :put, remote: true %>
|
||||
<span class="divider"> | </span>
|
||||
<a id="flag-expand-comment-<%= comment.id %>" data-dropdown="flag-drop-comment-<%= comment.id %>" aria-controls="flag-drop-comment-<%= comment.id %>" aria-expanded="false" title="<%= t('shared.flag_as_inappropiate') %>">
|
||||
<i class="icon-flag flag-disable"></i>
|
||||
</a>
|
||||
<ul id="flag-drop-comment-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t("shared.flag_as_inappropiate"), flag_as_inappropiate_comment_path(comment), method: :put, remote: true, id: "flag-comment-#{comment.id}" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% if can? :undo_flag_as_inappropiate, comment %>
|
||||
<%= link_to t('shared.undo_flag_as_inappropiate'), undo_flag_as_inappropiate_comment_path(comment), method: :put, remote: true %>
|
||||
<span class="divider"> | </span>
|
||||
<a id="unflag-expand-comment-<%= comment.id %>" data-dropdown="unflag-drop-comment-<%= comment.id %>" aria-controls="unflag-drop-comment-<%= comment.id %>" aria-expanded="false" title="<%= t('shared.undo_flag_as_inappropiate') %>">
|
||||
<i class="icon-flag flag-active"></i>
|
||||
</a>
|
||||
<ul id="unflag-drop-comment-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t("shared.undo_flag_as_inappropiate"), undo_flag_as_inappropiate_comment_path(comment), method: :put, remote: true, id: "unflag-comment-#{comment.id}" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
<% if can? :flag_as_inappropiate, debate %>
|
||||
<%= link_to t('shared.flag_as_inappropiate'), flag_as_inappropiate_debate_path(debate), method: :put, remote: true %>
|
||||
<a id="flag-expand-debate-<%= debate.id %>" data-dropdown="flag-drop-debate-<%= debate.id %>" aria-controls="flag-drop-debate-<%= debate.id %>" aria-expanded="false" title="<%= t('shared.flag_as_inappropiate') %>">
|
||||
<i class="icon-flag flag-disable"></i>
|
||||
</a>
|
||||
<ul id="flag-drop-debate-<%= debate.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t('shared.flag_as_inappropiate'), flag_as_inappropiate_debate_path(debate), method: :put, remote: true, id: "flag-debate-#{ debate.id }" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% if can? :undo_flag_as_inappropiate, debate %>
|
||||
<%= link_to t('shared.undo_flag_as_inappropiate'), undo_flag_as_inappropiate_debate_path(debate), method: :put, remote: true %>
|
||||
<a id="unflag-expand-debate-<%= debate.id %>" data-dropdown="unflag-drop-debate-<%= debate.id %>" aria-controls="unflag-drop-debate-<%= debate.id %>" aria-expanded="false" title="<%= t('shared.undo_flag_as_inappropiate') %>">
|
||||
<i class="icon-flag flag-active"></i>
|
||||
</a>
|
||||
<ul id="unflag-drop-debate-<%= debate.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t('shared.undo_flag_as_inappropiate'), undo_flag_as_inappropiate_debate_path(debate), method: :put, remote: true, id: "unflag-debate-#{ debate.id }" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
<span class="bullet"> • </span>
|
||||
<i class="icon-comments"></i>
|
||||
<%= link_to t("debates.show.comments", count: @debate.comment_threads.count), "#comments" %>
|
||||
|
||||
<span class='right js-flag-as-inappropiate-actions'>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="js-flag-as-inappropiate-actions">
|
||||
<%= render 'debates/flag_as_inappropiate_actions', debate: @debate %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
<%= t("moderation.dashboard.index.title") %>
|
||||
</li>
|
||||
|
||||
<li <%= 'class=active' if controller_name == 'debates' %>>
|
||||
<li <%= "class=active" if controller_name == "debates" %>>
|
||||
<%= link_to moderation_debates_path do %>
|
||||
<i class="icon-debates"></i>
|
||||
<%= t('moderation.menu.flagged_debates') %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li <%= 'class=active' if controller_name == 'comments' %>>
|
||||
<li <%= "class=active" if controller_name == "comments" %>>
|
||||
<%= link_to moderation_comments_path do %>
|
||||
<i class="icon-comments"></i>
|
||||
<%= t('moderation.menu.flagged_comments') %>
|
||||
<%= t("moderation.menu.flagged_comments") %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -1,45 +1,52 @@
|
||||
<h2><%= t('moderation.comments.index.title') %></h2>
|
||||
<h2><%= t("moderation.comments.index.title") %></h2>
|
||||
|
||||
<dl class="sub-nav">
|
||||
<dt><%= t("moderation.comments.index.filter") %>:</dt>
|
||||
|
||||
<p>
|
||||
<%= t('moderation.comments.index.filter') %>:
|
||||
<% @valid_filters.each do |filter| %>
|
||||
<% if @filter == filter %>
|
||||
<%= t("moderation.comments.index.filters.#{filter}") %>
|
||||
<dd class="active"><%= t("moderation.comments.index.filters.#{filter}") %></dd>
|
||||
<% else %>
|
||||
<%= link_to t("moderation.comments.index.filters.#{filter}"),
|
||||
moderation_comments_path(filter: filter) %>
|
||||
<dd><%= link_to t("moderation.comments.index.filters.#{filter}"),
|
||||
moderation_comments_path(filter: filter) %></dd>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
</dl>
|
||||
|
||||
<h3><%= page_entries_info @comments %></h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('moderation.comments.index.headers.flags') %></th>
|
||||
<th><%= t('moderation.comments.index.headers.updated_at') %></th>
|
||||
<th><%= t('moderation.comments.index.headers.commentable_type') %></th>
|
||||
<th><%= t('moderation.comments.index.headers.commentable') %></th>
|
||||
<th><%= t('moderation.comments.index.headers.comment') %></th>
|
||||
<th>
|
||||
<%= t("moderation.comments.index.headers.commentable") %> |
|
||||
<%= t("moderation.comments.index.headers.commentable_type") %> |
|
||||
<%= t("moderation.comments.index.headers.updated_at") %>
|
||||
</th>
|
||||
<th><%= t("moderation.comments.index.headers.comment") %></th>
|
||||
<th class="text-center"><%= t("moderation.comments.index.headers.flags") %></th>
|
||||
<th class="text-center" colspan="2"><%= t("moderation.debates.index.headers.actions") %></th>
|
||||
</tr>
|
||||
<% @comments.each do |comment| %>
|
||||
<tr id="comment_<%= comment.id %>">
|
||||
<td><%= comment.inappropiate_flags_count %></td>
|
||||
<td><%= l comment.updated_at.to_date %></td>
|
||||
<td><%= comment.commentable_type.constantize.model_name.human %></td>
|
||||
<td><%= link_to comment.commentable.title, comment.commentable %></td>
|
||||
<td><%= comment.body %></td>
|
||||
<td>
|
||||
<%= link_to t('moderation.comments.index.hide'), hide_in_moderation_screen_moderation_comment_path(comment, request.query_parameters), method: :put %>
|
||||
<%= link_to comment.commentable.title, comment.commentable %>
|
||||
<br>
|
||||
<%= comment.commentable_type.constantize.model_name.human %>
|
||||
<span class="date"><%= l comment.updated_at.to_date %></span>
|
||||
</td>
|
||||
<% if can? :mark_as_reviewed, comment %>
|
||||
<td><%= comment.body %></td>
|
||||
<td class="text-center"><%= comment.inappropiate_flags_count %></td>
|
||||
<td>
|
||||
<%= link_to t("moderation.comments.index.hide"), hide_in_moderation_screen_moderation_comment_path(comment, request.query_parameters), method: :put, class: "delete" %>
|
||||
</td>
|
||||
<% if can? :archive, comment %>
|
||||
<td>
|
||||
<%= link_to t('moderation.comments.index.mark_as_reviewed'), mark_as_reviewed_moderation_comment_path(comment, request.query_parameters), method: :put %>
|
||||
<%= link_to t("moderation.comments.index.archive"), archive_moderation_comment_path(comment, request.query_parameters), method: :put, class: "button radius tiny warning" %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% if comment.reviewed? %>
|
||||
<td>
|
||||
<%= t('moderation.comments.index.reviewed') %>
|
||||
<% if comment.archived? %>
|
||||
<td class="archived">
|
||||
<%= t("moderation.comments.index.archived") %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
@@ -47,4 +54,3 @@
|
||||
</table>
|
||||
|
||||
<%= paginate @comments %>
|
||||
|
||||
|
||||
@@ -1,43 +1,51 @@
|
||||
<h2><%= t('moderation.debates.index.title') %></h2>
|
||||
<h2><%= t("moderation.debates.index.title") %></h2>
|
||||
|
||||
<dl class="sub-nav">
|
||||
<dt><%= t("moderation.debates.index.filter") %>:</dt>
|
||||
|
||||
<p>
|
||||
<%= t('moderation.debates.index.filter') %>:
|
||||
<% @valid_filters.each do |filter| %>
|
||||
<% if @filter == filter %>
|
||||
<%= t("moderation.debates.index.filters.#{filter}") %>
|
||||
<dd class="active"><%= t("moderation.debates.index.filters.#{filter}") %></dd>
|
||||
<% else %>
|
||||
<%= link_to t("moderation.debates.index.filters.#{filter}"),
|
||||
moderation_debates_path(filter: filter) %>
|
||||
<dd><%= link_to t("moderation.debates.index.filters.#{filter}"),
|
||||
moderation_debates_path(filter: filter) %></dd>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
</dl>
|
||||
|
||||
<h3><%= page_entries_info @debates %></h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('moderation.debates.index.headers.flags') %></th>
|
||||
<th><%= t('moderation.debates.index.headers.updated_at') %></th>
|
||||
<th><%= t('moderation.debates.index.headers.title') %></th>
|
||||
<th><%= t('moderation.debates.index.headers.description') %></th>
|
||||
<th>
|
||||
<%= t("moderation.debates.index.headers.title") %> |
|
||||
<%= t("moderation.debates.index.headers.updated_at") %> |
|
||||
<%= t("moderation.debates.index.headers.description") %>
|
||||
</th>
|
||||
<th class="text-center"><%= t("moderation.debates.index.headers.flags") %></th>
|
||||
<th class="text-center" colspan="2"><%= t("moderation.debates.index.headers.actions") %></th>
|
||||
</tr>
|
||||
<% @debates.each do |debate| %>
|
||||
<tr id="debate_<%= debate.id %>">
|
||||
<td><%= debate.inappropiate_flags_count %></td>
|
||||
<td><%= l debate.updated_at.to_date %></td>
|
||||
<td><%= link_to debate.title, debate %></td>
|
||||
<td><%= debate.description %></td>
|
||||
<td>
|
||||
<%= link_to t('moderation.debates.index.hide'), hide_in_moderation_screen_moderation_debate_path(debate, request.query_parameters), method: :put %>
|
||||
<%= link_to debate.title, debate, target: "_blank" %>
|
||||
<br>
|
||||
<span class="date"><%= l debate.updated_at.to_date %></span>
|
||||
<br>
|
||||
<%= debate.description %>
|
||||
</td>
|
||||
<% if can? :mark_as_reviewed, debate %>
|
||||
<td class="text-center"><%= debate.inappropiate_flags_count %></td>
|
||||
<td>
|
||||
<%= link_to t("moderation.debates.index.hide"), hide_in_moderation_screen_moderation_debate_path(debate, request.query_parameters), method: :put, class: "delete" %>
|
||||
</td>
|
||||
<% if can? :archive, debate %>
|
||||
<td>
|
||||
<%= link_to t('moderation.debates.index.mark_as_reviewed'), mark_as_reviewed_moderation_debate_path(debate, request.query_parameters), method: :put %>
|
||||
<%= link_to t("moderation.debates.index.archive"), archive_moderation_debate_path(debate, request.query_parameters), method: :put, class: "button radius tiny warning" %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% if debate.reviewed? %>
|
||||
<td>
|
||||
<%= t('moderation.debates.index.reviewed') %>
|
||||
<% if debate.archived? %>
|
||||
<td class="archived">
|
||||
<%= t("moderation.debates.index.archived") %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
@@ -45,4 +53,3 @@
|
||||
</table>
|
||||
|
||||
<%= paginate @debates %>
|
||||
|
||||
|
||||
@@ -134,8 +134,8 @@ en:
|
||||
shared:
|
||||
tags_cloud:
|
||||
tags: Topics
|
||||
flag_as_inappropiate: Flag as inappropiate
|
||||
undo_flag_as_inappropiate: Undo flag as inappropiate
|
||||
flag_as_inappropiate: Flag as inappropriate
|
||||
undo_flag_as_inappropiate: Undo flag
|
||||
collective: Collective
|
||||
mailer:
|
||||
comment:
|
||||
|
||||
@@ -135,7 +135,7 @@ es:
|
||||
tags_cloud:
|
||||
tags: Temas
|
||||
flag_as_inappropiate: Denunciar como inapropiado
|
||||
undo_flag_as_inappropiate: Deshacer denunciar como inapropiado
|
||||
undo_flag_as_inappropiate: Deshacer denuncia
|
||||
collective: Colectivo
|
||||
mailer:
|
||||
comment:
|
||||
|
||||
@@ -8,7 +8,7 @@ en:
|
||||
title: Moderation
|
||||
comments:
|
||||
index:
|
||||
title: Comments flagged as inappropiate
|
||||
title: Comments flagged as inappropriate
|
||||
headers:
|
||||
flags: Flags
|
||||
updated_at: Date
|
||||
@@ -16,27 +16,27 @@ en:
|
||||
commentable: Root
|
||||
comment: Comment
|
||||
hide: Hide
|
||||
mark_as_reviewed: Mark as reviewed
|
||||
reviewed: Reviewed
|
||||
archive: Archive
|
||||
archived: Archived
|
||||
filter: Filter
|
||||
filters:
|
||||
all: All
|
||||
pending_review: Pending
|
||||
reviewed: Reviewed
|
||||
pending: Pending
|
||||
archived: Archived
|
||||
debates:
|
||||
index:
|
||||
title: Debates flagged as inappropiate
|
||||
title: Debates flagged as inappropriate
|
||||
headers:
|
||||
flags: Flags
|
||||
updated_at: Date
|
||||
title: Title
|
||||
description: Description
|
||||
actions: Actions
|
||||
hide: Hide
|
||||
mark_as_reviewed: Mark as reviewed
|
||||
reviewed: Reviewed
|
||||
archive: Archive
|
||||
archived: Archived
|
||||
filter: Filter
|
||||
filters:
|
||||
all: All
|
||||
pending_review: Pending
|
||||
reviewed: Reviewed
|
||||
|
||||
pending: Pending
|
||||
archived: Archived
|
||||
|
||||
@@ -8,7 +8,7 @@ es:
|
||||
title: Moderación
|
||||
comments:
|
||||
index:
|
||||
title: Comentarios Denunciados como Inapropiados
|
||||
title: Comentarios denunciados como inapropiados
|
||||
headers:
|
||||
flags: Denuncias
|
||||
updated_at: Fecha
|
||||
@@ -16,28 +16,27 @@ es:
|
||||
commentable: Raíz
|
||||
comment: Comentario
|
||||
hide: Ocultar
|
||||
mark_as_reviewed: Marcar como revisado
|
||||
reviewed: Revisado
|
||||
archive: Archivar
|
||||
archived: Archivado
|
||||
filter: Filtrar
|
||||
filters:
|
||||
all: Todos
|
||||
pending_review: Pendientes
|
||||
reviewed: Revisados
|
||||
pending: Pendientes
|
||||
archived: Archivados
|
||||
debates:
|
||||
index:
|
||||
title: Debates Denunciados como Inapropiados
|
||||
title: Debates denunciados como inapropiados
|
||||
headers:
|
||||
flags: Denuncias
|
||||
updated_at: Fecha
|
||||
title: Título
|
||||
description: Descripción
|
||||
actions: Acciones
|
||||
hide: Ocultar
|
||||
mark_as_reviewed: Marcar como revisado
|
||||
reviewed: Revisado
|
||||
archive: Archivar
|
||||
archived: Archivado
|
||||
filter: Filtrar
|
||||
filters:
|
||||
all: Todos
|
||||
pending_review: Pendientes
|
||||
reviewed: Revisados
|
||||
|
||||
|
||||
pending: Pendientes
|
||||
archived: Archivados
|
||||
|
||||
@@ -88,7 +88,7 @@ Rails.application.routes.draw do
|
||||
member do
|
||||
put :hide
|
||||
put :hide_in_moderation_screen
|
||||
put :mark_as_reviewed
|
||||
put :archive
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ Rails.application.routes.draw do
|
||||
member do
|
||||
put :hide
|
||||
put :hide_in_moderation_screen
|
||||
put :mark_as_reviewed
|
||||
put :archive
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class RenameReviewedAtToArchivedAtInCommentsAndDebates < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :comments, :reviewed_at, :archived_at
|
||||
rename_column :debates, :reviewed_at, :archived_at
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150824144524) do
|
||||
ActiveRecord::Schema.define(version: 20150826112411) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -51,7 +51,7 @@ ActiveRecord::Schema.define(version: 20150824144524) do
|
||||
t.datetime "hidden_at"
|
||||
t.datetime "flagged_as_inappropiate_at"
|
||||
t.integer "inappropiate_flags_count", default: 0
|
||||
t.datetime "reviewed_at"
|
||||
t.datetime "archived_at"
|
||||
t.integer "moderator_id"
|
||||
t.integer "administrator_id"
|
||||
end
|
||||
@@ -70,7 +70,7 @@ ActiveRecord::Schema.define(version: 20150824144524) do
|
||||
t.datetime "hidden_at"
|
||||
t.datetime "flagged_as_inappropiate_at"
|
||||
t.integer "inappropiate_flags_count", default: 0
|
||||
t.datetime "reviewed_at"
|
||||
t.datetime "archived_at"
|
||||
end
|
||||
|
||||
add_index "debates", ["hidden_at"], name: "index_debates_on_hidden_at", using: :btree
|
||||
|
||||
@@ -22,8 +22,8 @@ FactoryGirl.define do
|
||||
hidden_at Time.now
|
||||
end
|
||||
|
||||
trait :reviewed do
|
||||
reviewed_at Time.now
|
||||
trait :archived do
|
||||
archived_at Time.now
|
||||
end
|
||||
|
||||
trait :flagged_as_inappropiate do
|
||||
@@ -48,8 +48,8 @@ FactoryGirl.define do
|
||||
hidden_at Time.now
|
||||
end
|
||||
|
||||
trait :reviewed do
|
||||
reviewed_at Time.now
|
||||
trait :archived do
|
||||
archived_at Time.now
|
||||
end
|
||||
|
||||
trait :flagged_as_inappropiate do
|
||||
|
||||
@@ -133,7 +133,7 @@ feature 'Comments' do
|
||||
expect(page).to have_css(".comment.comment.comment.comment.comment.comment.comment.comment")
|
||||
end
|
||||
|
||||
scenario "Flagging as inappropiate", :js do
|
||||
scenario "Flagging as inappropriate", :js do
|
||||
user = create(:user)
|
||||
debate = create(:debate)
|
||||
comment = create(:comment, commentable: debate)
|
||||
@@ -142,15 +142,16 @@ feature 'Comments' do
|
||||
visit debate_path(debate)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to_not have_link "Undo flag as inappropiate"
|
||||
click_on 'Flag as inappropiate'
|
||||
expect(page).to have_link "Undo flag as inappropiate"
|
||||
page.find("#flag-expand-comment-#{comment.id}").click
|
||||
page.find("#flag-comment-#{comment.id}").click
|
||||
|
||||
expect(page).to have_css("#unflag-expand-comment-#{comment.id}")
|
||||
end
|
||||
|
||||
expect(InappropiateFlag.flagged?(user, comment)).to be
|
||||
end
|
||||
|
||||
scenario "Undoing flagging as inappropiate", :js do
|
||||
scenario "Undoing flagging as inappropriate", :js do
|
||||
user = create(:user)
|
||||
debate = create(:debate)
|
||||
comment = create(:comment, commentable: debate)
|
||||
@@ -160,9 +161,10 @@ feature 'Comments' do
|
||||
visit debate_path(debate)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to_not have_link("Flag as inappropiate", exact: true)
|
||||
click_on 'Undo flag as inappropiate'
|
||||
expect(page).to have_link("Flag as inappropiate", exact: true)
|
||||
page.find("#unflag-expand-comment-#{comment.id}").click
|
||||
page.find("#unflag-comment-#{comment.id}").click
|
||||
|
||||
expect(page).to have_css("#flag-expand-comment-#{comment.id}")
|
||||
end
|
||||
|
||||
expect(InappropiateFlag.flagged?(user, comment)).to_not be
|
||||
@@ -286,4 +288,4 @@ feature 'Comments' do
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -323,9 +323,10 @@ feature 'Debates' do
|
||||
visit debate_path(debate)
|
||||
|
||||
within "#debate_#{debate.id}" do
|
||||
expect(page).to_not have_link "Undo flag as inappropiate"
|
||||
click_on 'Flag as inappropiate'
|
||||
expect(page).to have_link "Undo flag as inappropiate"
|
||||
page.find("#flag-expand-debate-#{debate.id}").click
|
||||
page.find("#flag-debate-#{debate.id}").click
|
||||
|
||||
expect(page).to have_css("#unflag-expand-debate-#{debate.id}")
|
||||
end
|
||||
|
||||
expect(InappropiateFlag.flagged?(user, debate)).to be
|
||||
@@ -340,9 +341,10 @@ feature 'Debates' do
|
||||
visit debate_path(debate)
|
||||
|
||||
within "#debate_#{debate.id}" do
|
||||
expect(page).to_not have_link("Flag as inappropiate", exact: true)
|
||||
click_on 'Undo flag as inappropiate'
|
||||
expect(page).to have_link("Flag as inappropiate", exact: true)
|
||||
page.find("#unflag-expand-debate-#{debate.id}").click
|
||||
page.find("#unflag-debate-#{debate.id}").click
|
||||
|
||||
expect(page).to have_css("#flag-expand-debate-#{debate.id}")
|
||||
end
|
||||
|
||||
expect(InappropiateFlag.flagged?(user, debate)).to_not be
|
||||
|
||||
@@ -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('Reviewed')
|
||||
expect(page).to have_link('Archived')
|
||||
|
||||
visit moderation_comments_path(filter: 'all')
|
||||
expect(page).to_not have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to have_link('Reviewed')
|
||||
expect(page).to have_link('Archived')
|
||||
|
||||
visit moderation_comments_path(filter: 'pending_review')
|
||||
visit moderation_comments_path(filter: 'pending')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('Reviewed')
|
||||
expect(page).to have_link('Archived')
|
||||
|
||||
visit moderation_comments_path(filter: 'reviewed')
|
||||
visit moderation_comments_path(filter: 'archived')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to_not have_link('Reviewed')
|
||||
expect(page).to_not have_link('Archived')
|
||||
end
|
||||
|
||||
scenario "Filtering comments" do
|
||||
create(:comment, :flagged_as_inappropiate, body: "Pending comment")
|
||||
create(:comment, :flagged_as_inappropiate, :hidden, body: "Hidden comment")
|
||||
create(:comment, :flagged_as_inappropiate, :reviewed, body: "Reviewed comment")
|
||||
create(:comment, :flagged_as_inappropiate, :archived, body: "Archived 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('Reviewed comment')
|
||||
expect(page).to have_content('Archived comment')
|
||||
|
||||
visit moderation_comments_path(filter: 'pending_review')
|
||||
visit moderation_comments_path(filter: 'pending')
|
||||
expect(page).to have_content('Pending comment')
|
||||
expect(page).to_not have_content('Hidden comment')
|
||||
expect(page).to_not have_content('Reviewed comment')
|
||||
expect(page).to_not have_content('Archived comment')
|
||||
|
||||
visit moderation_comments_path(filter: 'reviewed')
|
||||
visit moderation_comments_path(filter: 'archived')
|
||||
expect(page).to_not have_content('Pending comment')
|
||||
expect(page).to_not have_content('Hidden comment')
|
||||
expect(page).to have_content('Reviewed comment')
|
||||
expect(page).to have_content('Archived 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_as_inappropiate) }
|
||||
|
||||
visit moderation_comments_path(filter: 'pending_review', page: 2)
|
||||
visit moderation_comments_path(filter: 'pending', page: 2)
|
||||
|
||||
click_link('Mark as reviewed', match: :first)
|
||||
click_link('Archive', 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_review')
|
||||
expect(query_params[:filter]).to eq('pending')
|
||||
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('Mark as reviewed')
|
||||
expect(page).to have_link('Archive')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -187,18 +187,18 @@ feature 'Moderate Comments' do
|
||||
expect(@comment.reload).to be_hidden
|
||||
end
|
||||
|
||||
scenario 'Marking the comment as reviewed' do
|
||||
scenario 'Marking the comment as archived' do
|
||||
within("#comment_#{@comment.id}") do
|
||||
click_link('Mark as reviewed')
|
||||
click_link('Archive')
|
||||
end
|
||||
|
||||
expect(current_path).to eq(moderation_comments_path)
|
||||
|
||||
within("#comment_#{@comment.id}") do
|
||||
expect(page).to have_content('Reviewed')
|
||||
expect(page).to have_content('Archived')
|
||||
end
|
||||
|
||||
expect(@comment.reload).to be_reviewed
|
||||
expect(@comment.reload).to be_archived
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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('Reviewed')
|
||||
expect(page).to have_link('Archived')
|
||||
|
||||
visit moderation_debates_path(filter: 'all')
|
||||
expect(page).to_not have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to have_link('Reviewed')
|
||||
expect(page).to have_link('Archived')
|
||||
|
||||
visit moderation_debates_path(filter: 'pending_review')
|
||||
visit moderation_debates_path(filter: 'pending')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('Reviewed')
|
||||
expect(page).to have_link('Archived')
|
||||
|
||||
visit moderation_debates_path(filter: 'reviewed')
|
||||
visit moderation_debates_path(filter: 'archived')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to_not have_link('Reviewed')
|
||||
expect(page).to_not have_link('Archived')
|
||||
end
|
||||
|
||||
scenario "Filtering debates" do
|
||||
create(:debate, :flagged_as_inappropiate, title: "Pending debate")
|
||||
create(:debate, :flagged_as_inappropiate, :hidden, title: "Hidden debate")
|
||||
create(:debate, :flagged_as_inappropiate, :reviewed, title: "Reviewed debate")
|
||||
create(:debate, :flagged_as_inappropiate, :archived, title: "Archived 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('Reviewed debate')
|
||||
expect(page).to have_content('Archived debate')
|
||||
|
||||
visit moderation_debates_path(filter: 'pending_review')
|
||||
visit moderation_debates_path(filter: 'pending')
|
||||
expect(page).to have_content('Pending debate')
|
||||
expect(page).to_not have_content('Hidden debate')
|
||||
expect(page).to_not have_content('Reviewed debate')
|
||||
expect(page).to_not have_content('Archived debate')
|
||||
|
||||
visit moderation_debates_path(filter: 'reviewed')
|
||||
visit moderation_debates_path(filter: 'archived')
|
||||
expect(page).to_not have_content('Pending debate')
|
||||
expect(page).to_not have_content('Hidden debate')
|
||||
expect(page).to have_content('Reviewed debate')
|
||||
expect(page).to have_content('Archived 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_as_inappropiate) }
|
||||
|
||||
visit moderation_debates_path(filter: 'pending_review', page: 2)
|
||||
visit moderation_debates_path(filter: 'pending', page: 2)
|
||||
|
||||
click_link('Mark as reviewed', match: :first)
|
||||
click_link('Archive', 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_review')
|
||||
expect(query_params[:filter]).to eq('pending')
|
||||
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('Mark as reviewed')
|
||||
expect(page).to have_link('Archive')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -129,18 +129,18 @@ feature 'Moderate debates' do
|
||||
expect(@debate.reload).to be_hidden
|
||||
end
|
||||
|
||||
scenario 'Marking the debate as reviewed' do
|
||||
scenario 'Marking the debate as archived' do
|
||||
within("#debate_#{@debate.id}") do
|
||||
click_link('Mark as reviewed')
|
||||
click_link('Archive')
|
||||
end
|
||||
|
||||
expect(current_path).to eq(moderation_debates_path)
|
||||
|
||||
within("#debate_#{@debate.id}") do
|
||||
expect(page).to have_content('Reviewed')
|
||||
expect(page).to have_content('Archived')
|
||||
end
|
||||
|
||||
expect(@debate.reload).to be_reviewed
|
||||
expect(@debate.reload).to be_archived
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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(:reviewed_comment) { create(:comment, :reviewed) }
|
||||
let(:reviewed_debate) { create(:debate, :reviewed) }
|
||||
let(:archived_comment) { create(:comment, :archived) }
|
||||
let(:archived_debate) { create(:debate, :archived) }
|
||||
|
||||
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(:mark_as_reviewed, comment) }
|
||||
it { should_not be_able_to(:mark_as_reviewed, hidden_comment) }
|
||||
it { should_not be_able_to(:mark_as_reviewed, reviewed_comment) }
|
||||
it { should_not be_able_to(:mark_as_reviewed, own_comment) }
|
||||
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(:mark_as_reviewed, debate) }
|
||||
it { should_not be_able_to(:mark_as_reviewed, hidden_debate) }
|
||||
it { should_not be_able_to(:mark_as_reviewed, reviewed_debate) }
|
||||
it { should_not be_able_to(:mark_as_reviewed, own_debate) }
|
||||
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_not be_able_to(:hide, user) }
|
||||
it { should be_able_to(:hide, other_user) }
|
||||
|
||||
Reference in New Issue
Block a user