From abd23e0ccc9d838fcd34c378136de4081d81af97 Mon Sep 17 00:00:00 2001 From: trisua Date: Sat, 6 Sep 2025 22:53:52 -0400 Subject: [PATCH] remove: channel_mutes column --- crates/app/src/public/html/macros.lisp | 3 +-- crates/core/src/database/auth.rs | 20 +++++++++---------- .../src/database/drivers/sql/create_users.sql | 1 - .../drivers/sql/version_migrations.sql | 4 ++++ crates/core/src/model/auth.rs | 4 ---- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/crates/app/src/public/html/macros.lisp b/crates/app/src/public/html/macros.lisp index 4903146..db07623 100644 --- a/crates/app/src/public/html/macros.lisp +++ b/crates/app/src/public/html/macros.lisp @@ -72,8 +72,7 @@ (a ("href" "{{ config.service_hosts.tawny }}/api/v1/auth/set_token?token=") (icon (text "message-circle")) - (str (text "communities:label.chats")) - (span ("class" "chip") (text "beta"))) + (str (text "communities:label.chats"))) (text "{%- endif %}") (a ("href" "/mail") diff --git a/crates/core/src/database/auth.rs b/crates/core/src/database/auth.rs index c7ec572..be378ef 100644 --- a/crates/core/src/database/auth.rs +++ b/crates/core/src/database/auth.rs @@ -123,15 +123,14 @@ impl DataManager { was_purchased: get!(x->25(i32)) as i8 == 1, browser_session: get!(x->26(String)), ban_reason: get!(x->27(String)), - channel_mutes: serde_json::from_str(&get!(x->28(String)).to_string()).unwrap(), - is_deactivated: get!(x->29(i32)) as i8 == 1, - ban_expire: get!(x->30(i64)) as usize, - coins: get!(x->31(i32)), - checkouts: serde_json::from_str(&get!(x->32(String)).to_string()).unwrap(), - applied_configurations: serde_json::from_str(&get!(x->33(String)).to_string()).unwrap(), - last_policy_consent: get!(x->34(i64)) as usize, - close_friends_stack: get!(x->35(i64)) as usize, - missed_messages_count: get!(x->36(i32)) as usize, + is_deactivated: get!(x->28(i32)) as i8 == 1, + ban_expire: get!(x->29(i64)) as usize, + coins: get!(x->30(i32)), + checkouts: serde_json::from_str(&get!(x->31(String)).to_string()).unwrap(), + applied_configurations: serde_json::from_str(&get!(x->32(String)).to_string()).unwrap(), + last_policy_consent: get!(x->33(i64)) as usize, + close_friends_stack: get!(x->34(i64)) as usize, + missed_messages_count: get!(x->35(i32)) as usize, } } @@ -288,7 +287,7 @@ impl DataManager { let res = execute!( &conn, - "INSERT INTO users VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36)", + "INSERT INTO users VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35)", params![ &(data.id as i64), &(data.created as i64), @@ -318,7 +317,6 @@ impl DataManager { &if data.was_purchased { 1_i32 } else { 0_i32 }, &data.browser_session, &data.ban_reason, - &serde_json::to_string(&data.channel_mutes).unwrap(), &if data.is_deactivated { 1_i32 } else { 0_i32 }, &(data.ban_expire as i64), &(data.coins as i32), diff --git a/crates/core/src/database/drivers/sql/create_users.sql b/crates/core/src/database/drivers/sql/create_users.sql index 7e20e55..8d6aad3 100644 --- a/crates/core/src/database/drivers/sql/create_users.sql +++ b/crates/core/src/database/drivers/sql/create_users.sql @@ -27,7 +27,6 @@ CREATE TABLE IF NOT EXISTS users ( was_purchased INT NOT NULL, browser_session TEXT NOT NULL, ban_reason TEXT NOT NULL, - channel_mutes TEXT NOT NULL, is_deactivated INT NOT NULL, ban_expire BIGINT NOT NULL, coins INT NOT NULL, diff --git a/crates/core/src/database/drivers/sql/version_migrations.sql b/crates/core/src/database/drivers/sql/version_migrations.sql index f9d9afd..8f5524b 100644 --- a/crates/core/src/database/drivers/sql/version_migrations.sql +++ b/crates/core/src/database/drivers/sql/version_migrations.sql @@ -89,3 +89,7 @@ ADD COLUMN IF NOT EXISTS is_locked INT DEFAULT 0; -- users missed_messages_count ALTER TABLE users ADD COLUMN IF NOT EXISTS missed_messages_count INT DEFAULT 0; + +-- users channel_mutes +ALTER TABLE users +DROP COLUMN IF EXISTS channel_mutes; diff --git a/crates/core/src/model/auth.rs b/crates/core/src/model/auth.rs index 104107c..fbfa51a 100644 --- a/crates/core/src/model/auth.rs +++ b/crates/core/src/model/auth.rs @@ -85,9 +85,6 @@ pub struct User { /// The reason the user was banned. #[serde(default)] pub ban_reason: String, - /// IDs of channels the user has muted. - #[serde(default)] - pub channel_mutes: Vec, /// If the user is deactivated. Deactivated users act almost like deleted /// users, but their data is not wiped. #[serde(default)] @@ -461,7 +458,6 @@ impl User { was_purchased: false, browser_session: String::new(), ban_reason: String::new(), - channel_mutes: Vec::new(), is_deactivated: false, ban_expire: 0, coins: 0,