When #2289063: Change contact message entity to behave more like a normal entity was done, it missed adding the langcode. This has caused an issue in the contrib Contact Storage module. On Berdir's suggestion, I added the langcode to the Message class as per this change record. This fixes the issue in Contact Storage.

The ContactForm entity doesn't have a langcode, either, but I am not clear if it is supposed to so did not add one. I can add one if that should have one, too.

Comments

michelle’s picture

StatusFileSize
new556 bytes

Here is the patch.

michelle’s picture

Status: Active » Needs review

Totally forgot to set this needs review. Doh!

damienmckenna’s picture

Would tests be needed to clarify the problem?

andypost’s picture

Issue tags: +D8MI, +language-content, +sprint

On one hand "messsage" is a content entity but without storage
Otoh \Drupal\contact\Controller\ContactController::contactSitePage() should properly pass language to message form cunstructor

and after changing \Drupal\contact\MailHandler::sendMailMessages we can pass language to message builder
$recipient_langcode = $this->languageManager->getDefaultLanguage()->getId(); currently works

+++ b/core/modules/contact/src/Entity/Message.php
@@ -29,7 +29,8 @@
+ *     "langcode" = "langcode",

makes sense

andypost’s picture

Issue tags: +Needs tests
StatusFileSize
new1.87 KB
new2.41 KB

Status: Needs review » Needs work

The last submitted patch, 5: drupal-contact_langcode-2484959-5.patch, failed testing.

berdir’s picture

#2533964: Langcode widget visibility settings from language.module are not applied consistently also adds the langcode key, but doesn't contain the other fixes. Will conflict with that.

andypost’s picture

Failed tests are shows that usage of message language somehow broken

Fail Other ConfigTranslation 346 Drupal\config_translation\Tests\Con
Value 'Thank you for your mail - fr' is equal to value 'Thank
you for your mail - en'.
Fail Other ConfigTranslation 346 Drupal\config_translation\Tests\Con
Value 'Thank you for your mail - ta' is equal to value 'Thank
you for your mail - en'.

gábor hojtsy’s picture

gábor hojtsy’s picture

Status: Needs work » Postponed
Issue tags: -sprint
michelle’s picture

Since that other issue contains what was my original patch here, should I reroll this one so it just has Andy's code and take out mine? Which is kind of a bummer since I was hoping this would be my first core patch but I guess that's how it goes. LOL!

gábor hojtsy’s picture

@Michelle: you will definitely still be mentioned in the commit credits once/if this lands. So while the actual lines you wrote may not land, you will get the credit. I would say you should wait until #2533964: Langcode widget visibility settings from language.module are not applied consistently lands, which is why I marked this postponed, so that there is no duplication of work.

michelle’s picture

I meant it would be the first time a patch I wrote got into core so doesn't really count if the patch goes in without my code. LOL! It's ok. I'll just have to try again. :)

Ok, I'll wait on this, then, thanks.

andypost’s picture

@Michelle my patch was just a test to make sure that contact is broken with passed language, actually I came here by reviewing current contact module issues after #2223967: Do not decode a contact message twice
I think the issue shows regression that mostly caused by that we used contact in 8.x dev as a playground for multilingual abilities of i18n

andypost’s picture

Status: Postponed » Needs work

As #2533964: Langcode widget visibility settings from language.module are not applied consistently commited
this issue better re-focus on passing language to mail handler properly (#5) and add tests

andypost’s picture

Title: langcode missing from contact message » Properly pass langcode from contact message
Status: Needs work » Needs review
StatusFileSize
new1.87 KB

re-scope and re-roll, cos langcode is here

Status: Needs review » Needs work

The last submitted patch, 16: drupal-contact_langcode-2484959-16.patch, failed testing.

andypost’s picture

Version: 8.0.x-dev » 8.1.x-dev

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

There's a contrib that depends on it #2796335: Fix hard coded language on URL alias

oleksiy’s picture

Status: Needs work » Needs review
StatusFileSize
new4.53 KB

Added tests, but not sure if implementation is correct... Please, check

Status: Needs review » Needs work

The last submitted patch, 22: drupal-contact_langcode-2484959-22.patch, failed testing.

The last submitted patch, 22: drupal-contact_langcode-2484959-22.patch, failed testing.

oleksiy’s picture

StatusFileSize
new4.46 KB

Reroll

andypost’s picture

Status: Needs work » Needs review
andypost’s picture

Issue tags: -Needs tests +sprint

Tests already added

Status: Needs review » Needs work

The last submitted patch, 25: drupal-contact_langcode-2484959-25.patch, failed testing.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

larowlan’s picture

ravi.shankar’s picture

StatusFileSize
new4.53 KB
new3.77 KB

Added reroll of patch #25 on Drupal 9.4.x.

michelle’s picture

Status: Needs work » Needs review

Setting to "needs review" to see if the reroll passes tests, which is why it was at "needs work" before.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

shubham chandra’s picture

Issue tags: -Needs reroll
StatusFileSize
new4.63 KB

Added reroll of patch #25 on Drupal 9.5.x.

ameymudras’s picture

StatusFileSize
new4.54 KB
new1.45 KB
new4.54 KB
new1.45 KB

Fixing the issue Error: Call to undefined method Drupal\Tests\contact\Unit\MailHandlerTest::getMock() in the tests

The last submitted patch, 44: 2484959-44.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 44: 2484959-44.patch, failed testing. View results

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

amber himes matz’s picture

Tests showing this failure:

There was 1 failure:

1) Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testContactConfigEntityTranslation
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Thank you for your mail - en'
+'Thank you for your mail - fr'

