mod reports: include reported user and message in forum post.

Also fix it so that reports against dmails include the key in the dmail
link so that mods can view the reported dmail.
This commit is contained in:
evazion
2020-02-03 04:42:09 -06:00
parent bb2022abed
commit 24cb920608
7 changed files with 36 additions and 12 deletions

View File

@@ -1,6 +1,9 @@
FactoryBot.define do
factory(:dmail) do
to :factory => :user
owner factory: :user
from factory: :user
to factory: :user
creator_ip_addr { FFaker::Internet.ip_v4_address }
title {FFaker::Lorem.words.join(" ")}
body {FFaker::Lorem.sentences.join(" ")}
end

View File

@@ -1,5 +1,6 @@
FactoryBot.define do
factory(:moderation_report) do
creator
reason {"xxx"}
end
end

View File

@@ -0,0 +1,15 @@
require 'test_helper'
class ModerationReportTest < ActiveSupport::TestCase
context "Moderation reports: " do
context "creating a moderation report" do
should "create a forum post" do
@dmail = create(:dmail)
@modreport = create(:moderation_report, model: @dmail, reason: "blah")
assert_equal(2, ForumPost.count)
assert_match(/blah/, ForumPost.last.body)
end
end
end
end