fix: invite codes fix: missing icons

This commit is contained in:
trisua 2025-06-23 22:31:14 -04:00
parent 5fbf454b52
commit 66beef6b1d
8 changed files with 38 additions and 25 deletions

View file

@ -180,7 +180,8 @@ macro_rules! vendor_icon {
let writer = &mut ICONS.write().await;
writer.insert($name.to_string(), $icon.to_string());
let file_path = PathBufD::current().extend(&[$icons_dir.clone(), $name.to_string()]);
let file_path =
PathBufD::current().extend(&[$icons_dir.clone(), format!("{}.svg", $name.to_string())]);
std::fs::write(file_path, $icon).unwrap();
}};
}

View file

@ -427,6 +427,7 @@ input[type="checkbox"] {
background-repeat: no-repeat;
width: 1em !important;
height: 1em;
min-width: 1em;
outline: none;
border: solid 1px var(--color-super-lowered);
padding: 0;

View file

@ -70,7 +70,7 @@
("href" "{{ config.policies.privacy }}")
(text "Privacy policy"))))
(div
("class" "flex gap-2")
("class" "flex items-center gap-2")
(input
("type" "checkbox")
("name" "policy_consent")

View file

@ -129,7 +129,7 @@
(pre ("class" "hidden red w-full") (code ("id" "scope_error_message") ("style" "white-space: pre-wrap")))
(details
(summary ("class" "button lowered small") (icon (text "circle-help")) (text "Help"))
(summary ("class" "button lowered small") (icon (text "circle-question-mark")) (text "Help"))
(div
("class" "card flex flex-col gap-1")
(span ("class" "fade") (text "Scopes should be separated by a single space."))

View file

@ -92,7 +92,7 @@
("class" "card-nest")
(div
("class" "card small flex items-center gap-2")
(icon (text "circle-help"))
(icon (text "circle-question-mark"))
(str (text "developer:label.guides_and_help")))
(div

View file

@ -53,7 +53,7 @@
("title" "Search help")
("href" "{{ config.manuals.search_help }}")
("target" "_blank")
(text "{{ icon \"circle-help\" }}"))
(text "{{ icon \"circle-question-mark\" }}"))
(text "{%- endif %}"))))
(text "{%- endif %}")
(text "{% for post in list %} {% if post[2].read_access == \"Everybody\" -%} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[3], post=post[0], owner=post[1], secondary=true, community=post[2], show_community=true) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %} {% if profile -%} {{ components::pagination(page=page, items=list|length, key=\"&profile=\" ~ profile.id, value=\"&query=\" ~ query) }} {% else %} {{ components::pagination(page=page, items=list|length, key=\"&query=\" ~ query) }} {%- endif %}"))))

View file

@ -123,10 +123,6 @@ pub async fn register_request(
// }
user.invite_code = invite_code.id;
if let Err(e) = data.update_invite_code_is_used(invite_code.id, true).await {
return (None, Json(e.into()));
}
}
// push initial token
@ -135,21 +131,36 @@ pub async fn register_request(
// return
match data.create_user(user).await {
Ok(_) => (
Some([(
"Set-Cookie",
format!(
"__Secure-atto-token={}; SameSite=Lax; Secure; Path=/; HostOnly=true; HttpOnly=true; Max-Age={}",
initial_token,
60 * 60 * 24 * 365
),
)]),
Json(ApiReturn {
ok: true,
message: initial_token,
payload: (),
}),
),
Ok(_) => {
// mark invite as used
if data.0.0.security.enable_invite_codes {
let invite_code = match data.get_invite_code_by_code(&props.invite_code).await {
Ok(c) => c,
Err(e) => return (None, Json(e.into())),
};
if let Err(e) = data.update_invite_code_is_used(invite_code.id, true).await {
return (None, Json(e.into()));
}
}
// ...
(
Some([(
"Set-Cookie",
format!(
"__Secure-atto-token={}; SameSite=Lax; Secure; Path=/; HostOnly=true; HttpOnly=true; Max-Age={}",
initial_token,
60 * 60 * 24 * 365
),
)]),
Json(ApiReturn {
ok: true,
message: initial_token,
payload: (),
}),
)
}
Err(e) => (None, Json(e.into())),
}
}

View file

@ -266,7 +266,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)",
"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)",
params![
&(data.id as i64),
&(data.created as i64),