Problem/Motivation

If an issue is sent to SIMPLENEWS_STATUS_SEND_PUBLISH the 'Stop sending' button will show on NodeTabForm but have no effect.

Cause

NodeTabForm:

  public function buildForm() {
  ...
      if ($status != SIMPLENEWS_STATUS_SEND_READY) {
        ...
        $form['actions']['stop'] = [
          '#type' => 'submit',
          '#submit' => ['::submitStop'],
          '#value' => $this->t('Stop sending'),
        ];
      }
  public function submitStop(array &$form, FormStateInterface $form_state) {
    $this->spoolStorage->deleteIssue($form_state->get('node'));
  }

SpoolStorage:

  public function addIssue(ContentEntityInterface $issue) {
    if (!in_array($issue->simplenews_issue->status, [SIMPLENEWS_STATUS_SEND_NOT, SIMPLENEWS_STATUS_SEND_PUBLISH])) {
      return;
    }

Proposed resolution

In submitStop() change the status to SEND_NOT if it is SEND_PUBLISH.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork simplenews-3266375

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jonathanshaw created an issue. See original summary.

jonathanshaw’s picture

Status: Active » Needs review
jonathanshaw’s picture

Status: Needs review » Needs work

I can't see why the test I added is failing. All lookgs good to me.

adamps’s picture

Status: Needs work » Closed (duplicate)

Shame - this was stuck in Needs work so I didn't look at it.

Any it was fixed in a slightly different way in #3341062: "Stop Sending" not working when unpublished.