When 2ac9fd9dff5a2a9210e2b1b765e1a324bbb4f421 was done, this
affected the small post that is created when forwarding an email
into the group inbox. Instead of using the name and the email of
the user who forwarded the email, it used the original from email
and name to create the small post. So instead of something like
“Discourse Team forwarded the above email” we ended up with
“John Smith forwarded the above email” which is incorrect.
This fixes the issue by creating a staged user for the forwarding
email address (if such a user does not yet exist) and uses that
for the “forwarded” small post instead.
I am not sure if @forwarded_by_address and @forwarded_by_name should be instance variables as they are quite specific to 2 methods.
You already have instance variable @mail which makes sens because whole class is using it. What would you say for some helper method like
@fowarded_by_address_and_forwarded_by_name ||= extract_from_fields_from_header(@mail, :from)
@forwarded_by_address ||= fowarded_by_address_and_forwarded_by_name&.first
@forwarded_by_name ||= fowarded_by_address_and_forwarded_by_name&.last
# This instance variables are just to memoize, not to be used