mailinglist: Updated to new standard #277

Merged
laurensmartina merged 2 commits from newtext_mailing into master 2019-12-29 05:31:32 +00:00
laurensmartina commented 2019-11-25 17:31:53 +00:00 (Migrated from github.com)
No description provided.
matthijskooijman (Migrated from github.com) reviewed 2019-12-10 10:00:06 +00:00
matthijskooijman (Migrated from github.com) left a comment

I reviewed the first half, up to including addressesView(). More later.

I reviewed the first half, up to including `addressesView()`. More later.
matthijskooijman (Migrated from github.com) commented 2019-12-10 08:17:15 +00:00

Is this a good idea? I can imagine this will cause subtle breakage if the classname is ever changed (since that will then influence the XML schema). Maybe keeping this explicit is better?

Is this a good idea? I can imagine this will cause subtle breakage if the classname is ever changed (since that will then influence the XML schema). Maybe keeping this explicit is better?
matthijskooijman (Migrated from github.com) commented 2019-12-10 08:34:40 +00:00

This should be named defaultViewRender I think?

This should be named defaultViewRender I think?
matthijskooijman (Migrated from github.com) commented 2019-12-10 08:42:35 +00:00

Returning errors is not yet handled, right?

Returning errors is not yet handled, right?
matthijskooijman (Migrated from github.com) commented 2019-12-10 08:50:44 +00:00

I suspect that at least $email needs to be encoded here? IIRC we added an xpath_encode() function or something similar a while ago.

I suspect that at least `$email` needs to be encoded here? IIRC we added an `xpath_encode()` function or something similar a while ago.
matthijskooijman (Migrated from github.com) commented 2019-12-10 08:53:43 +00:00

Did you test this? IIRC findXPath by default only looks at children of the the elements you run it on (so if $addresses->children() are the address elements, this will only look at their children). IIRC you can pass a custom axis to findXpath, or just call on $addresses instead of its children.

Did you test this? IIRC findXPath by default only looks at children of the the elements you run it on (so if `$addresses->children()` are the `address` elements, this will only look at their children). IIRC you can pass a custom axis to `findXpath`, or just call on `$addresses` instead of its children.
matthijskooijman (Migrated from github.com) commented 2019-12-10 08:55:42 +00:00

I would htmlspecialchars the $confirmUrl here.

I would `htmlspecialchars` the `$confirmUrl` here.
matthijskooijman (Migrated from github.com) commented 2019-12-10 09:07:21 +00:00

this should also encode xpath

this should also encode xpath
matthijskooijman (Migrated from github.com) commented 2019-12-10 09:51:14 +00:00

Should this use find rather than getOrCreate? With find, it will look recursively, which is not what is intended I think? Maybe this should use get() instead?

Should this use find rather than getOrCreate? With find, it will look recursively, which is not what is intended I think? Maybe this should use `get()` instead?
matthijskooijman (Migrated from github.com) commented 2019-12-10 09:53:08 +00:00

Should this find be limited in scope to the addresses element? Maybe alos use './' to only get direct children rather than look recursively? This also applies to other findXPaths in the code.

Should this find be limited in scope to the addresses element? Maybe alos use './' to only get direct children rather than look recursively? This also applies to other findXPaths in the code.
matthijskooijman (Migrated from github.com) commented 2019-12-10 09:57:02 +00:00

What is the idea behind this extra field? If we want to keep the e-mail address, why not just in the regular e-mail field?

What is the idea behind this extra field? If we want to keep the e-mail address, why not just in the regular e-mail field?
matthijskooijman (Migrated from github.com) requested changes 2019-12-16 15:52:55 +00:00
matthijskooijman (Migrated from github.com) left a comment

Finished review, added more inline comments :-)

Finished review, added more inline comments :-)
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
matthijskooijman (Migrated from github.com) commented 2019-12-16 14:51:07 +00:00

I think this can return 404 to get a proper 404 HTTP response? Same for a few other places?

I think this can return 404 to get a proper 404 HTTP response? Same for a few other places?
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:00:28 +00:00

htmlspecialchars

htmlspecialchars
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:11:38 +00:00

