dmcas: dmail copy of complaint to owner user.
This commit is contained in:
@@ -3,6 +3,22 @@
|
||||
class DmcasController < ApplicationController
|
||||
def create
|
||||
@dmca = params[:dmca].slice(:name, :email, :address, :infringing_urls, :original_urls, :proof, :perjury_agree, :good_faith_agree, :signature)
|
||||
|
||||
Dmail.create_automated(to: User.owner, title: "DMCA Complaint from #{@dmca[:name]}", body: <<~EOS)
|
||||
Name: #{@dmca[:name]}
|
||||
Email: #{@dmca[:email]}
|
||||
Address: #{@dmca[:address]}
|
||||
|
||||
Infringing URLs:
|
||||
#{@dmca[:infringing_urls].to_s.split.map { |url| "* #{url}" }.join("\n")}
|
||||
|
||||
Original URLs:
|
||||
#{@dmca[:original_urls].to_s.split.map { |url| "* #{url}" }.join("\n")}
|
||||
|
||||
Proof: #{@dmca[:proof]}
|
||||
Signature: #{@dmca[:signature]}
|
||||
EOS
|
||||
|
||||
UserMailer.with_request(request, dmca: @dmca).dmca_complaint(to: Danbooru.config.dmca_email).deliver_now
|
||||
UserMailer.with_request(request, dmca: @dmca).dmca_complaint(to: @dmca[:email]).deliver_now
|
||||
end
|
||||
|
||||
@@ -20,9 +20,14 @@ class DmcasControllerTest < ActionDispatch::IntegrationTest
|
||||
signature: "John Doe",
|
||||
}
|
||||
|
||||
create(:owner_user)
|
||||
post dmca_path, params: { dmca: dmca }
|
||||
|
||||
assert_response :success
|
||||
assert_emails 2
|
||||
assert_equal("DMCA Complaint from John Doe", Dmail.last.title)
|
||||
assert_match(/test@example.com/, Dmail.last.body)
|
||||
assert_match(%r{https://example\.com/1\.html}, Dmail.last.body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user