diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index f1845a6687..68c5af6f57 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -240,11 +240,12 @@ initialize(); run_test('set_custom_profile_field_data', () => { var person = people.get_by_email(me.email); me.profile_data = {}; - var field = {id: 3, name: 'Custom long field', type: 'text', value: 'Field value'}; + var field = {id: 3, name: 'Custom long field', type: 'text', value: 'Field value', rendered_value: '
Field value
'}; people.set_custom_profile_field_data(person.user_id, {}); assert.deepEqual(person.profile_data, {}); people.set_custom_profile_field_data(person.user_id, field); assert.equal(person.profile_data[field.id].value, 'Field value'); + assert.equal(person.profile_data[field.id].rendered_value, 'Field value
'); }); run_test('get_rest_of_realm', () => { diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js index ce5ab936d3..9188d87178 100644 --- a/frontend_tests/node_tests/templates.js +++ b/frontend_tests/node_tests/templates.js @@ -591,7 +591,7 @@ run_test('compose_private_stream_alert', () => { run_test('custom_user_profile_field', () => { var field = {name: "GitHub user name", id: 2, hint: "Or link to profile"}; - var args = {field: field, field_value: {value: "@GitHub"}, field_type: "text"}; + var args = {field: field, field_value: {value: "@GitHub", rendered_value: "@GitHub
"}, field_type: "text"}; var html = render('custom-user-profile-field', args); assert.equal($(html).attr('data-field-id'), 2); assert.equal($(html).find('.custom_user_field_value').val(), "@GitHub"); diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js index 3743e30f65..add571d2da 100644 --- a/frontend_tests/node_tests/user_events.js +++ b/frontend_tests/node_tests/user_events.js @@ -157,9 +157,10 @@ run_test('updates', () => { blueslip.clear_test_data(); me.profile_data = {}; - user_events.update_person({user_id: me.user_id, custom_profile_field: {id: 3, value: 'Value'}}); + user_events.update_person({user_id: me.user_id, custom_profile_field: {id: 3, value: 'Value', rendered_value: 'Value
'}}); person = people.get_by_email(me.email); assert.equal(person.profile_data[3].value, 'Value'); + assert.equal(person.profile_data[3].rendered_value, 'Value
'); var updated = false; settings_account.update_email = (email) => { diff --git a/static/js/people.js b/static/js/people.js index 36785bbff7..bb413cd260 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -983,6 +983,7 @@ exports.set_custom_profile_field_data = function (user_id, field) { } people_by_user_id_dict.get(user_id).profile_data[field.id] = { value: field.value, + rendered_value: field.rendered_value, }; }; diff --git a/static/js/popovers.js b/static/js/popovers.js index db4428cbe7..43fa681cf2 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -256,9 +256,13 @@ exports.show_user_profile = function (user) { var field_choice_dict = JSON.parse(field.field_data); profile_field.value = field_choice_dict[field_value.value].text; break; + case field_types.SHORT_TEXT.id: + case field_types.LONG_TEXT.id: + profile_field.value = field_value.value; + profile_field.rendered_value = field_value.rendered_value; + break; default: profile_field.value = field_value.value; - break; } profile_data.push(profile_field); }); diff --git a/static/js/settings_account.js b/static/js/settings_account.js index 921535dfc9..7fa98b1181 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -164,6 +164,7 @@ exports.intialize_custom_user_type_fields = function (element_id, user_id, is_ed }); } } + if (is_editable) { var input = pill_container.children('.input'); if (set_handler_on_update) { diff --git a/static/templates/user_profile_modal.handlebars b/static/templates/user_profile_modal.handlebars index fdba6d3716..1fedd898b9 100644 --- a/static/templates/user_profile_modal.handlebars +++ b/static/templates/user_profile_modal.handlebars @@ -44,13 +44,17 @@