Fix experimental features not compiling without encryption

This commit is contained in:
Jonas Platte
2023-03-08 14:59:37 +01:00
committed by Jonas Platte
parent 68f8ed5a92
commit 932cf2ad99
5 changed files with 21 additions and 18 deletions

View File

@@ -25,11 +25,9 @@ use ruma::events::{
};
use tracing::error;
use super::{
inner::TimelineInner,
to_device::{handle_forwarded_room_key_event, handle_room_key_event},
Timeline, TimelineEventHandlerHandles,
};
#[cfg(feature = "e2e-encryption")]
use super::to_device::{handle_forwarded_room_key_event, handle_room_key_event};
use super::{inner::TimelineInner, Timeline, TimelineEventHandlerHandles};
use crate::room;
/// Builder that allows creating and configuring various parts of a

View File

@@ -185,6 +185,7 @@ pub(super) enum TimelineItemPosition {
#[derive(Default)]
pub(super) struct HandleEventResult {
pub(super) item_added: bool,
#[cfg(feature = "e2e-encryption")]
pub(super) item_removed: bool,
pub(super) items_updated: u16,
}
@@ -325,6 +326,8 @@ impl<'a> TimelineEventHandler<'a> {
if !self.result.item_added {
trace!("No new item added");
#[cfg(feature = "e2e-encryption")]
if let Flow::Remote { position: TimelineItemPosition::Update(idx), .. } = self.flow {
// If add was not called, that means the UTD event is one that
// wouldn't normally be visible. Remove it.

View File

@@ -12,20 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::{
collections::{BTreeSet, HashMap},
sync::Arc,
};
#[cfg(feature = "e2e-encryption")]
use std::collections::BTreeSet;
use std::{collections::HashMap, sync::Arc};
use async_trait::async_trait;
use eyeball_im::{ObservableVector, VectorSubscriber};
use im::Vector;
use indexmap::{IndexMap, IndexSet};
#[cfg(feature = "e2e-encryption")]
use matrix_sdk_base::crypto::OlmMachine;
use matrix_sdk_base::{
crypto::OlmMachine,
deserialized_responses::{EncryptionInfo, SyncTimelineEvent, TimelineEvent},
locks::{Mutex, MutexGuard},
};
#[cfg(feature = "e2e-encryption")]
use ruma::RoomId;
use ruma::{
events::{
fully_read::FullyReadEvent,
@@ -34,16 +36,12 @@ use ruma::{
AnyMessageLikeEventContent, AnySyncTimelineEvent,
},
serde::Raw,
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedTransactionId, OwnedUserId, RoomId,
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedTransactionId, OwnedUserId,
TransactionId, UserId,
};
use tracing::{
debug, error,
field::{self, debug},
info, info_span, warn, Instrument as _,
};
use tracing::{debug, error, field::debug, instrument, trace, warn};
#[cfg(feature = "e2e-encryption")]
use tracing::{instrument, trace};
use tracing::{field, info, info_span, Instrument as _};
use super::{
event_handler::{

View File

@@ -45,6 +45,7 @@ use super::{inner::RoomDataProvider, Profile, TimelineInner, TimelineItem};
mod basic;
mod echo;
#[cfg(feature = "e2e-encryption")]
mod encryption;
mod invalid;
mod read_receipts;

View File

@@ -191,7 +191,10 @@ fn check_docs() -> Result<()> {
fn run_feature_tests(cmd: Option<FeatureSet>) -> Result<()> {
let args = BTreeMap::from([
(FeatureSet::NoEncryption, "--no-default-features --features sled,native-tls"),
(
FeatureSet::NoEncryption,
"--no-default-features --features sled,native-tls,experimental-sliding-sync",
),
(FeatureSet::NoSled, "--no-default-features --features e2e-encryption,native-tls"),
(FeatureSet::NoEncryptionAndSled, "--no-default-features --features native-tls"),
(