forked from excid3/simple_discussion
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: moderator can review and delete reported posts
- Loading branch information
Showing
10 changed files
with
113 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,5 @@ class SpamReport < ApplicationRecord | |
irrelevant_content: 2, | ||
misleading_content: 3, | ||
others: 4 | ||
} | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/views/simple_discussion/forum_posts/_spam_report.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<%= content_tag :tr, id: dom_id(spam_report), class: "forum-post" do %> | ||
<td> | ||
<div class="border rounded-lg"> | ||
<div class="forum-post-header"> | ||
<div class="user-details d-flex flex-row"> | ||
<div class="user-avatar mr-2" ><img src="<%= gravatar_url_for(spam_report.forum_post.user.email, size: 30) %>" alt="avatar of user" ></div> | ||
<div class="details d-flex flex-column justify-content-between"> | ||
<p class="title"> | ||
<%= spam_report.forum_post.user.name %> <%= forum_user_badge(spam_report.forum_post.user) %> | ||
</p> | ||
<p class="subtitle"><%= t('on') %> <%= spam_report.forum_post.created_at.strftime("%b %d, %Y") %></p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="card-body p-3"> | ||
<%= formatted_content spam_report.forum_post.body %> | ||
</div> | ||
</div> | ||
</td> | ||
|
||
<td> | ||
<div class="d-flex flex-row justify-content-between align-items-center p-2"> | ||
<% if spam_report.reason == "others" %> | ||
<%= spam_report.details %> | ||
<% else %> | ||
<%= spam_report.reason.humanize %> | ||
<% end %> | ||
</div> | ||
</td> | ||
|
||
<td> | ||
<div class="d-flex flex-row justify-content-between align-items-center p-2"> | ||
<%= link_to spam_report.user.name, user_path(spam_report.user), class: "btn btn-outline-primary", title: t('user_profile') %> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="d-flex flex-row justify-content-between align-items-center p-2"> | ||
<%= link_to simple_discussion.forum_thread_path(spam_report.forum_post.forum_thread, anchor: "forum_post_#{spam_report.forum_post.id}"), | ||
class: "btn btn-dark", | ||
data: { toggle: "tooltip", placement: "left" } do %> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-arrow-out-up-right"><path d="M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"/><path d="m21 3-9 9"/><path d="M15 3h6v6"/></svg> | ||
<% end %> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="d-flex flex-row justify-content-between align-items-center p-2"> | ||
<%= link_to simple_discussion.forum_thread_forum_post_path(spam_report.forum_post.forum_thread, spam_report.forum_post, from: "moderators_page"), | ||
method: :delete, | ||
data: { toggle: "tooltip", placement: "left", confirm: "Are you sure you want to delete this post?" }, | ||
title: t('delete_this_post'), | ||
class: "btn btn-danger" do %> | ||
<i class="fas fa-trash-alt"></i> | ||
<% end %> | ||
</div> | ||
</td> | ||
<% end %> |
16 changes: 16 additions & 0 deletions
16
app/views/simple_discussion/forum_threads/spam_reports.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th class="col-md-6" scope="col">Forum Post</th> | ||
<th scope="col">Reason</th> | ||
<th scope="col">Reported by</th> | ||
<th scope="col">View in Thread</th> | ||
<th scope="col">Delete</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render partial: "simple_discussion/forum_posts/spam_report", collection: @spam_reports%> | ||
</tbody> | ||
</table> | ||
|
||
<%= will_paginate @spam_reports, url_builder: simple_discussion, renderer: SimpleDiscussion::BootstrapLinkRenderer %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters