Compare commits

...

3 Commits

Author SHA1 Message Date
Sebastian Klähn
9ac9a4a214 Add bot contact to every account 2024-10-23 14:22:37 +02:00
link2xt
aa3ef5011b build: nix flake update fenix 2024-10-23 03:31:39 +00:00
link2xt
1d3072c287 build: nix flake update nixpkgs 2024-10-23 03:19:33 +00:00
2 changed files with 45 additions and 12 deletions

24
flake.lock generated
View File

@@ -48,11 +48,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1714112748,
"narHash": "sha256-jq6Cpf/pQH85p+uTwPPrGG8Ky/zUOTwMJ7mcqc5M4So=",
"lastModified": 1729578683,
"narHash": "sha256-h0Wmvrkadbyi3IJXFLPi+QyYjCAKDr2xQ6dLxlQ8cXY=",
"owner": "nix-community",
"repo": "fenix",
"rev": "3ae4b908a795b6a3824d401a0702e11a7157d7e1",
"rev": "d66cda53e8193a878742dcadb5bb75f4df7c3c0a",
"type": "github"
},
"original": {
@@ -166,11 +166,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1713895582,
"narHash": "sha256-cfh1hi+6muQMbi9acOlju3V1gl8BEaZBXBR9jQfQi4U=",
"lastModified": 1729256560,
"narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "572af610f6151fd41c212f897c71f7056e3fb518",
"rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0",
"type": "github"
},
"original": {
@@ -195,11 +195,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1714076141,
"narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=",
"lastModified": 1729413321,
"narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856",
"rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26",
"type": "github"
},
"original": {
@@ -222,11 +222,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1714031783,
"narHash": "sha256-xS/niQsq1CQPOe4M4jvVPO2cnXS/EIeRG5gIopUbk+Q=",
"lastModified": 1729533545,
"narHash": "sha256-A/AuEWcGwwjpfBCZqWDNNg5GwYrJduzLvlMe+A7xG5U=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "56bee2ddafa6177b19c631eedc88d43366553223",
"rev": "de2ff17bc513807412d7bbaba1d995a774938583",
"type": "github"
},
"original": {

View File

@@ -1070,6 +1070,15 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid);
.await?;
}
inc_and_check(&mut migration_version, 124)?;
if dbversion < migration_version {
sql.execute_migration(
"INSERT INTO contacts (name, addr, origin, authname, is_bot) VALUES ('xstore', 'xstore@testrun.org', 67108864, '', true);",
migration_version,
)
.await?;
}
let new_version = sql
.get_raw_config_int(VERSION_CFG)
.await?
@@ -1133,3 +1142,27 @@ impl Sql {
self.set_db_version_in_cache(version).await
}
}
#[cfg(test)]
mod tests {
use crate::{contact, test_utils::TestContext};
use anyhow::Result;
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_name() -> Result<()> {
let bob = TestContext::new_bob().await;
let xstore_id = contact::Contact::lookup_id_by_addr(
&bob,
"xstore@testrun.org",
contact::Origin::Unknown,
)
.await?
.expect("Expect xstore contact");
let xstore = contact::Contact::get_by_id(&bob, xstore_id).await?;
assert_eq!(xstore.get_name(), "xstore");
assert_eq!(xstore.get_addr(), "xstore@testrun.org");
assert_eq!(xstore.origin, contact::Origin::ManuallyCreated);
assert_eq!(xstore.is_bot(), true);
Ok(())
}
}