add: reposts/quotes pages

add: repost notification
This commit is contained in:
trisua 2025-04-23 16:46:13 -04:00
parent 41250ef7ed
commit 276f25a496
17 changed files with 601 additions and 50 deletions

View file

@ -1,7 +1,7 @@
use super::*;
use crate::cache::Cache;
use crate::model::{Error, Result, auth::User, auth::UserBlock, permissions::FinePermission};
use crate::{auto_method, execute, get, query_row, params};
use crate::{auto_method, execute, get, params, query_row, query_rows};
#[cfg(feature = "sqlite")]
use rusqlite::Row;
@ -75,6 +75,35 @@ impl DataManager {
Ok(res.unwrap())
}
/// Get the receiver of all user blocks for the given `initiator`.
pub async fn get_userblocks_receivers(&self, initiator: usize) -> Vec<usize> {
let conn = match self.connect().await {
Ok(c) => c,
Err(_) => return Vec::new(),
};
let res = query_rows!(
&conn,
"SELECT * FROM userblocks WHERE receiver = $1",
&[&(initiator as i64)],
|x| { Self::get_userblock_from_row(x) }
);
if res.is_err() {
return Vec::new();
}
// get receivers
let mut out: Vec<usize> = Vec::new();
for b in res.unwrap() {
out.push(b.receiver);
}
// return
out
}
/// Create a new user block in the database.
///
/// # Arguments