Skip to content

Commit 5df53d7

Browse files
committed
timeline queue refactoring: address review comments
1 parent 9575ee9 commit 5df53d7

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

crates/matrix-sdk-ui/src/timeline/inner/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,11 @@ impl<P: RoomDataProvider> TimelineInner<P> {
723723
// reflected in the timeline, so we set all other pending events to
724724
// cancelled.
725725
//
726-
// TODO(bnjbvr): spooky action at a distance here^
726+
// TODO(bnjbvr): spooky action at a distance here^. The sending task is the one
727+
// deciding to clear the sending queue, so we're updating based on that implicit
728+
// knowledge here. Instead, the sending queue should notify the timeline that
729+
// it's deciding to not send those messages, and then only the
730+
// timeline should mark these items as cancelled.
727731
let items = &mut txn.items;
728732
let num_items = items.len();
729733
for idx in 0..num_items {

crates/matrix-sdk-ui/src/timeline/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ impl Timeline {
586586
| TimelineItemContent::ProfileChange(_)
587587
| TimelineItemContent::OtherState(_)
588588
| TimelineItemContent::CallInvite => {
589-
error_return!("Retrying state events/call invite is not currently supported");
589+
error_return!("Retrying state events/call invites is not currently supported");
590590
}
591591
TimelineItemContent::FailedToParseMessageLike { .. }
592592
| TimelineItemContent::FailedToParseState { .. } => {

crates/matrix-sdk-ui/src/timeline/queue.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ async fn send_or_queue_msg(
115115
return;
116116
}
117117

118-
if room.state() != RoomState::Joined {
118+
if room.state() == RoomState::Joined {
119+
send_task.start(room, msg);
120+
} else {
119121
info!("Refusing to send message, room is not joined");
120122
timeline
121123
.update_event_send_state(
@@ -126,10 +128,7 @@ async fn send_or_queue_msg(
126128
},
127129
)
128130
.await;
129-
return;
130131
}
131-
132-
send_task.start(room, msg);
133132
}
134133

135134
async fn handle_send_result(

0 commit comments

Comments
 (0)