add: custom emojis

fix: don't show reposts of posts from blocked users
fix: don't show questions when they're from users you've blocked
This commit is contained in:
trisua 2025-05-10 21:58:02 -04:00
parent 9f187039e6
commit 275dd0a1eb
25 changed files with 697 additions and 61 deletions

View file

@ -533,6 +533,14 @@ pub async fn settings_request(
let can_manage_channels = membership.role.check(CommunityPermission::MANAGE_CHANNELS)
| user.permissions.check(FinePermission::MANAGE_CHANNELS);
let emojis = match data.0.get_emojis_by_community(community.id).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
};
let can_manage_emojis = membership.role.check(CommunityPermission::MANAGE_EMOJIS)
| user.permissions.check(FinePermission::MANAGE_EMOJIS);
// init context
let lang = get_lang!(jar, data.0);
let mut context = initial_context(&data.0.0, lang, &Some(user)).await;
@ -546,6 +554,9 @@ pub async fn settings_request(
context.insert("can_manage_channels", &can_manage_channels);
context.insert("channels", &channels);
context.insert("can_manage_emojis", &can_manage_emojis);
context.insert("emojis", &emojis);
// return
Ok(Html(
data.1
@ -574,11 +585,17 @@ pub async fn post_request(
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
};
let ignore_users = if let Some(ref ua) = user {
data.0.get_userblocks_receivers(ua.id).await
} else {
Vec::new()
};
// check repost
let reposting = data.0.get_post_reposting(&post).await;
let reposting = data.0.get_post_reposting(&post, &ignore_users).await;
// check question
let question = match data.0.get_post_question(&post).await {
let question = match data.0.get_post_question(&post, &ignore_users).await {
Ok(q) => q,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
};
@ -681,11 +698,17 @@ pub async fn reposts_request(
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
};
let ignore_users = if let Some(ref ua) = user {
data.0.get_userblocks_receivers(ua.id).await
} else {
Vec::new()
};
// check repost
let reposting = data.0.get_post_reposting(&post).await;
let reposting = data.0.get_post_reposting(&post, &ignore_users).await;
// check question
let question = match data.0.get_post_question(&post).await {
let question = match data.0.get_post_question(&post, &ignore_users).await {
Ok(q) => q,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
};