From ec57d8d392546baf25b2580e4c7413b982b40fa2 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 26 Feb 2017 16:37:58 +0000 Subject: [PATCH] ensure maxLength on topic titles --- frontend/src/components/TopicCard/Title.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/TopicCard/Title.js b/frontend/src/components/TopicCard/Title.js index cbc71b07..1eca527b 100644 --- a/frontend/src/components/TopicCard/Title.js +++ b/frontend/src/components/TopicCard/Title.js @@ -1,10 +1,12 @@ import React, { Component, PropTypes } from 'react' import { RIETextArea } from 'riek' +const maxTitleLength = 140 + class Title extends Component { nameCounterText() { // for some reason, there's an error if this isn't inside a function - return `${this.props.name.length}/140` + return `${this.props.name.length}/${maxTitleLength.toString()}` } render() { @@ -19,6 +21,7 @@ class Title extends Component { id="titleActivator" classEditing="riek-editing" editProps={{ + maxLength: maxTitleLength, onKeyPress: e => { const ENTER = 13 if (e.which === ENTER) {