@@ -379,11 +379,13 @@ class ComposeContentController extends ComposeController<ContentValidationError>
379
379
}
380
380
381
381
enum SavedSnippetTitleValidationError {
382
- empty;
382
+ empty,
383
+ tooLong;
383
384
384
385
String message (ZulipLocalizations zulipLocalizations) {
385
386
return switch (this ) {
386
387
SavedSnippetTitleValidationError .empty => zulipLocalizations.savedSnippetTitleValidationErrorEmpty,
388
+ SavedSnippetTitleValidationError .tooLong => zulipLocalizations.savedSnippetTitleValidationErrorTooLong,
387
389
};
388
390
}
389
391
}
@@ -393,7 +395,7 @@ class SavedSnippetTitleComposeController extends ComposeController<SavedSnippetT
393
395
_update ();
394
396
}
395
397
396
- @override final maxLengthUnicodeCodePoints = null ;
398
+ @override int get maxLengthUnicodeCodePoints => kMaxTopicLengthCodePoints ;
397
399
398
400
@override
399
401
String _computeTextNormalized () {
@@ -405,16 +407,24 @@ class SavedSnippetTitleComposeController extends ComposeController<SavedSnippetT
405
407
return [
406
408
if (textNormalized.isEmpty)
407
409
SavedSnippetTitleValidationError .empty,
410
+
411
+ if (
412
+ _lengthUnicodeCodePointsIfLong != null
413
+ && _lengthUnicodeCodePointsIfLong! > maxLengthUnicodeCodePoints
414
+ )
415
+ SavedSnippetTitleValidationError .tooLong,
408
416
];
409
417
}
410
418
}
411
419
412
420
enum SavedSnippetContentValidationError {
413
- empty;
421
+ empty,
422
+ tooLong;
414
423
415
424
String message (ZulipLocalizations zulipLocalizations) {
416
425
return switch (this ) {
417
426
SavedSnippetContentValidationError .empty => zulipLocalizations.savedSnippetContentValidationErrorEmpty,
427
+ SavedSnippetContentValidationError .tooLong => zulipLocalizations.savedSnippetContentValidationErrorTooLong,
418
428
};
419
429
}
420
430
}
@@ -424,7 +434,7 @@ class SavedSnippetContentComposeController extends ComposeController<SavedSnippe
424
434
_update ();
425
435
}
426
436
427
- @override final maxLengthUnicodeCodePoints = null ;
437
+ @override int get maxLengthUnicodeCodePoints => kMaxMessageLengthCodePoints ;
428
438
429
439
@override
430
440
String _computeTextNormalized () {
@@ -436,6 +446,12 @@ class SavedSnippetContentComposeController extends ComposeController<SavedSnippe
436
446
return [
437
447
if (textNormalized.isEmpty)
438
448
SavedSnippetContentValidationError .empty,
449
+
450
+ if (
451
+ _lengthUnicodeCodePointsIfLong != null
452
+ && _lengthUnicodeCodePointsIfLong! > maxLengthUnicodeCodePoints
453
+ )
454
+ SavedSnippetContentValidationError .tooLong,
439
455
];
440
456
}
441
457
}
0 commit comments