@@ -379,11 +379,13 @@ class ComposeContentController extends ComposeController<ContentValidationError>
379379}
380380
381381enum SavedSnippetTitleValidationError {
382- empty;
382+ empty,
383+ tooLong;
383384
384385 String message (ZulipLocalizations zulipLocalizations) {
385386 return switch (this ) {
386387 SavedSnippetTitleValidationError .empty => zulipLocalizations.savedSnippetTitleValidationErrorEmpty,
388+ SavedSnippetTitleValidationError .tooLong => zulipLocalizations.savedSnippetTitleValidationErrorTooLong,
387389 };
388390 }
389391}
@@ -393,7 +395,7 @@ class SavedSnippetTitleComposeController extends ComposeController<SavedSnippetT
393395 _update ();
394396 }
395397
396- @override final maxLengthUnicodeCodePoints = null ;
398+ @override int get maxLengthUnicodeCodePoints => kMaxTopicLengthCodePoints ;
397399
398400 @override
399401 String _computeTextNormalized () {
@@ -405,16 +407,24 @@ class SavedSnippetTitleComposeController extends ComposeController<SavedSnippetT
405407 return [
406408 if (textNormalized.isEmpty)
407409 SavedSnippetTitleValidationError .empty,
410+
411+ if (
412+ _lengthUnicodeCodePointsIfLong != null
413+ && _lengthUnicodeCodePointsIfLong! > maxLengthUnicodeCodePoints
414+ )
415+ SavedSnippetTitleValidationError .tooLong,
408416 ];
409417 }
410418}
411419
412420enum SavedSnippetContentValidationError {
413- empty;
421+ empty,
422+ tooLong;
414423
415424 String message (ZulipLocalizations zulipLocalizations) {
416425 return switch (this ) {
417426 SavedSnippetContentValidationError .empty => zulipLocalizations.savedSnippetContentValidationErrorEmpty,
427+ SavedSnippetContentValidationError .tooLong => zulipLocalizations.savedSnippetContentValidationErrorTooLong,
418428 };
419429 }
420430}
@@ -424,7 +434,7 @@ class SavedSnippetContentComposeController extends ComposeController<SavedSnippe
424434 _update ();
425435 }
426436
427- @override final maxLengthUnicodeCodePoints = null ;
437+ @override int get maxLengthUnicodeCodePoints => kMaxMessageLengthCodePoints ;
428438
429439 @override
430440 String _computeTextNormalized () {
@@ -436,6 +446,12 @@ class SavedSnippetContentComposeController extends ComposeController<SavedSnippe
436446 return [
437447 if (textNormalized.isEmpty)
438448 SavedSnippetContentValidationError .empty,
449+
450+ if (
451+ _lengthUnicodeCodePointsIfLong != null
452+ && _lengthUnicodeCodePointsIfLong! > maxLengthUnicodeCodePoints
453+ )
454+ SavedSnippetContentValidationError .tooLong,
439455 ];
440456 }
441457}
0 commit comments