Skip to content

Commit 72d6d46

Browse files
committed
compose: Use maxTopicLength instead of the hardcoded value
Fixes zulip#307
1 parent 9bcc424 commit 72d6d46

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/api/route/messages.dart

-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ class GetMessagesResult {
155155
Map<String, dynamic> toJson() => _$GetMessagesResultToJson(this);
156156
}
157157

158-
// https://zulip.com/api/send-message#parameter-topic
159-
const int kMaxTopicLengthCodePoints = 60;
160158

161159
// https://zulip.com/api/send-message#parameter-content
162160
const int kMaxMessageLengthCodePoints = 10000;

lib/widgets/compose_box.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ enum TopicValidationError {
143143

144144
class ComposeTopicController extends ComposeController<TopicValidationError> {
145145
ComposeTopicController({required this.store}) {
146+
maxLengthUnicodeCodePoints = store.maxTopicLength;
146147
_update();
147148
}
148149

@@ -151,8 +152,7 @@ class ComposeTopicController extends ComposeController<TopicValidationError> {
151152
// TODO(#668): listen to [PerAccountStore] once we subscribe to this value
152153
bool get mandatory => store.realmMandatoryTopics;
153154

154-
// TODO(#307) use `max_topic_length` instead of hardcoded limit
155-
@override final maxLengthUnicodeCodePoints = kMaxTopicLengthCodePoints;
155+
@override late int maxLengthUnicodeCodePoints;
156156

157157
@override
158158
String _computeTextNormalized() {

0 commit comments

Comments
 (0)