Page MenuHomePhabricator

Enotif checkboxes cleared upon save before address is confirmed
Open, LowPublic

Description

Author: alan.harder

Description:
Found this in 1.6.1, confirmed same in current svn.

In the "Email" box of the "User Profile" tab of User Preferences. Before any
email address is provided, the checkboxes are enabled (not sure if they should
be, but that's another topic). You can save some changes. Enter an email
address and save. Now the email box has a message about email not yet
authenticated and the checkboxes are disabled. But if you save the page it
refreshes and all the checkboxes are now unchecked.


Version: 1.10.x
Severity: minor

Details

Reference
bz5495

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:09 PM
bzimport set Reference to bz5495.
bzimport added a subscriber: Unknown Object (MLST).

robchur wrote:

Under current SVN, when no email address has been provided, the email checkboxes
aren't even shown...unable to reproduce.

alan.harder wrote:

Just updated to rev 13679.. no change for me, still behaves as I described.

I see that line 479 of includes/SpecialPreferences.php is working fine in
checking for unset email, but in the else block it sets $disableEmailPrefs to
false at line 492. Changing this to true makes those checkboxes grayed out
before you enter an email address, but saving other changes again saves all
those checkboxes as off.

Line 659 only checks $wgEnableEmail to decide whether to show that email box.. I
don't see any logic that would hide this completely when no email address has
been given.

svn info reports:
URL: http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3
is this not current?

Disabled form controls don't sent their values with the form
submission. This is equivalent to leaving the boxes unchecked
from the perspective of looking at the incoming data.

To allow the values to persist while disabled, some logic would
need to be added to avoid overwriting those values under the
circumstances where they'd be disabled. A hackaround might be
to send a hidden field as well, or to avoid trying to save over
them when reading in data.

alan.harder wrote:

Add hidden form inputs for checked+disabled checkboxes

Here is a patch to add hidden form inputs.

attachment 5495.patch.txt ignored as obsolete

alan.harder wrote:

Just updated to rev 20087, still behaves as described above.

alan.harder wrote:

Add hidden form inputs for checked+disabled checkboxes

attachment enotif_checkbox_patch.txt ignored as obsolete

Can you explain what this change is for?

  • $disableEmailPrefs = false;

+ $disableEmailPrefs = true;

alan.harder wrote:

Add hidden form inputs for checked+disabled checkboxes

That part of the diff was intended to disable the checkboxes when no email
address has been entered yet. I see now this would also disable them when
$wgEmailAuthentication is false.. don't want that. Adding new patch to fix
that and also disable the ccmeonemails checkbox when the others are disabled.

attachment enotif_patch.txt ignored as obsolete

+testme, CC'ing Andrew to see if this is still a problem with new prefs.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

l.vaneijden wrote:

In addition to the checkboxes under the user profile.

Where it shows the user his emailaddress (if using emailadres is enabled in the settings), the email from the user record is shown.

However, if I change some preferences and press 'save', the emailaddress of the user is changed to an empty email (""). I don't see how any changes can be made to this without adjusting the core mediawiki files.

What I see is that when the 'save' button is pressed, $formData['emailaddress'] is checked. Since this is not present in the POST data, the variable will be NULL. The checks that follow are whether the variable is '' (which it is not) and whether the old emailaddress equals the new emailaddress (also not). It then defaults to set the new emailaddress, so the user his email is gone after pressing the 'save' button.

This was in a mode where the emailaddress field is merely viewable and not editable.

john wrote:

Comment on attachment 3303
Add hidden form inputs for checked+disabled checkboxes

Thanks for submitting a patch to MediaWiki. Unfortunately I'm going to have to
mark this patch as obsolete because it no longer merges into our current code.