From 2849c75646234725b2edf3f9485ddd8294174878 Mon Sep 17 00:00:00 2001 From: michag86 Date: Mon, 6 Oct 2014 08:53:12 +0200 Subject: [PATCH 1/3] fix for issue #10483 --- settings/js/users/users.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/settings/js/users/users.js b/settings/js/users/users.js index f39f8c2c06..f794819250 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -616,12 +616,14 @@ $(document).ready(function () { .keypress(function (event) { if (event.keyCode === 13) { if ($(this).val().length > 0) { - $tr.find('.avatardiv').imageplaceholder(uid, displayName); + if ($tr.find('div.avatardiv').length) { + $tr.find('.avatardiv').imageplaceholder(uid, displayName); + } $.post( OC.filePath('settings', 'ajax', 'changedisplayname.php'), {username: uid, displayName: $(this).val()}, function (result) { - if (result && result.status==='success'){ + if (result && result.status==='success' && $tr.find('div.avatardiv').length){ $tr.find('.avatardiv').avatar(result.data.username, 32); } } From f4a2ddbe31e7cb54dca7dcb487c827391d238e3a Mon Sep 17 00:00:00 2001 From: michag86 Date: Tue, 7 Oct 2014 10:44:36 +0200 Subject: [PATCH 2/3] variable for found avatar div --- settings/js/users/users.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/settings/js/users/users.js b/settings/js/users/users.js index f794819250..ed9999760a 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -616,15 +616,16 @@ $(document).ready(function () { .keypress(function (event) { if (event.keyCode === 13) { if ($(this).val().length > 0) { - if ($tr.find('div.avatardiv').length) { - $tr.find('.avatardiv').imageplaceholder(uid, displayName); + $div = $tr.find('div.avatardiv') + if ($div.length) { + $div.imageplaceholder(uid, displayName); } $.post( OC.filePath('settings', 'ajax', 'changedisplayname.php'), {username: uid, displayName: $(this).val()}, function (result) { - if (result && result.status==='success' && $tr.find('div.avatardiv').length){ - $tr.find('.avatardiv').avatar(result.data.username, 32); + if (result && result.status==='success' && $div.length){ + $div.avatar(result.data.username, 32); } } ); From 0039099f5119224d9bfed5ee1d5659ed3df5f46c Mon Sep 17 00:00:00 2001 From: michag86 Date: Tue, 7 Oct 2014 11:09:07 +0200 Subject: [PATCH 3/3] restrict $div to local scope --- settings/js/users/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/js/users/users.js b/settings/js/users/users.js index ed9999760a..0cb5fe3e15 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -616,7 +616,7 @@ $(document).ready(function () { .keypress(function (event) { if (event.keyCode === 13) { if ($(this).val().length > 0) { - $div = $tr.find('div.avatardiv') + var $div = $tr.find('div.avatardiv'); if ($div.length) { $div.imageplaceholder(uid, displayName); }