Ankit.Gupta’s picture

StatusFileSize
new8.84 KB

Reroll the patch #43 with Drupal 10.1.x

ameymudras’s picture

Thanks @Ankit, I see a few coding standard issues in the patch #49

-class MailHandlerTest extends UnitTestCase {
+class MailHandlerTest extends UnitTestCase
+{
-  public function testInvalidRecipient() {
+  public function testInvalidRecipient()
+  {

Also could you please provide an interdiff which will make it easy to review your code.

Ankit.Gupta’s picture

StatusFileSize
new7.54 KB

Interdiff file attached .

ravi.shankar’s picture

Looks like there are some extra changes are there in patch #49, as there is around a 4kb difference in both patches.

kristen pol’s picture

Thanks for the interdiff. I have not reviewed for accuracy/readability. I was just scanning and noticed some minor formatting things:

  1. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -31,10 +31,40 @@
    ++class MailHandlerTest extends UnitTestCase
    ++{
    

    Curly bracket needs to move back up

  2. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -31,10 +31,40 @@
    ++{
    + ¶
    +   /**
    

    Extraneous space on blank line

  3. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -31,10 +31,40 @@
    +-  protected function setUp(): void {
    ++  protected function setUp(): void
    ++  {
    

    Curly bracket needs to move back up

  4. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -31,10 +31,40 @@
    +-  public function testInvalidRecipient() {
    ++  public function testInvalidRecipient()
    ++  {
    

    Curly bracket needs to move back up

  5. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -58,7 +88,47 @@
    ++  public function testSendMailMessages(MessageInterface $message, AccountInterface $sender, $results)
    ++  {
    

    Curly bracket needs to move back up

  6. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -58,7 +88,47 @@
    ++  public function getSendMailMessages()
    ++  {
    

    Curly bracket needs to move back up

  7. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -58,7 +88,47 @@
    +-  protected function getMockSender($anonymous = TRUE, $mail_address = 'anonymous@drupal.org') {
    ++  protected function getMockSender($anonymous = TRUE, $mail_address = 'anonymous@drupal.org')
    ++  {
    

    Curly bracket needs to move back up

  8. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -68,7 +138,17 @@
    +-  protected function getAnonymousMockMessage($recipients, $auto_reply, $copy_sender = FALSE) {
    ++  protected function getAnonymousMockMessage($recipients, $auto_reply, $copy_sender = FALSE)
    ++  {
    

    Curly bracket needs to move back up

  9. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    @@ -82,21 +162,43 @@
    +-  protected function getAuthenticatedMockMessage($copy_sender = FALSE) {
    ++  protected function getAuthenticatedMockMessage($copy_sender = FALSE)
    ++  {
    

    Curly bracket needs to move back up

  10. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    --  }
    +-  protected function getMockContactForm($recipients, $auto_reply) {
    ++  protected function getMockContactForm($recipients, $auto_reply)
    ++  {
    

    Curly bracket needs to move back up

  11. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    --  }
    +@@ -406,5 +443,4 @@ protected function getMockContactForm($recipients, $auto_reply) {
    + ¶
    +     return $contact_form;
    

    Extraneous space on blank line

  12. +++ 2484959-49.patch	2022-10-12 12:59:31.794953100 +0530
    --  }
    +   }
    +-
    + }
    

    Blank line shouldn't be removed

kristen pol’s picture

Ah... these are all in the CI failure except for the extraneous spaces:

https://www.drupal.org/pift-ci-job/2497667

ameymudras’s picture

Status: Needs work » Needs review
StatusFileSize
new6.02 KB
new4.81 KB

Fixed the coding standard issues and also tried to fix the other CI issues

Status: Needs review » Needs work

The last submitted patch, 55: 2484959-55.patch, failed testing. View results

shivam-kumar’s picture

StatusFileSize
new6.11 KB
new666 bytes

Fixed 2nd Fail of #55

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

The Contact Module was approved for removal in #3476879: [Policy] Move Contact module to contrib.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3520460: [meta] Tasks to deprecate the Contact module and the removal work in #3520466: [meta] Tasks to remove Contact module.

Contact will be moved to a contributed project after the Drupal 12.x branch is open.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

andypost’s picture

Project: Drupal core » Contact
Version: main » 1.x-dev
Component: contact.module » Code
Status: Postponed » Needs work