From 6beaa79ab306b0a17f376a5e6324b29f47499212 Mon Sep 17 00:00:00 2001 From: tykayn Date: Wed, 13 Jan 2021 14:25:58 +0100 Subject: [PATCH] :zap: merge master 3.0.3, feature counter Merge remote-tracking branch 'origin' Signed-off-by: Baptiste Lemoine # Conflicts: # .ruby-version # app/javascript/mastodon/components/status.js # app/javascript/mastodon/features/direct_timeline/components/conversation.js # app/javascript/mastodon/features/getting_started/components/announcements.js # app/javascript/mastodon/locales/fr.json # config/locales/kab.yml # config/locales/ta.yml # yarn.lock --- .../compose/components/character_counter.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/javascript/mastodon/features/compose/components/character_counter.js b/app/javascript/mastodon/features/compose/components/character_counter.js index 0ecfc9141..9ffae9949 100644 --- a/app/javascript/mastodon/features/compose/components/character_counter.js +++ b/app/javascript/mastodon/features/compose/components/character_counter.js @@ -6,20 +6,22 @@ export default class CharacterCounter extends React.PureComponent { static propTypes = { text: PropTypes.string.isRequired, - max: PropTypes.number.isRequired, + max : PropTypes.number.isRequired, }; - checkRemainingText (diff) { + checkRemainingText(textlength, max) { + const diff = this.props.max - textlength; if (diff < 0) { - return {diff}; + return {diff}; } - return {diff}; + return {textlength} / {max}; } - render () { - const diff = this.props.max - length(this.props.text); - return this.checkRemainingText(diff); + render() { + + const leng = length(this.props.text); + return this.checkRemainingText(leng, this.props.max); } }