Closed (fixed)
Project:
Contact Emails
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Apr 2019 at 16:31 UTC
Updated:
23 Feb 2024 at 12:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
eglawHere's a patch that adds this feature
Comment #3
scott_euser commentedI wonder if this is something that can be achieved already with a hidden field in the form housing a token value?
That said not against this but needs tests (and of course existing tests to pass).
Comment #4
scott_euser commentedComment #5
eglaw@scott_euser ... agree, probably it can, but no way you'll do it without any preprocessing the form on the example Node (or other) page and hiding the field or altering it into a hidden type ...
I'll check into the failing test later
Comment #6
eglaw@scott_euser by that you mean that it should pass a deprecated type of SimpleTest class? Well it does a part from 1 test only:
Drupal\contact_emails\Tests\Update\ContactEmailsTableToEntityUpdateTest
which will NEVER pass as far as it tries to make a query on a NOT existing table (contact_message_email_settings), probably a reminiscense of a drupal7 version of this module.
Being said that ... what test would you like this patch includes ? The same simpletest ones as for ContactEmailsRecipientTest or ContactEmailsRecipientReferenceTest?
Keep in mind that a SimpleTest tests are deprecated and will be droped in Drupal 9.x.
Comment #7
eglawReworked the patch a little:
Added the transformation of the contact_message into a personal one, if the recipient_type on email config is context
Comment #8
scott_euser commentedThanks for the work on this! Better to go straight for a non-deprecated test. Will create a separate issue for Drupal 9 support.
Comment #9
eglawFormatted a new patch for the contact_emails-8.x-1.18 version
Enjoy :)
Comment #12
astonvictor commentedCreated a new MR.
My steps for testing:
1. Created a new node type. e.g. Mail.
2. Created a new contact form on
/admin/structure/contact/addpage:- label - context test
- recipients - test@test.com
- message - my message
3. Created a new contact email on
/admin/structure/contact/emails/addpage:- contact form - context test
- subject - context test
- recipient type - The context entity author's email
4. Installed Contact Block module.
5. Added the block with the contact form with visibility - content type = Mail
6. Created a new mail node as user1.
7. Submitted the contact form on the node page as user2.
result: a new mail was sent to the user1.
The pipeline works fine and there are no failures in tests.
I'm not sure if we should add a new test because it requires adding an additional contrib module as a dependency for only one specific case.
Note that if the route contains a few parameters/entities of
EntityOwnerInterfaceinterface then the mail will be sent to all owners.Comment #14
astonvictor commentedMerged the MR.