From e42169c28e14f4dbc6e4d35ae189b73d90278c42 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 23 Feb 2017 17:48:44 +0000 Subject: Updates SSH key title after pasting key Previously it was listening for focusout, it now listens for blur & paste events Closes #28436 --- app/assets/javascripts/profile/profile.js.es6 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/assets') diff --git a/app/assets/javascripts/profile/profile.js.es6 b/app/assets/javascripts/profile/profile.js.es6 index 81374296522..4ccea0624ee 100644 --- a/app/assets/javascripts/profile/profile.js.es6 +++ b/app/assets/javascripts/profile/profile.js.es6 @@ -84,13 +84,14 @@ } $(function() { - $(document).on('focusout.ssh_key', '#key_key', function() { + $(document).on('input.ssh_key', '#key_key', function() { const $title = $('#key_title'); const comment = $(this).val().match(/^\S+ \S+ (.+)\n?$/); - if (comment && comment.length > 1 && $title.val() === '') { + + // Extract the SSH Key title from its comment + if (comment && comment.length > 1) { return $title.val(comment[1]).change(); } - // Extract the SSH Key title from its comment }); if (global.utils.getPagePath() === 'profiles') { return new Profile(); -- cgit v1.2.3