Skip to content

Commit ac7be16

Browse files
committed
model: Temporarily cut matchContent, matchTopic from message objects
We plan to revert this when we do #1663.
1 parent dd49897 commit ac7be16

File tree

5 files changed

+2
-31
lines changed

5 files changed

+2
-31
lines changed

lib/api/model/events.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,6 @@ class MessageEvent extends Event {
763763
// In the server API, the `flags` field appears directly on the event rather
764764
// than on the message object. To avoid proliferating message types, we
765765
// normalize that away in deserialization.
766-
//
767-
// The other difference in the server API between message objects in these
768-
// events and in the get-messages results is that `matchContent` and
769-
// `matchTopic` are absent here. Already [Message.matchContent] and
770-
// [Message.matchTopic] are optional, so no action is needed on that.
771766
@JsonKey(readValue: _readMessageValue, fromJson: Message.fromJson, includeToJson: false)
772767
final Message message;
773768

lib/api/model/model.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -865,9 +865,8 @@ sealed class Message<T extends Conversation> extends MessageBase<T> {
865865
// final string type; // handled by runtime type of object
866866
@JsonKey(fromJson: _flagsFromJson)
867867
List<MessageFlag> flags; // Unrecognized flags won't roundtrip through {to,from}Json.
868-
final String? matchContent;
869-
@JsonKey(name: 'match_subject')
870-
final String? matchTopic;
868+
// TODO(#1663) Add matchContent and matchTopic back again;
869+
// revert the commit that removed these and related test/comment changes.
871870

872871
static MessageEditState _messageEditStateFromJson(Object? json) {
873872
// This is a no-op so that [MessageEditState._readFromMessage]
@@ -912,8 +911,6 @@ sealed class Message<T extends Conversation> extends MessageBase<T> {
912911
required this.senderRealmStr,
913912
required super.timestamp,
914913
required this.flags,
915-
required this.matchContent,
916-
required this.matchTopic,
917914
});
918915

919916
// TODO(dart): This has to be a static method, because factories/constructors
@@ -997,8 +994,6 @@ class StreamMessage extends Message<StreamConversation> {
997994
required super.senderRealmStr,
998995
required super.timestamp,
999996
required super.flags,
1000-
required super.matchContent,
1001-
required super.matchTopic,
1002997
required this.conversation,
1003998
});
1004999

@@ -1059,8 +1054,6 @@ class DmMessage extends Message<DmConversation> {
10591054
required super.senderRealmStr,
10601055
required super.timestamp,
10611056
required super.flags,
1062-
required super.matchContent,
1063-
required super.matchTopic,
10641057
required this.conversation,
10651058
});
10661059

lib/api/model/model.g.dart

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/api/model/model_checks.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ extension MessageChecks on Subject<Message> {
6969
Subject<Poll?> get poll => has((e) => e.poll, 'poll');
7070
Subject<String> get type => has((e) => e.type, 'type');
7171
Subject<List<MessageFlag>> get flags => has((e) => e.flags, 'flags');
72-
Subject<String?> get matchContent => has((e) => e.matchContent, 'matchContent');
73-
Subject<String?> get matchTopic => has((e) => e.matchTopic, 'matchTopic');
7472
}
7573

7674
extension StreamMessageChecks on Subject<StreamMessage> {

test/api/model/model_test.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,6 @@ void main() {
9393
.topic.equals(const TopicName('hello'));
9494
});
9595

96-
test('match_subject -> matchTopic', () {
97-
check(baseStreamJson()).not((it) => it.containsKey('match_topic'));
98-
check(Message.fromJson(baseStreamJson()
99-
..['match_subject'] = 'yo'
100-
)).matchTopic.equals('yo');
101-
});
102-
10396
test('no crash on unrecognized flag', () {
10497
final m1 = Message.fromJson(
10598
(deepToJson(eg.streamMessage()) as Map<String, dynamic>)

0 commit comments

Comments
 (0)