This only adds the send button when in draft, is that intentional?

This only adds the send button when in draft, is that intentional?
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:13:00 +00:00

I would use json_encode() for all these javascript strings.

I would use `json_encode()` for all these javascript strings.
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:17:13 +00:00

I think this can use constructFullPath()?

I think this can use `constructFullPath()`?
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:29:42 +00:00

Why do we include the mailing id in the POST parameters at all? Only for this consistency check it seems? Why not leave it out of the form entirely? Originally, it seems it was used to distinguish between new mailings and edited mailings, but this is now done using arguments to helper functions, so just putting the id in the URL seems sufficient?

Why do we include the mailing id in the POST parameters at all? Only for this consistency check it seems? Why not leave it out of the form entirely? Originally, it seems it was used to distinguish between new mailings and edited mailings, but this is now done using arguments to helper functions, so just putting the id in the URL seems sufficient?
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:33:01 +00:00

Huh? When status is SENT, this throes away the edit and says "successfully sent"? What's the idea here?

Huh? When status is SENT, this throes away the edit and says "successfully sent"? What's the idea here?
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:40:58 +00:00

This should be field-name-email.

This should be `field-name-email`.
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:41:48 +00:00

These should also be field-name-xxx.

These should also be `field-name-xxx`.
@ -762,3 +784,1 @@
private function testSendMailing($mailingId, $email) {
if (!$this->hasSender()) {
throw new \Exception(__('ml-no-sender'));
/**
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:26:54 +00:00

This looks broken: <field-name-labelsubjectFieldName]]">

Also, </field-name-label> is not valid HTML tag? What's going on here?

Also, [[subjectFieldName]] should be [[field-name-subject]] I think?

This looks broken: `<field-name-labelsubjectFieldName]]">` Also, `</field-name-label>` is not valid HTML tag? What's going on here? Also, `[[subjectFieldName]]` should be `[[field-name-subject]]` I think?
@ -769,0 +813,4 @@
];
$form = $this->createMailingForm($formData);
$cancelPath = $this->substituteSpecial(self::PATH_MAILS_VIEW_ID, ['id' => $mailingId]);
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:45:24 +00:00

This mixes up two checks: !hasSender() now shows login-to-edit (which is wrong), and there is no actual !isUser() check (seems it was not there before either).

This mixes up two checks: `!hasSender()` now shows `login-to-edit` (which is wrong), and there is no actual `!isUser()` check (seems it was not there before either).
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:46:33 +00:00

Shouldn't this use getSenderData?

Shouldn't this use getSenderData?
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:41:25 +00:00

This can be a normal HTMLForm.

This can be a normal `HTMLForm`.
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:48:32 +00:00

htmlspecialchars on links

htmlspecialchars on links
matthijskooijman (Migrated from github.com) commented 2019-12-16 15:49:00 +00:00

htmlspecialchars on links

htmlspecialchars on links
laurensmartina (Migrated from github.com) reviewed 2019-12-17 05:56:42 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 05:56:42 +00:00

updated it

updated it
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:11:47 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:11:47 +00:00

true, i'll change this

true, i'll change this
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:12:40 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:12:40 +00:00

changed it

changed it
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:14:02 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:14:02 +00:00

changed it

changed it
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:20:50 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:20:50 +00:00

It's tested and now tested again, so it does work. That said, I'll look into this.

It's tested and now tested again, so it does work. That said, I'll look into this.
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:25:40 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:25:40 +00:00

Removing ->children() also works. :-)

Removing `->children()` also works. :-)
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:42:43 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:42:43 +00:00

done

done
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:45:08 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:45:08 +00:00

done

done
laurensmartina (Migrated from github.com) reviewed 2019-12-17 06:57:17 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-17 06:57:17 +00:00

Updated this troughtout the class

Updated this troughtout the class
laurensmartina (Migrated from github.com) reviewed 2019-12-19 07:55:31 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-19 07:55:30 +00:00

If you keep it in the same field and the same email address would subscribe, that record would be re-used.

If you keep it in the same field and the same email address would subscribe, that record would be re-used.
laurensmartina (Migrated from github.com) reviewed 2019-12-19 08:24:55 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-19 08:24:55 +00:00

updated

updated
laurensmartina (Migrated from github.com) reviewed 2019-12-23 11:40:10 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-23 11:40:09 +00:00

done

done
laurensmartina (Migrated from github.com) reviewed 2019-12-23 12:17:54 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-23 12:17:54 +00:00

done

done
matthijskooijman (Migrated from github.com) reviewed 2019-12-23 12:26:52 +00:00
matthijskooijman (Migrated from github.com) commented 2019-12-23 12:26:51 +00:00

Is that problematic? And if so, you could also change the subscription code to not reuse an UNSUBSCRIBED status record?

Is that problematic? And if so, you could also change the subscription code to not reuse an UNSUBSCRIBED status record?
laurensmartina (Migrated from github.com) reviewed 2019-12-23 13:08:23 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-23 13:08:23 +00:00

Yes, it is. :-)

Yes, it is. :-)
laurensmartina (Migrated from github.com) reviewed 2019-12-23 13:15:51 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-23 13:15:51 +00:00

It was already like this and take too much time to implement, so I consider this outside of the scope of this pull request.

It was already like this and take too much time to implement, so I consider this outside of the scope of this pull request.
matthijskooijman (Migrated from github.com) reviewed 2019-12-23 13:27:26 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
matthijskooijman (Migrated from github.com) commented 2019-12-23 13:27:25 +00:00

Right, I later noticed that sending a message removes it from draft, so that indeed makes sense :-)

Right, I later noticed that sending a message removes it from draft, so that indeed makes sense :-)
matthijskooijman (Migrated from github.com) reviewed 2019-12-23 13:29:43 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
matthijskooijman (Migrated from github.com) commented 2019-12-23 13:29:43 +00:00

Why would this take time to implement? I meant this:

$commands->append(makeButton(__('send'), 'if(confirm(' . json_encode(__('ml-sure-to-send', array("count" => $num))) . '))' . makeAction($path, self::CMD_SEND, '')));
$commands->append(makeButton(__('ml-test-send'), 'hypha('.json_encode($path).', '.json_encode(self::CMD_SEND_TEST).', prompt(' . json_encode(__('email')) . '), $(this).closest(\'form\'));'));
Why would this take time to implement? I meant this: ``` $commands->append(makeButton(__('send'), 'if(confirm(' . json_encode(__('ml-sure-to-send', array("count" => $num))) . '))' . makeAction($path, self::CMD_SEND, ''))); $commands->append(makeButton(__('ml-test-send'), 'hypha('.json_encode($path).', '.json_encode(self::CMD_SEND_TEST).', prompt(' . json_encode(__('email')) . '), $(this).closest(\'form\'));')); ```
laurensmartina (Migrated from github.com) reviewed 2019-12-23 13:31:16 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-23 13:31:15 +00:00

done

done
laurensmartina (Migrated from github.com) reviewed 2019-12-23 13:31:44 +00:00
@ -762,3 +784,1 @@
private function testSendMailing($mailingId, $email) {
if (!$this->hasSender()) {
throw new \Exception(__('ml-no-sender'));
/**
laurensmartina (Migrated from github.com) commented 2019-12-23 13:31:44 +00:00

fixed it

fixed it
laurensmartina (Migrated from github.com) reviewed 2019-12-24 10:53:06 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-24 10:53:06 +00:00

I've removed it.

I've removed it.
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:14:03 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-24 16:14:02 +00:00

... So it is fixed now.. by also replacing " by '

... So it is fixed now.. by also replacing `"` by `'`
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:15:07 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-24 16:15:07 +00:00

fixed

fixed
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:18:11 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-24 16:18:11 +00:00

true, but I would rather return in all the WymHTMLForm, it's almost no overhead and way more consistent.

true, but I would rather return in all the WymHTMLForm, it's almost no overhead and way more consistent.
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:20:09 +00:00
@ -769,0 +813,4 @@
];
$form = $this->createMailingForm($formData);
$cancelPath = $this->substituteSpecial(self::PATH_MAILS_VIEW_ID, ['id' => $mailingId]);
laurensmartina (Migrated from github.com) commented 2019-12-24 16:20:09 +00:00

I blame my laziness.

I blame my laziness.
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:20:15 +00:00
@ -769,0 +813,4 @@
];
$form = $this->createMailingForm($formData);
$cancelPath = $this->substituteSpecial(self::PATH_MAILS_VIEW_ID, ['id' => $mailingId]);
laurensmartina (Migrated from github.com) commented 2019-12-24 16:20:15 +00:00

fixed it

fixed it
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:20:48 +00:00
@ -769,0 +813,4 @@
];
$form = $this->createMailingForm($formData);
$cancelPath = $this->substituteSpecial(self::PATH_MAILS_VIEW_ID, ['id' => $mailingId]);
laurensmartina (Migrated from github.com) commented 2019-12-24 16:20:48 +00:00

thank you for catching this. :-)

thank you for catching this. :-)
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:21:05 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-24 16:21:04 +00:00

fixed it

fixed it
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:25:03 +00:00
@ -769,0 +813,4 @@
];
$form = $this->createMailingForm($formData);
$cancelPath = $this->substituteSpecial(self::PATH_MAILS_VIEW_ID, ['id' => $mailingId]);
laurensmartina (Migrated from github.com) commented 2019-12-24 16:25:03 +00:00

fixed

fixed
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:26:21 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-24 16:26:21 +00:00

done

done
laurensmartina (Migrated from github.com) reviewed 2019-12-24 16:26:30 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-24 16:26:30 +00:00

done

done
laurensmartina (Migrated from github.com) reviewed 2019-12-25 09:09:22 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
laurensmartina (Migrated from github.com) commented 2019-12-25 09:09:22 +00:00

removed it

removed it
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 09:17:05 +00:00
matthijskooijman (Migrated from github.com) commented 2019-12-25 09:17:05 +00:00

That also seems a bit convoluted. I would just keep it in the same space, to keep the structure simple and equal, and adapt other code to match. Most other code that deals with subscriptions already has to check for status anyway, so that is not particularly hard, right?

We could also consider preserving the current behaviour (removing email) in this PR, and move this change into a separate PR (a separate commit would be a good idea in any case, since it is quite a signficant behaviour change).

That also seems a bit convoluted. I would just keep it in the same space, to keep the structure simple and equal, and adapt other code to match. Most other code that deals with subscriptions already has to check for status anyway, so that is not particularly hard, right? We could also consider preserving the current behaviour (removing email) in this PR, and move this change into a separate PR (a separate commit would be a good idea in any case, since it is quite a signficant behaviour change).
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 09:19:53 +00:00
@ -409,2 +436,3 @@
notify('success', ucfirst(__('ml-successfully-unsubscribed')));
return ['redirect', $this->constructFullPath($this->pagename)];
return ['redirect', $this->path()];
matthijskooijman (Migrated from github.com) commented 2019-12-25 09:19:53 +00:00

Huh? Why is replacing " by ' needed? Javascript strings can be enclosed in " just fine, right? And json_encode will have taken care of any needed escaping already? If you replace the quote type, and your encoded strings contain quotes, I think you will actually break things?

Huh? Why is replacing " by ' needed? Javascript strings can be enclosed in " just fine, right? And `json_encode` will have taken care of any needed escaping already? If you replace the quote type, and your encoded strings contain quotes, I think you will actually break things?
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 09:20:49 +00:00
matthijskooijman (Migrated from github.com) commented 2019-12-25 09:20:49 +00:00

Because, IMHO, it adds complexity (e.g. the display code must now handle two fields for e-mail rather than one).

Because, IMHO, it adds complexity (e.g. the display code must now handle two fields for e-mail rather than one).
laurensmartina (Migrated from github.com) reviewed 2019-12-25 09:28:08 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-25 09:28:08 +00:00

.... I've already retracted my previous comments. sorry. It just didn't click before.. Now it does. :-)

.... I've already retracted my previous comments. sorry. It just didn't click before.. Now it does. :-)
laurensmartina (Migrated from github.com) reviewed 2019-12-25 09:54:41 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-25 09:54:40 +00:00

fixed

fixed
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 10:01:18 +00:00
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:01:18 +00:00

Yay! Also, deleting comments is sometimes annoying, since I still see them in e-mail notification but cannot use the link in the e-mail anymore to see the comments. Editing them to indicate they are no longr relevant might be better in such cases :-)

Yay! Also, deleting comments is sometimes annoying, since I still see them in e-mail notification but cannot use the link in the e-mail anymore to see the comments. Editing them to indicate they are no longr relevant might be better in such cases :-)
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 10:52:28 +00:00
matthijskooijman (Migrated from github.com) left a comment

Looks good overall. I left a few comments inline around a common theme.

Also, I was missing the change to unsubscribeAction() to handle a redirect, but I noticed this was already included in the previous commit (but still unused there). Not really a problem, though.

Looks good overall. I left a few comments inline around a common theme. Also, I was missing the change to `unsubscribeAction()` to handle a `redirect`, but I noticed this was already included in the previous commit (but still unused there). Not really a problem, though.
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:31:21 +00:00

We've discussed this before, whether to show an error or success when the wanted state is already the current state, but in this case I really wonder if this is the right approach. Saying "reminder sent" explicitly indicates that something actually happened. In the case that something is wrong and e-mails are not received, it really does not help to have additional misunderstanding about whether something was even sent in the first place.

I realize that this is probably a corner case because the reminder button will not normally be shown when a reminder was already sent, but users will probably manage to keep open an old interface somewhere and then get confused about the message sent.

We've discussed this before, whether to show an error or success when the wanted state is already the current state, but in this case I really wonder if this is the right approach. Saying "reminder sent" explicitly indicates that something actually happened. In the case that something is wrong and e-mails are not received, it really does not help to have additional misunderstanding about whether something was even sent in the first place. I realize that this is probably a corner case because the reminder button will not normally be shown when a reminder was already sent, but users will probably manage to keep open an old interface somewhere and then get confused about the message sent.
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:33:54 +00:00

Should this authenticate using a code? Why not just check isUser()? AFAIU there is never a need for a non-logged-in user to send reminders, so why use a code here? That only leads to additional exposure of the code, which can actually allow (semi-malicious) logged in users to craft a confirmation url, bypassing the usual consent-mechanism for subscriptions.

Should this authenticate using a code? Why not just check `isUser()`? AFAIU there is never a need for a non-logged-in user to send reminders, so why use a code here? That only leads to additional exposure of the code, which can actually allow (semi-malicious) logged in users to craft a confirmation url, bypassing the usual consent-mechanism for subscriptions.
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:35:16 +00:00

Same here: Why use the code rather than logged in status?

Same here: Why use the code rather than logged in status?
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:38:14 +00:00

Reading again I see that the code is also used to identify the e-mail address to remind, but then I would rather pass the e-mailaddress to confirm.

Reading again I see that the code is also used to identify the e-mail address to remind, but then I would rather pass the e-mailaddress to confirm.
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:39:16 +00:00

This also allows deleting confirmed addresses, which is not what the commit message says. Is that intentional?

This also allows deleting confirmed addresses, which is not what the commit message says. Is that intentional?
@ -411,0 +535,4 @@
$code = $address->getAttribute(self::FIELD_NAME_CONFIRM_CODE);
$address->setAttribute(self::FIELD_NAME_REMINDED, true);
$this->xml->saveAndUnlock();
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:51:24 +00:00

Again, I would use an isAdmin() check in unsubscribeAction() rather than reusing the existing unsubscription code. Here, leaking the code is less of an issue, but checking isAdmin() in the action makes it more explicit that unsubscription is also allowed by admins.

Again, I would use an `isAdmin()` check in `unsubscribeAction()` rather than reusing the existing unsubscription code. Here, leaking the code is less of an issue, but checking `isAdmin()` in the action makes it more explicit that unsubscription is also allowed by admins.
matthijskooijman (Migrated from github.com) commented 2019-12-25 10:44:41 +00:00

Maybe this should be "already reminded" to emphasize that reminding can only be done once?

Maybe this should be "already reminded" to emphasize that reminding can only be done once?
laurensmartina (Migrated from github.com) reviewed 2019-12-25 12:29:33 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
laurensmartina (Migrated from github.com) commented 2019-12-25 12:29:32 +00:00

This is indeed an edge case. The remind action can and should only be triggered one time. If the remind action is triggered a second time, there is no need to send another reminder, and also no need to inform the user that this edge case occurred, because for the user the end result is the same.

This is indeed an edge case. The remind action can and should only be triggered one time. If the remind action is triggered a second time, there is no need to send another reminder, and also no need to inform the user that this edge case occurred, because for the user the end result is the same.
laurensmartina (Migrated from github.com) reviewed 2019-12-25 12:45:45 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
laurensmartina (Migrated from github.com) commented 2019-12-25 12:45:44 +00:00

fixed it

fixed it
laurensmartina (Migrated from github.com) reviewed 2019-12-25 12:51:09 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
laurensmartina (Migrated from github.com) commented 2019-12-25 12:51:09 +00:00

fixed

fixed
laurensmartina (Migrated from github.com) reviewed 2019-12-25 12:51:16 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
laurensmartina (Migrated from github.com) commented 2019-12-25 12:51:16 +00:00

fixed

fixed
laurensmartina (Migrated from github.com) reviewed 2019-12-25 12:52:22 +00:00
@ -411,0 +535,4 @@
$code = $address->getAttribute(self::FIELD_NAME_CONFIRM_CODE);
$address->setAttribute(self::FIELD_NAME_REMINDED, true);
$this->xml->saveAndUnlock();
laurensmartina (Migrated from github.com) commented 2019-12-25 12:52:21 +00:00

fixed

fixed
laurensmartina (Migrated from github.com) reviewed 2019-12-25 12:55:14 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
laurensmartina (Migrated from github.com) commented 2019-12-25 12:55:14 +00:00

I've updated the code, but still don't think it's needed.

I've updated the code, but still don't think it's needed.
laurensmartina (Migrated from github.com) reviewed 2019-12-25 13:10:03 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-25 13:10:03 +00:00

done

done
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 19:23:52 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
matthijskooijman (Migrated from github.com) commented 2019-12-25 19:23:51 +00:00

because for the user the end result is the same.

I think this entirely depends on the timeframe. If two users click the remind button at the same time, then the result is pretty much the same, yes: A reminder has been sent. However, if more time passes, then the message might cause a user to (rightfully) assume that another reminder has been sent (and e.g. tell the reminded user that he should have received another e-mail, which is then untrue). And even when both presses occur in short succession, this might lead user to believe that two reminder emails have been sent, which is not actually the case.

> because for the user the end result is the same. I think this entirely depends on the timeframe. If two users click the remind button at the same time, then the result is pretty much the same, yes: A reminder has been sent. However, if more time passes, then the message might cause a user to (rightfully) assume that *another* reminder has been sent (and e.g. tell the reminded user that he should have received another e-mail, which is then untrue). And even when both presses occur in short succession, this might lead user to believe that *two* reminder emails have been sent, which is not actually the case.
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 19:28:18 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
matthijskooijman (Migrated from github.com) commented 2019-12-25 19:28:18 +00:00

Would it not be better to reverse this check? E.g. "only pending addresses can be deleted"? Then this code remains working when additional statuses are added later.

Would it not be better to reverse this check? E.g. "only pending addresses can be deleted"? Then this code remains working when additional statuses are added later.
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 19:30:38 +00:00
@ -411,0 +535,4 @@
$code = $address->getAttribute(self::FIELD_NAME_CONFIRM_CODE);
$address->setAttribute(self::FIELD_NAME_REMINDED, true);
$this->xml->saveAndUnlock();
matthijskooijman (Migrated from github.com) commented 2019-12-25 19:30:37 +00:00

Really? I do not see any change in unsubscribeAction and the url still contains the unsubscribe code?

Really? I do not see any change in `unsubscribeAction` and the url still contains the unsubscribe code?
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 19:31:48 +00:00
matthijskooijman (Migrated from github.com) commented 2019-12-25 19:31:48 +00:00

typo: ent -> sent

typo: ent -> sent
laurensmartina (Migrated from github.com) reviewed 2019-12-25 19:51:10 +00:00
@ -411,0 +535,4 @@
$code = $address->getAttribute(self::FIELD_NAME_CONFIRM_CODE);
$address->setAttribute(self::FIELD_NAME_REMINDED, true);
$this->xml->saveAndUnlock();
laurensmartina (Migrated from github.com) commented 2019-12-25 19:51:10 +00:00

The unsubscribeAction is used for both admins and subscribers. So the isAdmin() isn't a good idea. I could make an extra action for the admins, but why, this one is already there?!

The unsubscribeAction is used for both admins and subscribers. So the `isAdmin()` isn't a good idea. I could make an extra action for the admins, but why, this one is already there?!
laurensmartina (Migrated from github.com) reviewed 2019-12-25 19:51:38 +00:00
@ -411,0 +535,4 @@
$code = $address->getAttribute(self::FIELD_NAME_CONFIRM_CODE);
$address->setAttribute(self::FIELD_NAME_REMINDED, true);
$this->xml->saveAndUnlock();
laurensmartina (Migrated from github.com) commented 2019-12-25 19:51:38 +00:00

So, yeah, I left it as it is.

So, yeah, I left it as it is.
laurensmartina (Migrated from github.com) reviewed 2019-12-25 19:52:45 +00:00
@ -411,0 +448,4 @@
if (!isAdmin()) {
notify('error', __(isUser() ? 'admin-rights-needed-to-perform-action' : 'login-to-perform-action'));
return ['redirect', $this->path()];
}
laurensmartina (Migrated from github.com) commented 2019-12-25 19:52:44 +00:00

true

true
matthijskooijman (Migrated from github.com) reviewed 2019-12-25 19:55:52 +00:00
@ -411,0 +535,4 @@
$code = $address->getAttribute(self::FIELD_NAME_CONFIRM_CODE);
$address->setAttribute(self::FIELD_NAME_REMINDED, true);
$this->xml->saveAndUnlock();
matthijskooijman (Migrated from github.com) commented 2019-12-25 19:55:52 +00:00

That's not really "fixed" :-)

I can imagine that the same action can be authenticated using isAdmin(), or failing that, require a code to be specified? Or two actions that call the same function to do the actual work?

As for why: it seems cleaner to me when the authentication code intended to be used for the recipient is not exposed elsewhere. Additionally, adding the isAdmin() check to unsubscribeAction makes it more clear to someone reading the code that unsubscription can be done by admins (iow, all access control appears in the same place, namely the action methods).

However, as I said, leaking the unsubscribe code is not as problematic as leaking the confirm code, so when I fail to convince you, leaving this as is is also an option for me :-)

That's not really "fixed" :-) I can imagine that the same action can be authenticated using `isAdmin()`, or failing that, require a code to be specified? Or two actions that call the same function to do the actual work? As for why: it seems cleaner to me when the authentication code intended to be used for the recipient is not exposed elsewhere. Additionally, adding the isAdmin() check to `unsubscribeAction` makes it more clear to someone reading the code that unsubscription can be done by admins (iow, all access control appears in the same place, namely the action methods). However, as I said, leaking the unsubscribe code is not as problematic as leaking the confirm code, so when I fail to convince you, leaving this as is is also an option for me :-)
laurensmartina (Migrated from github.com) reviewed 2019-12-25 19:59:46 +00:00
laurensmartina (Migrated from github.com) commented 2019-12-25 19:59:46 +00:00

fixed

fixed
laurensmartina (Migrated from github.com) reviewed 2019-12-26 10:54:47 +00:00
@ -411,0 +535,4 @@
$code = $address->getAttribute(self::FIELD_NAME_CONFIRM_CODE);
$address->setAttribute(self::FIELD_NAME_REMINDED, true);
$this->xml->saveAndUnlock();
laurensmartina (Migrated from github.com) commented 2019-12-26 10:54:47 +00:00

implemented new method.

implemented new method.
laurensmartina commented 2020-01-07 19:34:28 +00:00 (Migrated from github.com)

fixes #269

fixes #269
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harmen/hypha!277
No description provided.