mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-27 13:03:47 +03:00
chore: code cleanup
This commit is contained in:
parent
330e68eb93
commit
c249fd7d4d
3 changed files with 15 additions and 14 deletions
|
@ -1116,8 +1116,8 @@ fn get_missing_events(
|
|||
}
|
||||
|
||||
let events = linearize_previous_events(
|
||||
latest_events.into_iter().cloned(),
|
||||
earliest_events.into_iter().cloned(),
|
||||
latest_events.iter().cloned(),
|
||||
earliest_events.iter().cloned(),
|
||||
limit,
|
||||
get_pdu,
|
||||
event_filter,
|
||||
|
@ -1169,7 +1169,7 @@ where
|
|||
match pdu.get("prev_events") {
|
||||
None => {
|
||||
error!(?pdu, "A stored event has no 'prev_events' field");
|
||||
return None;
|
||||
None
|
||||
}
|
||||
Some(prev_events) => {
|
||||
let val = prev_events.clone().into();
|
||||
|
@ -1977,12 +1977,10 @@ pub async fn claim_keys_route(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::linearize_previous_events;
|
||||
use super::{add_port_to_hostname, get_ip_with_port, FedDest};
|
||||
use super::{add_port_to_hostname, get_ip_with_port, linearize_previous_events, FedDest};
|
||||
use ruma::{CanonicalJsonObject, CanonicalJsonValue, OwnedEventId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::value::RawValue;
|
||||
use serde_json::Value;
|
||||
use serde_json::{value::RawValue, Value};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use ruma::events::room::member::MembershipState;
|
||||
use ruma::{events::StateEventType, EventId, RoomId, UserId};
|
||||
use ruma::{
|
||||
events::{room::member::MembershipState, StateEventType},
|
||||
EventId, RoomId, UserId,
|
||||
};
|
||||
|
||||
use crate::{PduEvent, Result};
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ pub use data::Data;
|
|||
use lru_cache::LruCache;
|
||||
use ruma::{
|
||||
events::{
|
||||
room::history_visibility::HistoryVisibility, room::member::MembershipState, StateEventType,
|
||||
room::{history_visibility::HistoryVisibility, member::MembershipState},
|
||||
StateEventType,
|
||||
},
|
||||
EventId, OwnedServerName, OwnedUserId, RoomId, ServerName, UserId,
|
||||
};
|
||||
|
@ -110,14 +111,14 @@ impl Service {
|
|||
Some(HistoryVisibility::Invited) => {
|
||||
// Allow if any member on requesting server was AT LEAST invited, else deny
|
||||
current_server_members
|
||||
.into_iter()
|
||||
.any(|member| self.user_was_invited(shortstatehash, &member))
|
||||
.iter()
|
||||
.any(|member| self.user_was_invited(shortstatehash, member))
|
||||
}
|
||||
_ => {
|
||||
// Allow if any member on requested server was joined, else deny
|
||||
current_server_members
|
||||
.into_iter()
|
||||
.any(|member| self.user_was_joined(shortstatehash, &member))
|
||||
.iter()
|
||||
.any(|member| self.user_was_joined(shortstatehash, member))
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue