dmails: set sender name and ip address explicitly.

Set the sender name and IP addresses explicitly in the controller rather
than implicitly in the model.

Fixes cases where automated dmails from DanbooruBot had their IP
addresses set to the person who triggered the dmail, even though they
didn't actually send the dmail themselves.
This commit is contained in:
evazion
2020-02-23 01:41:54 -06:00
parent 7855e36d17
commit 3a018ee9f7
4 changed files with 17 additions and 35 deletions

View File

@@ -33,7 +33,7 @@ class DmailsController < ApplicationController
end
def create
@dmail = Dmail.create_split(dmail_params(:create))
@dmail = Dmail.create_split(from: CurrentUser.user, creator_ip_addr: CurrentUser.ip_addr, **dmail_params(:create))
respond_with(@dmail)
end