Download & Extend

Reintroduce Views integration for contact.module

Project:Drupal core
Version:8.x-dev
Component:contact.module
Category:task
Priority:normal
Assigned:Unassigned
Status:needs review
Issue tags:VDC

Issue Summary

Part of meta #1853522: [META] (Re)introduce Views data integration for core modules. From the 8.x-3.x branch of Views.

AttachmentSizeStatusTest resultOperations
contact.patch2.81 KBIdlePASSED: [[SimpleTest]]: [MySQL] 48,894 pass(es).View details | Re-test

Comments

#1

Status:needs review» needs work

The last submitted patch, contact.patch, failed testing.

#2

Status:needs work» needs review

Some small cleanup.

AttachmentSizeStatusTest resultOperations
interdiff.txt1.75 KBIgnoredNoneNone
drupal-1853526-2.patch2.98 KBIdlePASSED: [[SimpleTest]]: [MySQL] 48,920 pass(es).View details | Re-test

#3

Actually wrote a test and realized how much was actually broken, like it never actually appeared on some use-cases.

AttachmentSizeStatusTest resultOperations
drupal-1853526-3.patch10.69 KBIdlePASSED: [[SimpleTest]]: [MySQL] 49,884 pass(es).View details | Re-test

#4

Status:needs review» reviewed & tested by the community

Tested this, works, code looks great, tests looks complete, comments look great.

Awesome!

#5

Left the UUID in the test yml file.

AttachmentSizeStatusTest resultOperations
interdiff.txt560 bytesIgnoredNoneNone
drupal-1853526-5.patch10.65 KBIdlePASSED: [[SimpleTest]]: [MySQL] 50,083 pass(es).View details | Re-test

#6

Status:reviewed & tested by the community» needs review

Is this really the only way to check the access? It's an extra query for every row when you enable this. I realise contextual module does it as well but it's a horrible pattern. The only thing I can think of though is doing what contact module does in its own callback.

+ $path = "user/$uid/contact";
+ $menu_item = menu_get_item($path);
+ if (!$menu_item['access']) {
+ return;
+ }

#8

We could rewrite _contact_personal_tab_access to accept multiple accounts, though I'm really wondering whether it's worth to do so,
as N function calls on N rows is nothing compared to all other things going on like entity API.

Would you be okay with directly calling the access method of contact? We didn't used that in D7 because people might want to replace the access logic and so could do this in one place via hook_menu_alter.

#9

I think directly calling the access method is probably OK. It's not that much different to calling node_access() really.

If you think that's too fragile, just adding a comment explaining why we have to use menu_get_item() there might be enough as well.

#10

To be honest, this is such an edge case that to require overriding the views handler is fine for me.

AttachmentSizeStatusTest resultOperations
drupal-1853526-10.patch10.63 KBIdleFAILED: [[SimpleTest]]: [MySQL] 49,075 pass(es), 502 fail(s), and 253 exception(s).View details | Re-test
interdiff.txt661 bytesIgnoredNoneNone

#11

Status:needs review» needs work

The last submitted patch, drupal-1853526-10.patch, failed testing.

#12

Status:needs work» needs review

#10: drupal-1853526-10.patch queued for re-testing.

#13

Status:needs review» needs work

The last submitted patch, drupal-1853526-10.patch, failed testing.

#14

Status:needs work» needs review

#10: drupal-1853526-10.patch queued for re-testing.

#15

Status:needs review» needs work

The last submitted patch, drupal-1853526-10.patch, failed testing.

#16

Status:needs work» needs review

#10: drupal-1853526-10.patch queued for re-testing.

#17

#10: drupal-1853526-10.patch queued for re-testing.

#18

#10: drupal-1853526-10.patch queued for re-testing.

#19

Status:needs review» needs work

The last submitted patch, drupal-1853526-10.patch, failed testing.

#20

Status:needs work» needs review

#10: drupal-1853526-10.patch queued for re-testing.

#21

Status:needs review» needs work

The last submitted patch, drupal-1853526-10.patch, failed testing.

#22

Status:needs work» needs review

Moved some tiny bits around and fixed things here and there. The interdiff thought would be hard to read as files have been moved.

AttachmentSizeStatusTest resultOperations
interdiff.txt7.78 KBIgnoredNoneNone
drupal-1853526-22.patch10.64 KBIdleFAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.View details | Re-test

#23

#22: drupal-1853526-22.patch queued for re-testing.

#24

Status:needs review» needs work

The last submitted patch, drupal-1853526-22.patch, failed testing.

#25

Status:needs work» needs review

This should fix it.

AttachmentSizeStatusTest resultOperations
drupal-1853526-25.patch10.66 KBIdleFAILED: [[SimpleTest]]: [MySQL] 53,254 pass(es), 6 fail(s), and 0 exception(s).View details | Re-test
interdiff.txt1.35 KBIgnoredNoneNone

#26

Status:needs review» needs work

The last submitted patch, drupal-1853526-25.patch, failed testing.

#27

Status:needs work» needs review

Now!

AttachmentSizeStatusTest resultOperations
drupal-1853526-27.patch10.67 KBIdlePASSED: [[SimpleTest]]: [MySQL] 53,999 pass(es).View details | Re-test
interdiff.txt1.82 KBIgnoredNoneNone

#28

Status:needs review» reviewed & tested by the community

+++ b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactLinkTest.php
@@ -0,0 +1,116 @@
+      $result = $this->xpath('//div[contains(@class, "views-field-contact")]//a[contains(@href, :uri)]', array(':uri' => $contact_uri));
+      $this->assertTrue(count($result));

AssertLink is not sufficient here?

#29

Yeah we could use it here, though it feels always safer for me, to check the full output here, as this adds additional kind of test coverage.

Feel free to convince me of the opposite, then I'm happy to rerole.

#30

I think it's fine as-is.

#31

#27: drupal-1853526-27.patch queued for re-testing.

#32

#27: drupal-1853526-27.patch queued for re-testing.

#33

Status:reviewed & tested by the community» needs work

+++ b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml
@@ -0,0 +1,119 @@
+human_name: test_contact_link

That should be label, I think.

#34

Status:needs work» needs review

Good catch, we def need to change this since the label patch landed :)

AttachmentSizeStatusTest resultOperations
1853526-34.patch10.67 KBIdlePASSED: [[SimpleTest]]: [MySQL] 54,225 pass(es).View details | Re-test
interdiff-1853526-34.txt658 bytesIgnoredNoneNone
nobody click here