remove: channel_mutes column

This commit is contained in:
trisua 2025-09-06 22:53:52 -04:00
parent 6d333378a4
commit abd23e0ccc
5 changed files with 14 additions and 18 deletions

View file

@ -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")

View file

@ -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),

View file

@ -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,

View file

@ -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;

View file

@ -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<usize>,
/// 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,