Compare commits

..

2 Commits

Author SHA1 Message Date
62a91a8615 fmt 2026-02-13 15:26:27 -05:00
c01b2336a7 matrix: fix elementx calls
Applies patch from: https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1370
That I am working on. Also updates version to latest (at this time) git
2026-02-13 15:26:17 -05:00
7 changed files with 126 additions and 17 deletions

View File

@@ -160,7 +160,9 @@ inputs.nixpkgs.lib.extend (
serviceName: tmpfilesRules: serviceName: tmpfilesRules:
{ pkgs, ... }: { pkgs, ... }:
let let
confFile = pkgs.writeText "${serviceName}-file-perms.conf" (lib.concatStringsSep "\n" tmpfilesRules); confFile = pkgs.writeText "${serviceName}-file-perms.conf" (
lib.concatStringsSep "\n" tmpfilesRules
);
in in
{ {
systemd.services."${serviceName}-file-perms" = { systemd.services."${serviceName}-file-perms" = {

View File

@@ -1,9 +1,34 @@
{ {
config, config,
pkgs,
service_configs, service_configs,
lib, lib,
... ...
}: }:
let
package =
let
src = pkgs.fetchFromGitea {
domain = "forgejo.ellis.link";
owner = "continuwuation";
repo = "continuwuity";
rev = "89ad809270dc0dbf428858a466aa9b90e9a8dccf";
hash = "sha256-fXLbuCkRGYljWXbCyDvczezZ3Zo8SCPh5sx1gZChccw=";
};
in
pkgs.matrix-continuwuity.overrideAttrs (old: {
inherit src;
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit src;
name = "${old.pname}-vendor";
hash = "sha256-cRdjFCxk9oYKyAOB+OaFGZzpWnyKgkdz5d5XXM/QzD4=";
};
patches = (old.patches or [ ]) ++ [
./sliding-sync-fix.patch
];
});
in
{ {
imports = [ imports = [
(lib.serviceMountWithZpool "continuwuity" service_configs.zpool_ssds [ (lib.serviceMountWithZpool "continuwuity" service_configs.zpool_ssds [
@@ -16,6 +41,7 @@
services.matrix-continuwuity = { services.matrix-continuwuity = {
enable = true; enable = true;
inherit package;
settings.global = { settings.global = {
port = [ service_configs.ports.matrix ]; port = [ service_configs.ports.matrix ];

View File

@@ -0,0 +1,93 @@
diff --git a/src/api/client/sync/v5.rs b/src/api/client/sync/v5.rs
index 8976fd02..df2f5844 100644
--- a/src/api/client/sync/v5.rs
+++ b/src/api/client/sync/v5.rs
@@ -30,7 +30,8 @@
api::client::sync::sync_events::{self, DeviceLists, UnreadNotificationsCount},
directory::RoomTypeFilter,
events::{
- AnyRawAccountDataEvent, AnySyncEphemeralRoomEvent, StateEventType, TimelineEventType,
+ AnyRawAccountDataEvent, AnySyncEphemeralRoomEvent, AnySyncStateEvent, StateEventType,
+ TimelineEventType,
room::member::{MembershipState, RoomMemberEventContent},
typing::TypingEventContent,
},
@@ -533,6 +534,9 @@ async fn process_rooms<'a, Rooms>(
}
});
+ let required_state =
+ collect_required_state(services, room_id, required_state_request).await;
+
let room_events: Vec<_> = timeline_pdus
.iter()
.stream()
@@ -551,21 +555,6 @@ async fn process_rooms<'a, Rooms>(
}
}
- let required_state = required_state_request
- .iter()
- .stream()
- .filter_map(|state| async move {
- services
- .rooms
- .state_accessor
- .room_state_get(room_id, &state.0, &state.1)
- .await
- .map(Event::into_format)
- .ok()
- })
- .collect()
- .await;
-
// Heroes
let heroes: Vec<_> = services
.rooms
@@ -689,6 +678,46 @@ async fn process_rooms<'a, Rooms>(
Ok(rooms)
}
+/// Collect the required state events for a room
+async fn collect_required_state(
+ services: &Services,
+ room_id: &RoomId,
+ required_state_request: &BTreeSet<TypeStateKey>,
+) -> Vec<Raw<AnySyncStateEvent>> {
+ let mut required_state = Vec::new();
+ for (event_type, state_key) in required_state_request {
+ // Resolve wild-card sentinel issue
+ // Addresses: https://forgejo.ellis.link/continuwuation/continuwuity/issues/1306
+ if state_key.as_str() == "*" {
+ if let Ok(keys) = services
+ .rooms
+ .state_accessor
+ .room_state_keys(room_id, event_type)
+ .await
+ {
+ for key in keys {
+ if let Ok(event) = services
+ .rooms
+ .state_accessor
+ .room_state_get(room_id, event_type, &key)
+ .await
+ {
+ required_state.push(Event::into_format(event));
+ }
+ }
+ }
+ } else if let Ok(event) = services
+ .rooms
+ .state_accessor
+ .room_state_get(room_id, event_type, state_key)
+ .await
+ {
+ required_state.push(Event::into_format(event));
+ }
+ }
+ required_state
+}
+
async fn collect_typing_events(
services: &Services,
sender_user: &UserId,

View File

@@ -25,10 +25,7 @@ let
serviceName: zpool: dirs: serviceName: zpool: dirs:
{ ... }: { ... }:
{ }; { };
serviceFilePerms = serviceFilePerms = serviceName: tmpfilesRules: { ... }: { };
serviceName: tmpfilesRules:
{ ... }:
{ };
} }
); );

View File

@@ -24,10 +24,7 @@ let
serviceName: zpool: dirs: serviceName: zpool: dirs:
{ ... }: { ... }:
{ }; { };
serviceFilePerms = serviceFilePerms = serviceName: tmpfilesRules: { ... }: { };
serviceName: tmpfilesRules:
{ ... }:
{ };
} }
); );

View File

@@ -26,10 +26,7 @@ let
serviceName: zpool: dirs: serviceName: zpool: dirs:
{ ... }: { ... }:
{ }; { };
serviceFilePerms = serviceFilePerms = serviceName: tmpfilesRules: { ... }: { };
serviceName: tmpfilesRules:
{ ... }:
{ };
optimizePackage = pkg: pkg; # No-op for testing optimizePackage = pkg: pkg; # No-op for testing
} }
); );

View File

@@ -24,10 +24,7 @@ let
serviceName: zpool: dirs: serviceName: zpool: dirs:
{ ... }: { ... }:
{ }; { };
serviceFilePerms = serviceFilePerms = serviceName: tmpfilesRules: { ... }: { };
serviceName: tmpfilesRules:
{ ... }:
{ };
} }
); );