Problem/Motivation

Extracted from todo.txt :
simplenews: replace subscriber and issue overview with views

Proposed resolution

Remaining tasks

@todo complete problem description and solution.

User interface changes

API changes

CommentFileSizeAuthor
#48 simplenews-2410265-subscriber-view-48.patch50.18 KBAnushka-mp
#48 simplenews-2410265-subscriber-view-48-interdiff.txt5 KBAnushka-mp
#45 simplenews-2410265-subscriber-view-41-interdiff.txt1.61 KBAnushka-mp
#41 simplenews-2410265-subscriber-view-41.patch50.04 KBAnushka-mp
#40 simplenews-2410265-subscriber-view-40.patch50.03 KBAnushka-mp
#40 simplenews-2410265-subscriber-view-40-interdiff.txt2.52 KBAnushka-mp
#40 simplenews-2410265-subscriber-view-40.patch50.03 KBAnushka-mp
#39 simplenews-2410265-subscriber-view-39.patch48.14 KBAnushka-mp
#39 simplenews-2410265-subscriber-view-39-interdiff.txt4.32 KBAnushka-mp
#37 simplenews-2410265-subscriber-view-37.patch46.25 KBAnushka-mp
#36 simplenews-2410265-subscriber-view-36.patch46.24 KBAnushka-mp
#36 simplenews-2410265-subscriber-view-36-interdiff.txt10.11 KBAnushka-mp
#34 simplenews-2410265-subscriber-view-34.patch45.38 KBAnushka-mp
#30 simplenews-2410265-subscriber-view-30.patch45.5 KBAnushka-mp
#25 simplenews-2410265-subscriber-view-25.patch44.35 KBAnushka-mp
#25 simplenews-2410265-subscriber-view-25.patch44.35 KBAnushka-mp
#23 simplenews-2410265-subscriber-view-22.patch27.29 KBAnushka-mp
#23 simplenews-2410265-subscriber-view-22-interdiff.txt14.45 KBAnushka-mp
#21 simplenews-2410265-subscriber-view-21-interdiff.txt10.87 KBAnushka-mp
#21 simplenews-2410265-subscriber-view-21.patch24.58 KBAnushka-mp
#19 simplenews-2410265-subscriber-view-19-interdiff.txt2.4 KBAnushka-mp
#19 simplenews-2410265-subscriber-view-19.patch14.81 KBAnushka-mp
#18 simplenews-2410265-subscriber-view-18.patch12.41 KBAnushka-mp
#12 simplenews-2410265-subscriber-view-12.patch11.23 KBAnushka-mp
#12 Screen Shot 2015-01-26 at 16.14.46.png51.06 KBAnushka-mp
#11 Screen Shot 2015-01-26 at 15.45.16.png63.21 KBAnushka-mp
#11 Screen Shot 2015-01-26 at 15.47.05.png46.22 KBAnushka-mp
#9 simplenews-2410265-subscriber-view-9.patch11.19 KBAnushka-mp

Comments

Anushka-mp’s picture

Issue summary: View changes
miro_dietiker’s picture

Component: Code » User interface
miro_dietiker’s picture

Priority: Normal » Major
Issue tags: +8.x release target
miro_dietiker’s picture

Don't forget to add exposed filters to the admin view.
Due to the subscriber view with subscription relationships the exposed subscription filters might be quite a bit of work.

We can also make advanced exposed filter a followup. But they should be defined before closing this issue.

miro_dietiker’s picture

Preferred filters:
- Published status
- Newsletter
- Send status

miro_dietiker’s picture

We should create a view header plugin that checks for newsletters. If one newsletter is sending, we should display an info message on how to stop.
Or we can also just add a visual emphasis and possibly extend the operations?
Problem is: All send status, send and stop sending are on the same tab.
See also the operations issue: #2413931: Admin UI: Newsletter issue operations

berdir’s picture

Sounds like an interesting idea, but follow-up material :)

