From 76b3849c935f62e5fbd983cc7821a4b52da6170c Mon Sep 17 00:00:00 2001 From: crockwave Date: Wed, 27 May 2020 19:53:47 -0500 Subject: [PATCH] Convert HTML to text value in Profile Page for Display name and Bio fields Fixed linter errors * used unescape method from lodash to translate HTML to plain text * Moved translation to the componentDidMount event * Removed decodeHtml method from utils/html --- app/gabsocial/features/edit_profile/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/gabsocial/features/edit_profile/index.js b/app/gabsocial/features/edit_profile/index.js index d09e5bb0e..7ac387310 100644 --- a/app/gabsocial/features/edit_profile/index.js +++ b/app/gabsocial/features/edit_profile/index.js @@ -18,6 +18,7 @@ import { List as ImmutableList, } from 'immutable'; import { patchMe } from 'gabsocial/actions/me'; +import { unescape } from 'lodash'; const MAX_FIELDS = 4; // TODO: Make this dynamic by the instance @@ -116,6 +117,13 @@ class EditProfile extends ImmutablePureComponent { this.setState(initialState.toObject()); } + componentDidMount() { + const display_name = unescape(this.state.display_name); + this.setState({ display_name: display_name }); + const note = unescape(this.state.note); + this.setState({ note: note }); + } + handleCheckboxChange = e => { this.setState({ [e.target.name]: e.target.checked }); }