Skip to content

Commit 8c3b505

Browse files
committed
api [nfc]: Remove a comment about event_types that came from outdated doc
The doc for message_details on this event says the field is present if the flag is "read", with no mention of event_types. Looking through zulip/zulip's Git history, it turns out it had been mentioned in the past, but the mention was removed, in zulip/zulip@48a1cf04d: - Present if `message` and `update_message_flags` are both present in - `event_types` and the `flag` is `read` and the `op` is `remove`. + Only present if the specified `flag` is `"read"`. So the comment (and no-op `&& true`) isn't necessary; remove it. We noticed this because the analyzer started flagging an info-level `no_literal_bool_comparisons` here.
1 parent 2b0944f commit 8c3b505

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/api/model/events.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,10 +1172,7 @@ class UpdateMessageFlagsRemoveEvent extends UpdateMessageFlagsEvent {
11721172
factory UpdateMessageFlagsRemoveEvent.fromJson(Map<String, dynamic> json) {
11731173
final result = _$UpdateMessageFlagsRemoveEventFromJson(json);
11741174
// Crunchy-shell validation
1175-
if (
1176-
result.flag == MessageFlag.read
1177-
&& true // (we assume `event_types` has `message` and `update_message_flags`)
1178-
) {
1175+
if (result.flag == MessageFlag.read) {
11791176
result.messageDetails as Map<int, UpdateMessageFlagsMessageDetail>;
11801177
}
11811178
return result;

0 commit comments

Comments
 (0)