profile fields: Fix fragile JavaScript for deleting date fields.

The JavaScript click handler for this feature was fragile in a way
that would break with upcoming changes to how we display the X
element.  We clean this up with a replacement implementation that
should be much less fragile.
This commit is contained in:
Tim Abbott 2018-07-11 19:12:01 +05:30
parent e790f35d0e
commit 0132816471
1 changed files with 2 additions and 2 deletions

View File

@ -403,9 +403,9 @@ exports.set_up = function () {
$('#settings_page').on('click', '.custom_user_field .remove_date', function (e) {
e.preventDefault();
e.stopPropagation();
var field = $(e.target).parent('.custom_user_field').expectOne();
var field = $(e.target).closest('.custom_user_field').expectOne();
var field_id = parseInt($(field).attr("data-field-id"), 10);
$(e.target).prev(".custom_user_field_value").val("");
field.find(".custom_user_field_value").val("");
update_user_custom_profile_fields([field_id], channel.del);
});