@@ -718,7 +718,7 @@ class UpdateMessageMoveData {
718
718
required this .propagateMode,
719
719
required this .origTopic,
720
720
required this .newTopic,
721
- });
721
+ }) : assert (origStreamId != newStreamId || origTopic != newTopic) ;
722
722
723
723
/// Try to extract [UpdateMessageMoveData] from the JSON object for an
724
724
/// [UpdateMessageEvent] .
@@ -741,17 +741,8 @@ class UpdateMessageMoveData {
741
741
final newTopic = json['subject' ] == null ? null
742
742
: TopicName .fromJson (json['subject' ] as String );
743
743
744
- if (origTopic == null ) {
744
+ if (propagateMode == null ) {
745
745
// There was no move.
746
- assert (() {
747
- if (newStreamId != null && origStreamId != null
748
- && newStreamId != origStreamId) {
749
- // This should be impossible; `orig_subject` (aka origTopic) is
750
- // documented to be present when either the stream or topic changed.
751
- debugLog ('Malformed UpdateMessageEvent: stream move but no origTopic' ); // TODO(log)
752
- }
753
- return true ;
754
- }());
755
746
return null ;
756
747
}
757
748
@@ -761,22 +752,12 @@ class UpdateMessageMoveData {
761
752
assert (debugLog ('Malformed UpdateMessageEvent: move but no newStreamId or newTopic' )); // TODO(log)
762
753
throw FormatException ();
763
754
}
764
- if (origStreamId == null ) {
765
- // The `stream_id` field (aka origStreamId) is documented to be present on moves.
766
- assert (debugLog ('Malformed UpdateMessageEvent: move but no origStreamId' )); // TODO(log)
767
- throw FormatException ();
768
- }
769
- if (propagateMode == null ) {
770
- // The `propagate_mode` field (aka propagateMode) is documented to be present on moves.
771
- assert (debugLog ('Malformed UpdateMessageEvent: move but no propagateMode' )); // TODO(log)
772
- throw FormatException ();
773
- }
774
755
775
756
return UpdateMessageMoveData (
776
- origStreamId: origStreamId,
757
+ origStreamId: origStreamId! ,
777
758
newStreamId: newStreamId ?? origStreamId,
778
759
propagateMode: propagateMode,
779
- origTopic: origTopic,
760
+ origTopic: origTopic! ,
780
761
newTopic: newTopic ?? origTopic,
781
762
);
782
763
}
0 commit comments