mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-16 20:49:05 -04:00
feat(ui): Rename State::Enjoy to State::CarryOn.
This commit is contained in:
@@ -380,7 +380,7 @@ pub enum State {
|
||||
|
||||
/// This state is the cruising speed, i.e. the “normal” state, where nothing
|
||||
/// fancy happens: all rooms are syncing, and life is great.
|
||||
Enjoy,
|
||||
CarryOn,
|
||||
|
||||
/// At this state, the sync has been stopped (because it was requested, or
|
||||
/// because it has errored too many times previously).
|
||||
@@ -396,8 +396,8 @@ impl State {
|
||||
let (next_state, actions) = match self {
|
||||
Init => (FirstRooms, Actions::none()),
|
||||
FirstRooms => (AllRooms, Actions::first_rooms_are_loaded()),
|
||||
AllRooms => (Enjoy, Actions::none()),
|
||||
Enjoy => (Enjoy, Actions::none()),
|
||||
AllRooms => (CarryOn, Actions::none()),
|
||||
CarryOn => (CarryOn, Actions::none()),
|
||||
// If the state was `Terminated` but the next state is calculated again, it means the
|
||||
// sync has been restarted. In this case, let's jump back on the previous state that led
|
||||
// to the termination. No action is required in this scenario.
|
||||
@@ -408,7 +408,7 @@ impl State {
|
||||
(state.to_owned(), Actions::none())
|
||||
}
|
||||
|
||||
state @ AllRooms | state @ Enjoy => {
|
||||
state @ AllRooms | state @ CarryOn => {
|
||||
// Refresh the lists.
|
||||
(state.to_owned(), Actions::refresh_lists())
|
||||
}
|
||||
@@ -627,24 +627,24 @@ mod tests {
|
||||
|
||||
// Next state.
|
||||
let state = state.next(sliding_sync).await?;
|
||||
assert_eq!(state, State::Enjoy);
|
||||
assert_eq!(state, State::CarryOn);
|
||||
|
||||
// Hypothetical termination.
|
||||
{
|
||||
let state =
|
||||
State::Terminated { from: Box::new(state.clone()) }.next(sliding_sync).await?;
|
||||
assert_eq!(state, State::Enjoy);
|
||||
assert_eq!(state, State::CarryOn);
|
||||
}
|
||||
|
||||
// Next state.
|
||||
let state = state.next(sliding_sync).await?;
|
||||
assert_eq!(state, State::Enjoy);
|
||||
assert_eq!(state, State::CarryOn);
|
||||
|
||||
// Hypothetical termination.
|
||||
{
|
||||
let state =
|
||||
State::Terminated { from: Box::new(state.clone()) }.next(sliding_sync).await?;
|
||||
assert_eq!(state, State::Enjoy);
|
||||
assert_eq!(state, State::CarryOn);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -317,7 +317,7 @@ async fn test_sync_from_init_to_enjoy() -> Result<(), Error> {
|
||||
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
states = AllRooms => Enjoy,
|
||||
states = AllRooms => CarryOn,
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
@@ -350,7 +350,7 @@ async fn test_sync_from_init_to_enjoy() -> Result<(), Error> {
|
||||
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
states = Enjoy => Enjoy,
|
||||
states = CarryOn => CarryOn,
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
@@ -458,7 +458,7 @@ async fn test_sync_resumes_from_previous_state() -> Result<(), Error> {
|
||||
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
states = AllRooms => Enjoy,
|
||||
states = AllRooms => CarryOn,
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
@@ -641,7 +641,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
// Do a regular sync from the `Terminated` state.
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
states = Terminated { .. } => Enjoy,
|
||||
states = Terminated { .. } => CarryOn,
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
@@ -665,11 +665,11 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
},
|
||||
};
|
||||
|
||||
// Do a regular sync from the `Enjoy` state to update the `ALL_ROOMS` list
|
||||
// Do a regular sync from the `CarryOn` state to update the `ALL_ROOMS` list
|
||||
// again.
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
states = Enjoy => Enjoy,
|
||||
states = CarryOn => CarryOn,
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
@@ -693,11 +693,11 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
},
|
||||
};
|
||||
|
||||
// Simulate an error from the `Enjoy` state.
|
||||
// Simulate an error from the `CarryOn` state.
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
sync matches Some(Err(_)),
|
||||
states = Enjoy => Terminated { .. },
|
||||
states = CarryOn => Terminated { .. },
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
@@ -727,7 +727,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
// Do a regular sync from the `Terminated` state.
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
states = Terminated { .. } => Enjoy,
|
||||
states = Terminated { .. } => CarryOn,
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
@@ -1358,7 +1358,7 @@ async fn test_input_viewport() -> Result<(), Error> {
|
||||
|
||||
sync_then_assert_request_and_fake_response! {
|
||||
[server, room_list, sync]
|
||||
states = AllRooms => Enjoy,
|
||||
states = AllRooms => CarryOn,
|
||||
assert request = {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
|
||||
Reference in New Issue
Block a user