Problem/Motivation

On #2393339: [META] Make sure Views base fields are using Field API for formatting, and do not lose functionality, we are updating all base entity fields in entity views data so that they are using Field API for formatting rather than using generic Views handlers.

This issue is about several fields that are currently using a custom 'user' Views handler:
- node_field_data.uid
- comment_field_data.uid
- users_field_data.uid

Also, two fields that are using other custom user Views handlers:
- users_field_data.name ('user_name' plugin)
- users_field_data.mail ('user_mail' plugin)

Proposed resolution

Change these fields to use the Field API formatter 'field' instead of the custom formatter. Should also be able to remove the custom formatters from the code base completely.

Remaining tasks

Commit it

User interface changes

None.

API changes

Not really.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

andypost’s picture

andypost’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
3.87 KB
6.93 KB

Initial code to remove mail plugin, the only problem here that link to user functionality setting could be achieved by adding a UID field to view and overriding the field with link.
Suppose there should be an option in views like provide a link to entity for each entity fleld.

Also I found that there's 2 UID fields that could be added - probably separate issue

andypost’s picture

Now clean-up name usage

Status: Needs review » Needs work

The last submitted patch, 4: 2456691-user-views-fields-4.patch, failed testing.

andypost’s picture

FileSize
8.25 KB

missed interdiff

rteijeiro’s picture

Status: Needs work » Needs review
FileSize
11.27 KB
600 bytes

Fixed what testbot is complaining about. Not sure if it's right @andypost, let me know otherwise.

Status: Needs review » Needs work

The last submitted patch, 7: 2456691-user-views-fields-7.patch, failed testing.

dawehner’s picture

Title: User base fields need to use Field-Entity-aware formatters in Views » User email field need to use Field-Entity-aware formatters in Views

I'm sorry but this sounds like a duplicate of #2454145: Replace user_name handler with Field API formatter, but without adding a new formatter ...

...
Let's rescope the issue to just be on emails

andypost’s picture

@dawehner so #3 does that, do we need to unpublish other patches?

dawehner’s picture

@dawehner so #3 does that, do we need to unpublish other patches?

+++ /dev/null
@@ -1,57 +0,0 @@
-      '#type' => 'radios',
-      '#options' => array(
-        0 => $this->t('No link'),
-        'user' => $this->t('To the user'),
-        'mailto' => $this->t("With a mailto:"),
-      ),
...
-    if ($this->options['link_to_user'] == 'mailto') {
-      $this->options['alter']['make_link'] = TRUE;
-      $this->options['alter']['path'] = "mailto:" . $data;

Where did that option went to?

andypost’s picture

Currently only string and mailto formatters are supported, to make the field as link:
1) use views aboility to override
2) or inherit the plugin from field

dawehner’s picture

Ah, so there is a specific mailto formatter. +1 for #3

andypost’s picture

Status: Needs work » Needs review

So #3 still applies cleanly

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

#3 looks fine for me!

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

So we're fixing a bug here, bad enough to be critical and block D8's release, but we're not adding any test coverage for it. Feels a bit strange.

Talked about this in IRC w/ xjm and dawehner. While in most cases, #2385443: Test that base entity fields on views respect field level access is sufficient to check for this condition (after all, it's highly unlikely that once we've turned something into a field we would un-field it again), this particular field contains sensitive user information so would likely result in a SA if it were to break again.

So let's get a small test here to ensure this stays working as expected.

dawehner’s picture

FileSize
2.67 KB

Started to write some generic test which can be reused for this issue and potentially all others.

dawehner’s picture

Decided to split of the access checking into its own issue, in order to have a more fundamental / wide spread effort to check access.

See #2462589: Provide test coverage for access checking of all views fields.

jhodgdon’s picture

RE #10, rescoping: did you file another issue to take care of the rest of what is in the summary, and update the meta-issue parent? The summary still says it covers a bunch of fields. We need to cover them *somewhere* and the other issue mentioned in #10 doesn't cover them I think?

dawehner’s picture

RE #10, rescoping: did you file another issue to take care of the rest of what is in the summary, and update the meta-issue parent? The summary still says it covers a bunch of fields. We need to cover them *somewhere* and the other issue mentioned in #10 doesn't cover them I think?

We could add all the fields in here, for all the entity types and comment those out, which fail, as they aren't yet converted.

For example the mail field, which is part of this issue, fails currently on the provided test.

effulgentsia’s picture

Issue tags: +Critical Office Hours

Per #2393339-57: [META] Make sure Views base fields are using Field API for formatting, and do not lose functionality, tagging for critical office hours, but if there's a reason to not have this particular child issue in that list, please untag it.

dawehner’s picture

Status: Needs work » Reviewed & tested by the community

So I'm curious whether we can get the issue in and add the test coverage as part of the other patch (#2462589: Provide test coverage for access checking of all views fields.)

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

So apparently the patch in #3 is rtbc - can the latest patch be rtbc please? Also I think it is better to introduce a generic test. Access tests are hard to get right and doing it well once makes sense to me.

dawehner’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
3.87 KB
YesCT’s picture

so, it seems like the tests from the other issue will cover this.
to demonstrate, here are some combined patches.
but 25 without the tests is the rtbc'able committable thing.

The last submitted patch, 26: 2462589.tests-only.with_.mail_.patch, failed testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Thank you for posting a test only patch but well.

Set the patch of comment NR3. finally back to RTBC again.

YesCT’s picture

I think this shows what @alexpott asked for, that the generic tests will cover this.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

We've got the critical followup to add tests so committed the test free patch. Committed 26984ad and pushed to 8.0.x. Thanks!

  • alexpott committed 26984ad on 8.0.x
    Issue #2456691 by YesCT, andypost, dawehner, rteijeiro: User email field...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.