I started adding views integration to polls recently (#2409887: Views integration) and would suggest a similar approach as I started with there:

1. Add the default entity views data handler to subscribers and build an initial version of the subscriber and issue UI, disable whatever views hooks we currently still implement.
2. Identify missing functionality, check if there are core issues that would improve/provide them (e.g. the links issue that I linked in the poll issue)
3. Push the core issues and whatever custom integration (data definitions and plugins) that we need.
4. Drop the old code that we no longer need, enable tests that are curently disabled for those views.

That can happen in the same issue (except some additioal features that are not critical functionality like the header idea above) but I think we should split subscribers and issues up, they will hardly have anything in common.

miro_dietiker’s picture

Title: todo.txt: simplenews:replace subscriber and issue overview with views » Replace subscriber overview with views
Related issues: +#2413995: Replace newsletter issue overview with views

Changing title, reducing to subscriber view.
Split off part: #2413995: Replace newsletter issue overview with views

Anushka-mp’s picture

Status: Active » Needs review
StatusFileSize
new11.19 KB

Subscriber view added and the iews.views.subscribers added.
first attempt, providing for feedback.

Status: Needs review » Needs work

The last submitted patch, 9: simplenews-2410265-subscriber-view-9.patch, failed testing.

Anushka-mp’s picture

Screenshots added both d7 and d8,
filters and operations are yet to be implemented. awaiting feedback.

Anushka-mp’s picture

Filter added to filter the subscribers by mail.

Anushka-mp’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: simplenews-2410265-subscriber-view-12.patch, failed testing.

The last submitted patch, 12: simplenews-2410265-subscriber-view-12.patch, failed testing.

berdir’s picture

Lets depend simplenews on views, at least temporarily, to figure out if there are test fails caused by the switch.

Also search for "@todo Enable these tests again in https://www.drupal.org/node/2401019.", figure out which of those tests apply to the subscriber overview. There are tests for the email filter for example, try to make them work again. Note that views filters use GET, that might be a problem with testing.

Status: Needs work » Needs review
Anushka-mp’s picture

StatusFileSize
new12.41 KB

filter was missing in the earlier patch.

Anushka-mp’s picture

As discussed with Berdir,
commented out tests to test subscribers view is now enabled.
Since we don't have the newsletters and operations in the view there will be many failures.

Status: Needs review » Needs work

The last submitted patch, 19: simplenews-2410265-subscriber-view-19.patch, failed testing.

Anushka-mp’s picture

Status: Needs work » Needs review
StatusFileSize
new24.58 KB
new10.87 KB

As discussed with Miro,
The (individual)operations Edit and Delete added to subscribers view as a drop button.
bulk operations and newsletter filters are yet to be implemented and would be separate issues. I will create them.
awaiting feedback.
Expecting test failures due the test changes (#19)

Status: Needs review » Needs work

The last submitted patch, 21: simplenews-2410265-subscriber-view-21.patch, failed testing.

Anushka-mp’s picture

Status: Needs work » Needs review
StatusFileSize
new14.45 KB
new27.29 KB

The tests are corrected after the view is added. But there is a one test failure which I could not figure out why.
waiting for some input.

Status: Needs review » Needs work

The last submitted patch, 23: simplenews-2410265-subscriber-view-22.patch, failed testing.

Anushka-mp’s picture

Status: Needs work » Needs review
StatusFileSize
new44.35 KB
new44.35 KB

Finally we have the view with the filters for newsletters, subscriber and subscription status with all the required fields.
Tests are all green locally.

The last submitted patch, 25: simplenews-2410265-subscriber-view-25.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 25: simplenews-2410265-subscriber-view-25.patch, failed testing.

Status: Needs work » Needs review

Anushka-mp’s picture

Tests pass locally. One more try.

The last submitted patch, 25: simplenews-2410265-subscriber-view-25.patch, failed testing.

The last submitted patch, 25: simplenews-2410265-subscriber-view-25.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 30: simplenews-2410265-subscriber-view-30.patch, failed testing.

Anushka-mp’s picture

Status: Needs work » Needs review
StatusFileSize
new45.38 KB

.DS_Store ruined the patch -_-

miro_dietiker’s picture

Status: Needs review » Needs work

Looks pretty nice. Some small fixes. Will commit when passing again.

  1. +++ b/config/install/views.view.simplenews_subscribers.yml
    @@ -0,0 +1,783 @@
    +          label: 'User name'
    
    +++ b/src/SubscriberViewsData.php
    @@ -0,0 +1,41 @@
    +        'title' => $this->t('User name'),
    

    Core mentions "Username" in the people view. I guess we should do it exactly the same.

  2. +++ b/simplenews.views.inc
    @@ -5,6 +5,25 @@
    +    if($field_storage->getType() == 'simplenews_subscription') {
    

    Please check all codestyle.

Anushka-mp’s picture

Status: Needs work » Needs review
StatusFileSize
new10.11 KB
new46.24 KB

Coding style fixes.

Anushka-mp’s picture

StatusFileSize
new46.25 KB

minor fix in doc comment.
"...node entity type" => "...subscriber entity type"

berdir’s picture

Status: Needs review » Needs work

As discussed, drop the subscriber list builder and then we should be done here.

Anushka-mp’s picture

Status: Needs work » Needs review
StatusFileSize
new4.32 KB
new48.14 KB

Subscriber list builder dropped. routing modified with views.

Anushka-mp’s picture

Subscriptions field added to the view.

Anushka-mp’s picture

StatusFileSize
new50.04 KB

Filters naming corrected. some minor cleanup.

The last submitted patch, 40: simplenews-2410265-subscriber-view-40.patch, failed testing.

The last submitted patch, 39: simplenews-2410265-subscriber-view-39.patch, failed testing.

The last submitted patch, 40: simplenews-2410265-subscriber-view-40.patch, failed testing.

Anushka-mp’s picture

Interdiff for the above patch.

Status: Needs review » Needs work

The last submitted patch, 41: simplenews-2410265-subscriber-view-41.patch, failed testing.

berdir’s picture

  1. +++ b/config/install/views.view.simplenews_subscribers.yml
    @@ -0,0 +1,707 @@
    +uuid: bcacf942-0be0-4960-9206-060aede4bd20
    

    uuid needs to be removed.

  2. +++ b/simplenews.views.inc
    --- a/src/Entity/Subscriber.php
    +++ b/src/Entity/Subscriber.php
    
    +++ b/src/Entity/Subscriber.php
    +++ b/src/Entity/Subscriber.php
    @@ -29,7 +29,9 @@ use Drupal\user\UserInterface;
    
    @@ -29,7 +29,9 @@ use Drupal\user\UserInterface;
      *       "block" = "Drupal\simplenews\Form\SubscriptionsBlockForm",
      *       "page" = "Drupal\simplenews\Form\SubscriptionsPageForm",
      *       "delete" = "Drupal\simplenews\Form\SubscriberDeleteForm",
    - *     }
    

    list builder is not removed?

  3. +++ b/src/SubscriberViewsData.php
    @@ -0,0 +1,48 @@
    +    $data['simplenews_subscriber']['user_name'] = array(
    +      'real field' => 'uid',
    +      'field' => array(
    +        'title' => $this->t('Username'),
    +        'help' => $this->t('Provide a simple link to the subscriber\'s user account .'),
    +        'id' => 'simplenews_user_name',
    

    Add a @todo on the issue you created here with the core problem.

  4. +++ b/src/Tests/SimplenewsAdministrationTest.php
    @@ -26,6 +26,18 @@ use Drupal\simplenews\Entity\Subscriber;
       /**
    +   * Disabled config schema checking temporarily until all errors are resolved.
    +   */
    +  protected $strictConfigSchema = FALSE;
    

    Why is this here? We should fix the fails.

  5. +++ b/src/Tests/SimplenewsAdministrationTest.php
    @@ -26,6 +26,18 @@ use Drupal\simplenews\Entity\Subscriber;
    +  /**
    +   * Modules to enable.
    +   *
    +   * @var array
    +   */
    +  public static $modules = array('views');
    

    This is wrong, you need to add it to simplenews.info.yml instead.

  6. +++ b/src/Tests/SimplenewsAdministrationTest.php
    @@ -606,7 +610,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
        */
    -  function testContentTypes() {
    +  function atestContentTypes() {
         $admin_user = $this->drupalCreateUser(array(
    
    @@ -674,4 +678,41 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
    +   * Test content subscription status filter in subscriber view.
    +   */
    +  function atestSubscriberStatusFilter() {
    

    disabled tests.

Anushka-mp’s picture

Status: Needs work » Needs review
StatusFileSize
new5 KB
new50.18 KB

Changes made, dependancy added and views schema updated.

berdir’s picture

Status: Needs review » Fixed

Ok, committed and pushed.

  • Berdir committed 132ae41 on 8.x-1.x authored by Anushka-mp
    Issue #2410265 by Anushka-mp: Replace subscriber overview with views
    

Status: Fixed » Closed (fixed)

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