mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2026-02-07 01:01:24 +01:00
fix logic errors
This commit is contained in:
parent
f48ca403cf
commit
39a380dbaf
4 changed files with 18 additions and 22 deletions
|
|
@ -51,20 +51,16 @@ impl service::globals::Data for KeyValueDatabase {
|
|||
futures.push(self.userroomid_joined.watch_prefix(&userid_prefix));
|
||||
futures.push(self.userroomid_invitestate.watch_prefix(&userid_prefix));
|
||||
futures.push(self.userroomid_leftstate.watch_prefix(&userid_prefix));
|
||||
// futures.push(
|
||||
// self.userroomid_notificationcount.watch_prefix(&userid_prefix),
|
||||
// );
|
||||
// futures
|
||||
// .push(self.userroomid_highlightcount.watch_prefix(&
|
||||
// userid_prefix));
|
||||
|
||||
let localpart_bytes = user_id.localpart().as_bytes().to_vec();
|
||||
let mut localpart_prefix = localpart_bytes.clone();
|
||||
localpart_prefix.push(0xFF);
|
||||
|
||||
// Return when we store a notification
|
||||
futures.push(
|
||||
self.userpducountid_notification.watch_prefix(&localpart_prefix),
|
||||
);
|
||||
futures.push(self.userroompducountid.watch_prefix(&localpart_prefix));
|
||||
|
||||
// Events for rooms we are in
|
||||
for room_id in services()
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
|
||||
let event_id = EventId::parse(
|
||||
utils::string_from_bytes(
|
||||
value.split(|b| *b == 0xFF).nth(2).unwrap(),
|
||||
value.split(|b| *b == 0xFF).nth(1).unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
|
|
@ -61,7 +61,7 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
|
||||
let pdu = services().rooms.timeline.get_pdu(&event_id)?;
|
||||
|
||||
if flags[0] == 1 && !pdu.map_or(true, |pdu| pdu.is_redacted()) {
|
||||
if flags[0] != 0 && !pdu.map_or(true, |pdu| !pdu.is_redacted()) {
|
||||
n += 1;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
|
||||
let event_id = EventId::parse(
|
||||
utils::string_from_bytes(
|
||||
value.split(|b| *b == 0xFF).nth(2).unwrap(),
|
||||
value.split(|b| *b == 0xFF).nth(1).unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
|
|
@ -96,7 +96,7 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
|
||||
let pdu = services().rooms.timeline.get_pdu(&event_id)?;
|
||||
|
||||
if flags[1] == 1 && !pdu.map_or(true, |pdu| pdu.is_redacted()) {
|
||||
if flags[1] != 0 && !pdu.map_or(true, |pdu| !pdu.is_redacted()) {
|
||||
n += 1;
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
|
||||
let (flags, value) = value.split_at(2);
|
||||
|
||||
let (notify, is_highlight) = (flags[0] == 1, flags[1] == 1);
|
||||
let (notify, is_highlight) = (flags[0] != 0, flags[1] != 0);
|
||||
|
||||
if !notify || highlight && !is_highlight {
|
||||
continue;
|
||||
|
|
@ -238,7 +238,7 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
let pdu = services().rooms.timeline.get_pdu(&event_id)?;
|
||||
|
||||
// do not bother with missing or redacted PDUs
|
||||
let Some(pdu) = pdu.filter(|pdu| pdu.is_redacted()) else {
|
||||
let Some(pdu) = pdu.filter(|pdu| !pdu.is_redacted()) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue