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
merge-requests/30/merge
crockwave 2020-05-27 19:53:47 -05:00 zatwierdzone przez Alex Gleason
rodzic a85684835f
commit 76b3849c93
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -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 });
}