This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/components/structures Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ import { _t } from '../../languageHandler';
34
34
35
35
import { instanceForInstanceId , protocolNameForInstanceId } from '../../utils/DirectoryUtils' ;
36
36
37
+ const MAX_NAME_LENGTH = 80 ;
38
+ const MAX_TOPIC_LENGTH = 160 ;
39
+
37
40
linkifyMatrix ( linkify ) ;
38
41
39
42
module . exports = React . createClass ( {
@@ -390,7 +393,6 @@ module.exports = React.createClass({
390
393
const self = this ;
391
394
let guestRead ; let guestJoin ; let perms ;
392
395
for ( let i = 0 ; i < rooms . length ; i ++ ) {
393
- const name = rooms [ i ] . name || get_display_alias_for_room ( rooms [ i ] ) || _t ( 'Unnamed room' ) ;
394
396
guestRead = null ;
395
397
guestJoin = null ;
396
398
@@ -410,7 +412,15 @@ module.exports = React.createClass({
410
412
perms = < div className = "mx_RoomDirectory_perms" > { guestRead } { guestJoin } </ div > ;
411
413
}
412
414
415
+ let name = rooms [ i ] . name || get_display_alias_for_room ( rooms [ i ] ) || _t ( 'Unnamed room' ) ;
416
+ if ( name . length > MAX_NAME_LENGTH ) {
417
+ name = `${ name . substring ( 0 , MAX_NAME_LENGTH ) } ...` ;
418
+ }
419
+
413
420
let topic = rooms [ i ] . topic || '' ;
421
+ if ( topic . length > MAX_TOPIC_LENGTH ) {
422
+ topic = `${ topic . substring ( 0 , MAX_TOPIC_LENGTH ) } ...` ;
423
+ }
414
424
topic = linkifyString ( sanitizeHtml ( topic ) ) ;
415
425
416
426
rows . push (
You can’t perform that action at this time.
0 commit comments